Documentation
¶
Index ¶
Constants ¶
const ( MTypeKeepAlive byte = 0x00 MTypeClientHello byte = 0x01 MTypeProtoUnsupported byte = 0x02 MTypeServerHelloComplete byte = 0x03 MTypeServerHello byte = 0x04 MTypeClientHelloComplete byte = 0x05 MTypeEntryAssign byte = 0x10 MTypeEntryUpdate byte = 0x11 MTypeEntryFlagUpdate byte = 0x12 MTypeEntryDelete byte = 0x13 MTypeClearAllEntries byte = 0x14 MTypeRPCExecute byte = 0x20 MTypeRPCResponse byte = 0x21 )
Variables ¶
var ( //NewEntryID is the ID of an element when a client is creating a new entry. NewEntryID = [2]byte{0xff, 0xff} //NewEntrySN is the sequence number of an element when a client is creating a new entry. NewEntrySN = [2]byte{0x00, 0x00} )
Functions ¶
This section is empty.
Types ¶
type ClearAllEntries ¶
type ClearAllEntries struct {
// contains filtered or unexported fields
}
ClearAllEntries clears all entries from the network.
func NewClearAllEntries ¶
func NewClearAllEntries() *ClearAllEntries
NewClearAllEntries creates an instance of clear all entries.
func (*ClearAllEntries) MarshalMessage ¶
func (cae *ClearAllEntries) MarshalMessage(writer io.Writer) error
MarshalMessage implements Marshaler for Network Table Messages.
func (*ClearAllEntries) UnmarshalMessage ¶
func (cae *ClearAllEntries) UnmarshalMessage(reader io.Reader) error
UnmarshalMessage implements Unmarshaler for Network Table Messages and assumes the message type bit has already been read.
type ClientHello ¶
type ClientHello struct {
// contains filtered or unexported fields
}
ClientHello is sent when a client is first communicating to a server.
func NewClientHello ¶
func NewClientHello(protocol [2]byte, clientName string) *ClientHello
NewClientHello creates a new instance of ClientHello with the specified Protocol and Client Name.
func (*ClientHello) GetClientName ¶
func (ch *ClientHello) GetClientName() string
GetClientName gets the name of the client from the message.
func (*ClientHello) GetProtocol ¶
func (ch *ClientHello) GetProtocol() [2]byte
GetProtocol gets the protocol of the message.
func (*ClientHello) MarshalMessage ¶
func (ch *ClientHello) MarshalMessage(writer io.Writer) error
MarshalMessage implements Marshaler for Network Table Messages.
func (*ClientHello) UnmarshalMessage ¶
func (ch *ClientHello) UnmarshalMessage(reader io.Reader) error
UnmarshalMessage implements Unmarshaler for Network Table Messages and assumes the message type byte has already been read.
type ClientHelloComplete ¶
type ClientHelloComplete struct {
// contains filtered or unexported fields
}
ClientHelloComplete is sent to the server after the client finished giving the server all of its entries that does not already exist on the server.
func NewClientHelloComplete ¶
func NewClientHelloComplete() *ClientHelloComplete
NewClientHelloComplete creates a new instance of ClientHelloComplete
func (*ClientHelloComplete) MarshalMessage ¶
func (chc *ClientHelloComplete) MarshalMessage(writer io.Writer) error
MarshalMessage implements Marshaler for Network Table Messages.
func (*ClientHelloComplete) UnmarshalMessage ¶
func (chc *ClientHelloComplete) UnmarshalMessage(reader io.Reader) error
UnmarshalMessage implements Unmarshaler for Network Table Messages and assumes the message type byte has already been read.
type EntryAssign ¶
type EntryAssign struct {
// contains filtered or unexported fields
}
EntryAssign is used to inform others that a new entry was introduced into the network.
func NewEntryAssign ¶
func NewEntryAssign(entryName string, entrier entryType.Entrier, persistant bool, id, sn [2]byte) *EntryAssign
NewEntryAssign creates a new instance on EntryAssign.
func (*EntryAssign) MarshalMessage ¶
func (ea *EntryAssign) MarshalMessage(writer io.Writer) error
MarshalMessage implements Marshaler for Network Table Messages.
func (*EntryAssign) UnmarshalMessage ¶
func (ea *EntryAssign) UnmarshalMessage(reader io.Reader) error
UnmarshalMessage implements Unmarshaler for Network Table Messages and assumes the message type byte has already been read.
type EntryDelete ¶
type EntryDelete struct {
// contains filtered or unexported fields
}
EntryDelete is used to delete an entry from the network.
func NewEntryDelete ¶
func NewEntryDelete(id [2]byte) *EntryDelete
NewEntryDelete creates a new instance of EntryDelete.
func (*EntryDelete) MarshalMessage ¶
func (ed *EntryDelete) MarshalMessage(writer io.Writer) error
MarshalMessage implements Marshaler for Network Table Messages.
func (*EntryDelete) UnmarshalMessage ¶
func (ed *EntryDelete) UnmarshalMessage(reader io.Reader) error
UnmarshalMessage implements Unmarshaler for Network Table Messages and assumes the message type byte has already been read.
type EntryFlagUpdate ¶
type EntryFlagUpdate struct {
// contains filtered or unexported fields
}
EntryFlagUpdate is used to update the flag of an entry.
func NewEntryFlagUpdate ¶
func NewEntryFlagUpdate(id [2]byte, persistant bool) *EntryFlagUpdate
NewEntryFlagUpdate creates a new instance of EntryFlagUpdate.
func (*EntryFlagUpdate) MarshalMessage ¶
func (efu *EntryFlagUpdate) MarshalMessage(writer io.Writer) error
MarshalMessage implements Marshaler for Network Table Messages.
func (*EntryFlagUpdate) UnmarshalMessage ¶
func (efu *EntryFlagUpdate) UnmarshalMessage(reader io.Reader) error
UnmarshalMessage implements Unmarshaler for Network Table Messages and assumes the message type byte has already been read.
type EntryUpdate ¶
type EntryUpdate struct {
// contains filtered or unexported fields
}
EntryUpdate is used to tell the network that an entry has been updated.
func NewEntryUpdate ¶
func NewEntryUpdate(id, sn [2]byte, entrier entryType.Entrier) *EntryUpdate
NewEntryUpdate creates a new instance on EntryUpdate.
func (*EntryUpdate) MarshalMessage ¶
func (eu *EntryUpdate) MarshalMessage(writer io.Writer) error
MarshalMessage implements Marshaler for Network Table Messages.
func (*EntryUpdate) UnmarshalMessage ¶
func (eu *EntryUpdate) UnmarshalMessage(reader io.Reader) error
UnmarshalMessage implements Unmarshaler for Network Table Messages and assumes the message type byte has already been read.
type KeepAlive ¶
type KeepAlive struct {
// contains filtered or unexported fields
}
KeepAlive is a message sent from clients to server to check on the network status.
func (*KeepAlive) MarshalMessage ¶
MarshalMessage implements Marshaler for Network Table Messages.
type Marshaler ¶
Marshaler is the interface implemented by types that can marshal themselves into valid Network Table Message.
type Messager ¶
type Messager interface {
Type() byte
Marshaler
Unmarshaler
}
Messager is the interface implemented by types that can communicate on the network.
type ProtoUnsupported ¶
type ProtoUnsupported struct {
// contains filtered or unexported fields
}
ProtoUnsupported is sent by the server to the client if the server does not support the specified protocol version.
func NewProtoUnsupported ¶
func NewProtoUnsupported(protocol [2]byte) *ProtoUnsupported
NewProtoUnsupported creates a new instance of ProtoUnsupported.
func (*ProtoUnsupported) MarshalMessage ¶
func (pu *ProtoUnsupported) MarshalMessage(writer io.Writer) error
MarshalMessage implements Marshaler for Network Table Messages.
func (*ProtoUnsupported) UnmarshalMessage ¶
func (pu *ProtoUnsupported) UnmarshalMessage(reader io.Reader) error
UnmarshalMessage implements Unmarshaler for Network Table Messages and assumes the message type byte has already been read.
type ServerHello ¶
type ServerHello struct {
// contains filtered or unexported fields
}
ServerHello is a message sent from the server immediatley after it recieves the ClientHello message.
func NewServerHello ¶
func NewServerHello(firstTime bool, serverName string) *ServerHello
NewServerHello creates a new instance of ServerHello.
func (*ServerHello) MarshalMessage ¶
func (sh *ServerHello) MarshalMessage(writer io.Writer) error
MarshalMessage implements Marshaler for Network Table Messages.
func (*ServerHello) UnmarshalMessage ¶
func (sh *ServerHello) UnmarshalMessage(reader io.Reader) error
UnmarshalMessage implements Unmarshaler for Network Table Messages and assumes the message type byte has already been read.
type ServerHelloComplete ¶
type ServerHelloComplete struct {
// contains filtered or unexported fields
}
ServerHelloComplete is sent from the server after it has finished telling the new client what entries the server has.
func NewServerHelloComplete ¶
func NewServerHelloComplete() *ServerHelloComplete
NewServerHelloComplete creates a new instance of ServerHelloComplete.
func (*ServerHelloComplete) MarshalMessage ¶
func (shc *ServerHelloComplete) MarshalMessage(writer io.Writer) error
MarshalMessage implements Marshaler for Network Table Messages.
func (*ServerHelloComplete) UnmarshalMessage ¶
func (shc *ServerHelloComplete) UnmarshalMessage(reader io.Reader) error
UnmarshalMessage implements Unmarshaler for Network Table Messages and assumes the message type byte has already been read.
type Unmarshaler ¶
Unmarshaler is the interface implemented by types that can unmarshal a Network Table Message of themselves.