Documentation ¶
Index ¶
Constants ¶
View Source
const ( ConnectionRequest = iota + 1 Connected Disconnected GatheringFinished )
View Source
const ID = "/snake/gather/0.1.0"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GatherMessage ¶
type GatherMessage struct { Type GatherMessageType Addrs []peer.AddrInfo }
GatherMessage represents a set of all different messages possible to be sent in the gather protocol. This kind of all-in-one message is only possible because of the simplicity of the protocol bus is potentially inefficient. If any of the message types were to have additional fields, the messages of all other types would have to have these additional fields, even though they don't need them. (TODO: consider protobuf).
type GatherMessageType ¶
type GatherMessageType int
type GatherPointBeacon ¶
type GatherPointBeacon struct {
// contains filtered or unexported fields
}
func NewGatherPointBeacon ¶
func (*GatherPointBeacon) Close ¶
func (b *GatherPointBeacon) Close()
type GatherPointMessage ¶
type GatherService ¶
type GatherService struct {
// contains filtered or unexported fields
}
func NewGatherService ¶
func NewGatherService(h host.Host, topic *pubsub.Topic, game *game.GameService, ping *ping.PingService, n int, TTL time.Duration, gameCh chan<- game.GameEstablished) (*GatherService, error)
func (*GatherService) Close ¶
func (gs *GatherService) Close()
func (*GatherService) GatherHandler ¶
func (gs *GatherService) GatherHandler(stream network.Stream)
type JoinService ¶
type JoinService struct {
// contains filtered or unexported fields
}
func NewJoinService ¶
func NewJoinService(ctx context.Context, h host.Host, game *game.GameService, ping *ping.PingService, pID peer.ID, gameCh chan<- game.GameEstablished) (*JoinService, error)
func (*JoinService) Close ¶
func (js *JoinService) Close()
Click to show internal directories.
Click to hide internal directories.