models

package
v0.0.0-...-c5e9a66 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetUser

func SetUser(token string, user *User)

Types

type Client

type Client struct {
	Id   string
	Name string
	Conn *websocket.Conn
}

func NewClient

func NewClient(id string, name string, conn *websocket.Conn) Client

type Configuration

type Configuration struct {
	Port                       string
	Mapbox_api_key             string
	Github_oauth_url           string
	Github_oauth_clientid      string
	Github_oauth_client_secret string
}
var Config Configuration

func (Configuration) String

func (c Configuration) String() string

type Event

type Event struct {
	RoomId   string   `json:"roomId"`
	ClientId string   `json:"clientId"`
	Name     string   `json:"name"`
	Loc      Location `json:"loc"`
}

func (Event) String

func (e Event) String() string

type Location

type Location struct {
	Lat     float32 `json:"lat"`
	Lng     float32 `json:"lng"`
	Acc     float32 `json:"acc"`
	Heading float32 `json:"heading"`
	Speed   float32 `json:"speed"`
	TS      uint64  `json:"ts"`
}

type OAuthAccessResponse

type OAuthAccessResponse struct {
	AccessToken string `json:"access_token"`
	Scope       string `json:"scope"`
	TokenType   string `json:"token_type"`
}

type Room

type Room struct {
	sync.RWMutex
	Id      string
	Clients map[string]*Client
}

func NewRoom

func NewRoom(id string) Room

func (*Room) Iter

func (r *Room) Iter() <-chan *Client

func (*Room) Join

func (r *Room) Join(id string, c *Client)

func (*Room) Leave

func (r *Room) Leave(id string)

type Rooms

type Rooms struct {
	sync.RWMutex
	Id    string
	Rooms map[string]*Room
}

func NewRooms

func NewRooms() Rooms

func (*Rooms) Add

func (rs *Rooms) Add(id string, r *Room)

func (*Rooms) Get

func (rs *Rooms) Get(id string) *Room

func (*Rooms) Iter

func (rs *Rooms) Iter() <-chan *Room

func (*Rooms) Remove

func (rs *Rooms) Remove(id string)

type User

type User struct {
}

func GetUser

func GetUser(token string) *User

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL