Documentation ¶
Index ¶
- Constants
- func Handler(ctx context.Context, store stores.Store, ...) (*sync.WaitGroup, http.HandlerFunc)
- type ClosePacket
- type ConnectPacket
- type CreatePacket
- type CredentialsPacket
- type DisconnectPacket
- type EventPacket
- type ForwardablePacket
- type HelloPacket
- type JoinPacket
- type JoinedPacket
- type ListPacket
- type LobbiesPacket
- type MissingRecipientError
- type Peer
- func (p *Peer) Close(ctx context.Context)
- func (p *Peer) ForwardMessage(ctx context.Context, raw []byte)
- func (p *Peer) HandleClosePacket(ctx context.Context, packet ClosePacket) error
- func (p *Peer) HandleCreatePacket(ctx context.Context, packet CreatePacket) error
- func (p *Peer) HandleHelloPacket(ctx context.Context, packet HelloPacket) error
- func (p *Peer) HandleJoinPacket(ctx context.Context, packet JoinPacket) error
- func (p *Peer) HandleListPacket(ctx context.Context, packet ListPacket) error
- func (p *Peer) HandlePacket(ctx context.Context, typ string, raw []byte) error
- func (p *Peer) RequestConnection(ctx context.Context, otherID string) error
- func (p *Peer) Send(ctx context.Context, packet interface{}) error
- type PingPacket
- type TimeoutManager
- type WelcomePacket
Constants ¶
View Source
const LobbyCleanInterval = 30 * time.Minute
View Source
const LobbyCleanThreshold = 24 * time.Hour
View Source
const MaxConnectionTime = 1 * time.Hour
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
func Handler(ctx context.Context, store stores.Store, cloudflare *cloudflare.CredentialsClient) (*sync.WaitGroup, http.HandlerFunc)
Types ¶
type ClosePacket ¶
type ConnectPacket ¶
type CreatePacket ¶
type CredentialsPacket ¶
type CredentialsPacket struct { cloudflare.Credentials Type string `json:"type"` RequestID string `json:"rid,omitempty"` }
type DisconnectPacket ¶
type EventPacket ¶
type EventPacket struct { metrics.EventParams Type string `json:"type"` }
type ForwardablePacket ¶
type HelloPacket ¶
type JoinPacket ¶
type JoinedPacket ¶
type ListPacket ¶
type LobbiesPacket ¶
type MissingRecipientError ¶
type MissingRecipientError struct { Recipient string `json:"recipient"` Cause error `json:"cause"` }
func (*MissingRecipientError) Error ¶
func (e *MissingRecipientError) Error() string
func (*MissingRecipientError) ErrorCode ¶
func (e *MissingRecipientError) ErrorCode() string
func (*MissingRecipientError) MarshalJSON ¶
func (e *MissingRecipientError) MarshalJSON() ([]byte, error)
func (*MissingRecipientError) Unwrap ¶
func (e *MissingRecipientError) Unwrap() error
type Peer ¶
type Peer struct { ID string Secret string Game string Lobby string // contains filtered or unexported fields }
func (*Peer) HandleClosePacket ¶
func (p *Peer) HandleClosePacket(ctx context.Context, packet ClosePacket) error
func (*Peer) HandleCreatePacket ¶
func (p *Peer) HandleCreatePacket(ctx context.Context, packet CreatePacket) error
func (*Peer) HandleHelloPacket ¶
func (p *Peer) HandleHelloPacket(ctx context.Context, packet HelloPacket) error
func (*Peer) HandleJoinPacket ¶
func (p *Peer) HandleJoinPacket(ctx context.Context, packet JoinPacket) error
func (*Peer) HandleListPacket ¶
func (p *Peer) HandleListPacket(ctx context.Context, packet ListPacket) error
func (*Peer) HandlePacket ¶
func (*Peer) RequestConnection ¶
type PingPacket ¶
type PingPacket struct {
Type string `json:"type"`
}
type TimeoutManager ¶
func (*TimeoutManager) Disconnected ¶
func (i *TimeoutManager) Disconnected(ctx context.Context, p *Peer)
func (*TimeoutManager) Reconnected ¶
func (*TimeoutManager) Run ¶
func (i *TimeoutManager) Run(ctx context.Context)
func (*TimeoutManager) RunOnce ¶
func (i *TimeoutManager) RunOnce(ctx context.Context)
type WelcomePacket ¶
Click to show internal directories.
Click to hide internal directories.