Documentation
¶
Index ¶
- Constants
- Variables
- type ChatMessage
- type ChatRoom
- type ChatServer
- type Client
- func (c *Client) ClientContiniousRead()
- func (c *Client) ClientContiniousWrite(messageChan chan string, roomName string)
- func (c *Client) ConnectToMiddleMan()
- func (c *Client) ConnectToRoom(inputStream chan string, roomName string)
- func (c *Client) Display(displayChan chan string)
- func (c *Client) MakeRoomMessage(roomName, message string) Message
- func (c *Client) Pong()
- func (c *Client) StartUp(displayChan chan string)
- func (c *Client) UpdateRoomList(message Message)
- type ClientInter
- type ConnectRoomMessage
- type InboundMessage
- type Message
- func (m *Message) DataAsString() string
- func (m *Message) DecodeMessage(sender *net.UDPAddr, p []byte) error
- func (m *Message) EncodeMessage() ([]byte, error)
- func (m *Message) Encrypted() bool
- func (m *Message) RawData() []byte
- func (m *Message) Sender() *net.UDPAddr
- func (m *Message) Size() int
- func (m *Message) Type() MessageType
- type MessageType
- type OutboundMessage
- type Peer
- type RawMessage
- type RemoteClient
- type RoomListMessage
- type RoomMessage
- type Server
- func (s *Server) AddToRoom(roomName string, room *ChatRoom, client *RemoteClient)
- func (s *Server) ClientConnectToRoom(message Message)
- func (s *Server) Ping(client *net.UDPAddr)
- func (s *Server) RoomWatcher(room *ChatRoom)
- func (s *Server) Serve()
- func (s *Server) UpdateRoomList(roomName string, room *ChatRoom, client *net.UDPAddr)
- type Uptime
Constants ¶
View Source
const MAX_UDP_DATAGRAM = 65507
Variables ¶
View Source
var ProtocolReadError = errors.New("Message cannot be read")
View Source
var ProtocolWriteError = errors.New("Message cannot be written")
Functions ¶
This section is empty.
Types ¶
type ChatMessage ¶
type ChatMessage struct {
RoomMessage
Message string
}
func (*ChatMessage) DecodeMessage ¶
func (m *ChatMessage) DecodeMessage(buf []byte) error
func (*ChatMessage) EncodeMessage ¶
func (m *ChatMessage) EncodeMessage() ([]byte, error)
type ChatServer ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) ClientContiniousRead ¶
func (c *Client) ClientContiniousRead()
func (*Client) ClientContiniousWrite ¶
func (*Client) ConnectToMiddleMan ¶
func (c *Client) ConnectToMiddleMan()
func (*Client) ConnectToRoom ¶
func (*Client) MakeRoomMessage ¶
func (*Client) UpdateRoomList ¶
type ClientInter ¶
type ConnectRoomMessage ¶
type ConnectRoomMessage struct {
RoomMessage
// contains filtered or unexported fields
}
func (*ConnectRoomMessage) DecodeMessage ¶
func (m *ConnectRoomMessage) DecodeMessage(buf []byte) error
func (*ConnectRoomMessage) EncodeMessage ¶
func (m *ConnectRoomMessage) EncodeMessage() ([]byte, error)
type InboundMessage ¶
type Message ¶
type Message struct {
RawMessage
MsgType MessageType
EncryptedMsg bool
Length uint16
}
func (*Message) DataAsString ¶
func (*Message) DecodeMessage ¶
func (*Message) EncodeMessage ¶
func (*Message) Type ¶
func (m *Message) Type() MessageType
type MessageType ¶
type MessageType uint8
const ( PING MessageType = 1 PONG MessageType = 2 CONNECT_TO_MIDDLE_MAN MessageType = 3 RESPOND_TO_MIDDLE_MAN MessageType = 4 CONNECT_TO_ROOM MessageType = 5 DISCONNECT_FROM_ROOM MessageType = 6 ROOM_LIST MessageType = 7 ROOM_MESSAGE MessageType = 8 ROOM_HISTORY MessageType = 9 )
type OutboundMessage ¶
type OutboundMessage interface {
RawMessage() RawMessage
}
type RawMessage ¶
type RemoteClient ¶
type RemoteClient struct {
Uptime
// contains filtered or unexported fields
}
type RoomListMessage ¶
type RoomListMessage struct {
RoomMessage
Length uint16
Addresses []net.UDPAddr
}
func (*RoomListMessage) DecodeMessage ¶
func (m *RoomListMessage) DecodeMessage(buf []byte) error
func (*RoomListMessage) EncodeMessage ¶
func (m *RoomListMessage) EncodeMessage() ([]byte, error)
func (*RoomListMessage) RawMessage ¶
func (m *RoomListMessage) RawMessage() (RawMessage, error)
type RoomMessage ¶
type RoomMessage struct {
Room string
}
func (*RoomMessage) DecodeMessage ¶
func (m *RoomMessage) DecodeMessage(buf []byte) error
func (*RoomMessage) EncodeMessage ¶
func (m *RoomMessage) EncodeMessage() ([]byte, error)
func (*RoomMessage) RawMessage ¶
func (m *RoomMessage) RawMessage() (RawMessage, error)
type Server ¶
func (*Server) AddToRoom ¶
func (s *Server) AddToRoom(roomName string, room *ChatRoom, client *RemoteClient)
func (*Server) ClientConnectToRoom ¶
func (*Server) RoomWatcher ¶
Click to show internal directories.
Click to hide internal directories.