Documentation ¶
Index ¶
- Variables
- func RegisterMessage(m Message)
- type Event
- type EventClosed
- type EventConnect
- type EventDisconnect
- type EventHosting
- type EventJoined
- type EventJoining
- type EventMessage
- type Message
- type MessageClose
- type MessageID
- type MessageRaw
- type Packet
- type Peer
- func (p *Peer) Close() error
- func (p *Peer) ID() uint32
- func (p *Peer) LocalAddr() net.Addr
- func (p *Peer) ReadFrom(b []byte) (n int, addr net.Addr, err error)
- func (p *Peer) Send(msg Message) error
- func (p *Peer) SetDeadline(t time.Time) error
- func (p *Peer) SetReadDeadline(t time.Time) error
- func (p *Peer) SetWriteDeadline(t time.Time) error
- func (p *Peer) WriteTo(b []byte, addr net.Addr) (n int, err error)
- type PeerPacket
- type ServerClient
- func (s *ServerClient) Close()
- func (s *ServerClient) ConnectTo(address string) error
- func (s *ServerClient) ID() uint32
- func (s *ServerClient) Init()
- func (s *ServerClient) LogicLoop()
- func (s *ServerClient) Open(address string) error
- func (s *ServerClient) Peers() []*Peer
- func (s *ServerClient) ReadLoop()
Constants ¶
This section is empty.
Variables ¶
View Source
var NetBufferSize = 2048
View Source
var NetChannelSize = 10
View Source
var NetDataShards = 10
View Source
var NetParityShards = 3
Functions ¶
func RegisterMessage ¶
func RegisterMessage(m Message)
Types ¶
type EventClosed ¶
type EventClosed struct { }
type EventConnect ¶
type EventDisconnect ¶
type EventHosting ¶
type EventHosting struct { }
type EventJoined ¶
type EventJoined struct { }
type EventJoining ¶
type EventJoining struct { }
type EventMessage ¶
type Message ¶
func MessageFromBytes ¶
type MessageClose ¶
type MessageClose struct { }
func (MessageClose) Ident ¶
func (m MessageClose) Ident() uint8
func (MessageClose) ToBytes ¶
func (m MessageClose) ToBytes() []byte
type MessageRaw ¶
type MessageRaw struct {
Data []byte
}
func (MessageRaw) Ident ¶
func (m MessageRaw) Ident() uint8
func (MessageRaw) ToBytes ¶
func (m MessageRaw) ToBytes() (b []byte)
type Peer ¶
type Peer struct {
// contains filtered or unexported fields
}
func (*Peer) SetReadDeadline ¶
SetReadDeadline does nothing.
func (*Peer) SetWriteDeadline ¶
SetWriteDeadline does nothing.
type PeerPacket ¶
type PeerPacket struct {
// contains filtered or unexported fields
}
type ServerClient ¶
type ServerClient struct { // Matchmaker string UseMatchmaker bool Hosting bool Running bool EventChan chan Event // contains filtered or unexported fields }
func (*ServerClient) Close ¶
func (s *ServerClient) Close()
func (*ServerClient) ConnectTo ¶
func (s *ServerClient) ConnectTo(address string) error
func (*ServerClient) ID ¶
func (s *ServerClient) ID() uint32
func (*ServerClient) Init ¶
func (s *ServerClient) Init()
func (*ServerClient) LogicLoop ¶
func (s *ServerClient) LogicLoop()
LogicLoop is the main logic loop that handles raw packets and otherwise.
func (*ServerClient) Open ¶
func (s *ServerClient) Open(address string) error
func (*ServerClient) Peers ¶
func (s *ServerClient) Peers() []*Peer
func (*ServerClient) ReadLoop ¶
func (s *ServerClient) ReadLoop()
ReadLoop runs the network read loop, handling new connections as necessary.
Click to show internal directories.
Click to hide internal directories.