Documentation
¶
Index ¶
- Constants
- func IsRegistered(typ string) bool
- func IsRegisteredBytes(typ []byte) bool
- func Marshal(enc *TextEncoder, m Message) ([]byte, error)
- func MarshalTo(enc *TextEncoder, buf *bytes.Buffer, m Message) error
- func NormalizeAddr(addr string) (string, error)
- func ParseAddr(addr string) (*url.URL, error)
- func RegisterMessage(m Message)
- func RegisteredTypes() []string
- func UnescapeBytes(b []byte) []byte
- type ADCGet
- type ADCSnd
- type BadPass
- type BotINFO
- type BotList
- type CTMKind
- type ChatMessage
- type Close
- type ConnectToMe
- type DataType
- type Direction
- type ErrProtocolViolation
- type ErrUnexpectedCommand
- type Error
- type Extensions
- type FailOver
- type Failed
- type ForceMove
- type GetNickList
- type GetPass
- type GetTopic
- type Hello
- type HubINFO
- type HubIsFull
- type HubName
- type HubTopic
- type Key
- type Kick
- type Lock
- type LogedIn
- type MCTo
- type MaxedOut
- type Message
- type MyINFO
- type MyNick
- type MyPass
- type Name
- type Names
- type NoArgs
- type OpList
- type PrivateMessage
- type Quit
- type RawMessage
- type Reader
- func (r *Reader) Decoder() *TextDecoder
- func (r *Reader) OnMessage(fnc func(m Message) (bool, error))
- func (r *Reader) OnRawMessage(fnc func(cmd, args []byte) (bool, error))
- func (r *Reader) ReadMsg() (Message, error)
- func (r *Reader) ReadMsgTo(m Message) error
- func (r *Reader) ReadMsgToAny(arr ...Message) (Message, error)
- func (r *Reader) SetDecoder(dec *TextDecoder)
- func (r *Reader) SetMaxCmdName(n int)
- type RevConnectToMe
- type SR
- type Search
- type SetIcon
- type SetLogo
- type SetTopic
- type String
- type Supports
- type TTH
- type TTHSearchActive
- type TTHSearchPassive
- type TextDecoder
- type TextEncoder
- type UCmdContext
- type UCmdType
- type UserAddress
- type UserCommand
- type UserFlag
- type UserIP
- type UserMode
- type ValidateDenide
- type ValidateNick
- type Version
- type Writer
- func (w *Writer) Encoder() *TextEncoder
- func (w *Writer) OnMessage(fnc func(m Message) (bool, error))
- func (w *Writer) SetEncoder(enc *TextEncoder)
- func (w *Writer) WriteKeepAlive() error
- func (w *Writer) WriteMsg(msg ...Message) error
- func (w *Writer) ZOn() error
- func (w *Writer) ZOnLevel(lvl int) error
- type ZOn
Constants ¶
const ( SchemeNMDC = "dchub" // URL scheme for NMDC protocol SchemeNMDCS = "nmdcs" // URL scheme for NMDC-over-TLS protocol DefaultPort = 411 // default port for client-hub connections )
const ( ExtNoHello = "NoHello" ExtNoGetINFO = "NoGetINFO" ExtUserCommand = "UserCommand" ExtUserIP2 = "UserIP2" ExtTTHSearch = "TTHSearch" ExtZPipe0 = "ZPipe0" ExtTLS = "TLS" ExtADCGet = "ADCGet" ExtBotINFO = "BotINFO" ExtHubINFO = "HubINFO" ExtHubTopic = "HubTopic" ExtBotList = "BotList" ExtIN = "IN" ExtMCTo = "MCTo" ExtNickChange = "NickChange" ExtClientNick = "ClientNick" ExtFeaturedNetworks = "FeaturedNetworks" ExtGetZBlock = "GetZBlock" ExtClientID = "ClientID" ExtXmlBZList = "XmlBZList" ExtMinislots = "Minislots" ExtTTHL = "TTHL" ExtTTHF = "TTHF" ExtTTHS = "TTHS" ExtZLIG = "ZLIG" ExtACTM = "ACTM" ExtBZList = "BZList" ExtSaltPass = "SaltPass" ExtDHT0 = "DHT0" ExtFailOver = "FailOver" ExtOpPlus = "OpPlus" ExtQuickList = "QuickList" ExtBanMsg = "BanMsg" ExtNickRule = "NickRule" ExtSearchRule = "SearchRule" ExtExtJSON2 = "ExtJSON2" )
list of known extensions
const ( TypeSeparator = UCmdType(0) TypeRaw = UCmdType(1) TypeRawNickLimited = UCmdType(2) TypeErase = UCmdType(255) )
const ( ContextHub = UCmdContext(1) ContextUser = UCmdContext(2) ContextSearch = UCmdContext(4) ContextFileList = UCmdContext(8) )
const ( CTMActive = CTMKind(iota) CTMPassiveReq CTMPassiveResp )
const ( DataTypeAny = DataType(1) DataTypeAudio = DataType(2) DataTypeCompressed = DataType(3) DataTypeDocument = DataType(4) DataTypeExecutable = DataType(5) DataTypePicture = DataType(6) DataTypeVideo = DataType(7) DataTypeFolders = DataType(8) DataTypeTTH = DataType(9) DataTypeDiskImage = DataType(10) DataTypeComics = DataType(11) DataTypeBook = DataType(12) DataTypeMagnet = DataType(13) )
const ( UserModeUnknown = UserMode(0) UserModeActive = UserMode('A') UserModePassive = UserMode('P') UserModeSOCKS5 = UserMode('5') )
const ( FlagStatusNormal = UserFlag(0x01) FlagStatusAway = UserFlag(0x02) FlagStatusServer = UserFlag(0x04) FlagStatusFireball = UserFlag(0x08) FlagTLSDownload = UserFlag(0x10) FlagTLSUpload = UserFlag(0x20) FlagIPv4 = UserFlag(0x40) FlagIPv6 = UserFlag(0x80) FlagTLS = FlagTLSUpload | FlagTLSDownload )
const ( ConnSpeedModem = "1" ConnSpeedServer = "1000" )
Used by some clients to set a different icon.
const DefaultKeyMagic = 5
DefaultKeyMagic is a magic byte used in the C-H and C-C handshakes.
const Delimiter = '|'
Delimiter of the NMDC protocol.
const (
ExtLocale = "Locale"
)
proposals
Variables ¶
This section is empty.
Functions ¶
func IsRegistered ¶ added in v0.6.4
IsRegistered check if a message type is registered.
func IsRegisteredBytes ¶ added in v0.10.0
IsRegisteredBytes is like IsRegistered but accepts a byte slice.
func Marshal ¶
func Marshal(enc *TextEncoder, m Message) ([]byte, error)
Marshal encodes NMDC message. The resulting slice will contain a command name, a payload and '|' delimiter.
func MarshalTo ¶
func MarshalTo(enc *TextEncoder, buf *bytes.Buffer, m Message) error
MarshalTo encodes NMDC message into a buffer. It will write a command name, a payload and '|' delimiter.
func NormalizeAddr ¶ added in v0.2.0
NormalizeAddr parses and normalizes the address to scheme://host[:port] format.
func ParseAddr ¶ added in v0.2.0
ParseAddr parses an NMDC address as a URL. It will assume a dchub:// scheme if none is set.
func RegisterMessage ¶
func RegisterMessage(m Message)
RegisterMessage registers a new protocol message type. It will be associated with a name returned by Type method. Messages registered this way will be automatically decoded by the Reader.
func RegisteredTypes ¶ added in v0.6.4
func RegisteredTypes() []string
RegisteredTypes list all registered message types.
func UnescapeBytes ¶ added in v0.3.0
Types ¶
type ADCGet ¶ added in v0.10.0
type ADCGet struct { ContentType String Identifier String Start uint64 Length int64 Compressed bool DownloadedBytes *uint64 }
func (*ADCGet) MarshalNMDC ¶ added in v0.10.0
func (m *ADCGet) MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error
func (*ADCGet) UnmarshalNMDC ¶ added in v0.10.0
func (m *ADCGet) UnmarshalNMDC(dec *TextDecoder, data []byte) error
type ADCSnd ¶ added in v0.10.0
type ADCSnd struct { ContentType String Identifier String Start uint64 Length uint64 Compressed bool }
func (*ADCSnd) MarshalNMDC ¶ added in v0.10.0
func (m *ADCSnd) MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error
func (*ADCSnd) UnmarshalNMDC ¶ added in v0.10.0
func (m *ADCSnd) UnmarshalNMDC(dec *TextDecoder, data []byte) error
type BotINFO ¶
type BotINFO struct {
String
}
BotINFO is sent by the pinger to the hub to get a HubINFO.
type BotList ¶
type BotList struct {
Names
}
BotList is a list of bots on the hub. Requires 'BotList' extension.
type ChatMessage ¶
func (*ChatMessage) MarshalNMDC ¶
func (m *ChatMessage) MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error
func (*ChatMessage) String ¶
func (m *ChatMessage) String() string
func (*ChatMessage) Type ¶
func (m *ChatMessage) Type() string
func (*ChatMessage) UnmarshalNMDC ¶
func (m *ChatMessage) UnmarshalNMDC(dec *TextDecoder, data []byte) error
type ConnectToMe ¶
func (*ConnectToMe) MarshalNMDC ¶
func (m *ConnectToMe) MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error
func (*ConnectToMe) Type ¶
func (m *ConnectToMe) Type() string
func (*ConnectToMe) UnmarshalNMDC ¶
func (m *ConnectToMe) UnmarshalNMDC(dec *TextDecoder, data []byte) error
type Direction ¶ added in v0.10.0
func (*Direction) MarshalNMDC ¶ added in v0.10.0
func (m *Direction) MarshalNMDC(_ *TextEncoder, buf *bytes.Buffer) error
func (*Direction) UnmarshalNMDC ¶ added in v0.10.0
func (m *Direction) UnmarshalNMDC(_ *TextDecoder, data []byte) error
type ErrProtocolViolation ¶
type ErrProtocolViolation = lineproto.ErrProtocolViolation
type ErrUnexpectedCommand ¶
type ErrUnexpectedCommand struct { Expected string Received *RawMessage }
func (*ErrUnexpectedCommand) Error ¶
func (e *ErrUnexpectedCommand) Error() string
type Error ¶
type Error struct {
Err error
}
func (*Error) MarshalNMDC ¶
func (m *Error) MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error
func (*Error) UnmarshalNMDC ¶
func (m *Error) UnmarshalNMDC(dec *TextDecoder, text []byte) error
type Extensions ¶
type Extensions map[string]struct{}
Extensions is an unordered set of protocol extensions.
func (Extensions) Clone ¶
func (f Extensions) Clone() Extensions
func (Extensions) Has ¶
func (f Extensions) Has(name string) bool
func (Extensions) Intersect ¶
func (f Extensions) Intersect(f2 Extensions) Extensions
func (Extensions) IntersectList ¶
func (f Extensions) IntersectList(f2 []string) Extensions
func (Extensions) List ¶
func (f Extensions) List() []string
func (Extensions) Set ¶
func (f Extensions) Set(name string)
type FailOver ¶
type FailOver struct {
Host []string
}
func (*FailOver) MarshalNMDC ¶
func (m *FailOver) MarshalNMDC(_ *TextEncoder, buf *bytes.Buffer) error
func (*FailOver) UnmarshalNMDC ¶
func (m *FailOver) UnmarshalNMDC(_ *TextDecoder, data []byte) error
type Failed ¶
type Failed struct {
Err error
}
func (*Failed) MarshalNMDC ¶
func (m *Failed) MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error
func (*Failed) UnmarshalNMDC ¶
func (m *Failed) UnmarshalNMDC(dec *TextDecoder, text []byte) error
type ForceMove ¶ added in v0.7.4
type ForceMove struct {
Address string
}
func (*ForceMove) MarshalNMDC ¶ added in v0.7.4
func (m *ForceMove) MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error
func (*ForceMove) UnmarshalNMDC ¶ added in v0.7.4
func (m *ForceMove) UnmarshalNMDC(dec *TextDecoder, data []byte) error
type GetNickList ¶
type GetNickList struct {
NoArgs
}
GetNickList is sent by the client to the hub to retrieve a list of online users.
http://nmdc.sourceforge.net/NMDC.html#_getnicklist
func (*GetNickList) Type ¶
func (*GetNickList) Type() string
type HubINFO ¶
type HubINFO struct { Name string Host string Desc string I1 int // TODO I2 int // TODO I3 int // TODO I4 int // TODO Soft types.Software Owner string State string // TODO Encoding string }
HubINFO is a detailed hub information exposed only after receiving BotINFO.
func (*HubINFO) MarshalNMDC ¶
func (m *HubINFO) MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error
func (*HubINFO) UnmarshalNMDC ¶
func (m *HubINFO) UnmarshalNMDC(dec *TextDecoder, data []byte) error
type HubTopic ¶
type HubTopic struct {
Text string
}
func (*HubTopic) MarshalNMDC ¶
func (m *HubTopic) MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error
func (*HubTopic) UnmarshalNMDC ¶
func (m *HubTopic) UnmarshalNMDC(dec *TextDecoder, data []byte) error
type Key ¶
type Key struct {
Key string
}
Key is a response to a pseudo-cryptographic challenge represented by Lock.
http://nmdc.sourceforge.net/NMDC.html#_key
func (*Key) MarshalNMDC ¶
func (m *Key) MarshalNMDC(_ *TextEncoder, buf *bytes.Buffer) error
func (*Key) UnmarshalNMDC ¶
func (m *Key) UnmarshalNMDC(_ *TextDecoder, data []byte) error
type Lock ¶
Lock is a pseudo-cryptographic challenge sent by the server to the client.
http://nmdc.sourceforge.net/NMDC.html#_lock
func (*Lock) CustomKey ¶
CustomKey calculates a response to the challenge and allows to specify additional parameters.
func (*Lock) LockString ¶
func (*Lock) MarshalNMDC ¶
func (m *Lock) MarshalNMDC(_ *TextEncoder, buf *bytes.Buffer) error
func (*Lock) UnmarshalNMDC ¶
func (m *Lock) UnmarshalNMDC(_ *TextDecoder, data []byte) error
type MCTo ¶
func (*MCTo) MarshalNMDC ¶
func (m *MCTo) MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error
func (*MCTo) UnmarshalNMDC ¶
func (m *MCTo) UnmarshalNMDC(dec *TextDecoder, data []byte) error
type Message ¶
type Message interface { // Type returns a NMDC command type name without '$' prefix. // Chat messages are a special case and returns empty type name. Type() string // MarshalNMDC encodes NMDC protocol message using provided text encoding into a buffer. // Message should only encode it's payload without a command name or '|' delimiter. // If encoder is nil, UTF-8 encoding is assumed. MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error // UnmarshalNMDC decodes NMDC protocol message using provided text encoding. // Buffer will only contain message payload without a command name or '|' delimiter. // If decoder is nil, UTF-8 encoding is assumed. UnmarshalNMDC(dec *TextDecoder, data []byte) error }
Message is an interface for all NMDC protocol messages.
func NewMessage ¶
NewMessage creates a new message by type name. If a command type is unknown, RawMessage will be returned.
See RegisterMessage for more details.
type MyINFO ¶
type MyINFO struct { Name string Desc string Client types.Software Mode UserMode HubsNormal int HubsRegistered int HubsOperator int Slots int Extra map[string]string Conn string Flag UserFlag Email string }
func (*MyINFO) MarshalNMDC ¶
func (m *MyINFO) MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error
func (*MyINFO) UnmarshalNMDC ¶
func (m *MyINFO) UnmarshalNMDC(dec *TextDecoder, data []byte) error
type MyNick ¶
type MyNick struct {
Name
}
MyNick is sent in C-C connections for clients to be able to identify each other.
type Name ¶
type Name string
Name is a string encoded and decoded as a NMDC user name. It has more restrictions than a String type.
func (Name) MarshalNMDC ¶
func (s Name) MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error
func (*Name) UnmarshalNMDC ¶
func (s *Name) UnmarshalNMDC(dec *TextDecoder, data []byte) error
type Names ¶
type Names []string
Names is a list of user names separated by '$$'.
See OpList and BotList.
func (Names) MarshalNMDC ¶
func (m Names) MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error
func (*Names) UnmarshalNMDC ¶
func (m *Names) UnmarshalNMDC(dec *TextDecoder, data []byte) error
type NoArgs ¶
type NoArgs struct{}
NoArgs is an embeddable type for protocol commands with no arguments.
func (*NoArgs) MarshalNMDC ¶
func (*NoArgs) MarshalNMDC(_ *TextEncoder, _ *bytes.Buffer) error
func (*NoArgs) UnmarshalNMDC ¶
func (*NoArgs) UnmarshalNMDC(_ *TextDecoder, data []byte) error
type PrivateMessage ¶
func (*PrivateMessage) MarshalNMDC ¶
func (m *PrivateMessage) MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error
func (*PrivateMessage) Type ¶
func (m *PrivateMessage) Type() string
func (*PrivateMessage) UnmarshalNMDC ¶
func (m *PrivateMessage) UnmarshalNMDC(dec *TextDecoder, data []byte) error
type RawMessage ¶
RawMessage is a raw NMDC message in the connection encoding.
func (*RawMessage) MarshalNMDC ¶
func (m *RawMessage) MarshalNMDC(_ *TextEncoder, buf *bytes.Buffer) error
Type implements Message.
func (*RawMessage) UnmarshalNMDC ¶
func (m *RawMessage) UnmarshalNMDC(_ *TextDecoder, data []byte) error
Type implements Message.
type Reader ¶
type Reader struct { *lineproto.Reader // OnKeepAlive is called when an empty (keep-alive) message is received. OnKeepAlive func() error // OnUnknownEncoding is called when a text with non-UTF8 encoding is received. // It may either return a new decoder or return an error to fail the decoding. OnUnknownEncoding func(text []byte) (*TextDecoder, error) // OnUnmarshalError is called when a message cannot be parsed. // It may either return false, nil to skip the message or true, err to return an error. OnUnmarshalError func(text []byte, err error) (bool, error) // contains filtered or unexported fields }
Reader is not safe for concurrent use.
func (*Reader) Decoder ¶ added in v0.6.3
func (r *Reader) Decoder() *TextDecoder
Decoder returns current text decoder.
func (*Reader) OnMessage ¶
OnMessage registers a hook that is called each time a protocol message is decoded. The function may return (false, nil) to ignore the message.
This method is not concurrent-safe.
func (*Reader) OnRawMessage ¶
OnRawCommand registers a hook that is called each time a message is received. Protocol commands will have a non-nil name, while chat messages will have a nil name. The function may return (false, nil) to ignore the message.
This method is not concurrent-safe.
func (*Reader) ReadMsgTo ¶
ReadMsgTo will read a message to a pointer passed to the function. If the message read has a different type, an error will be returned.
func (*Reader) ReadMsgToAny ¶ added in v0.5.4
ReadMsgToAny will read a message to one of the pointers passed to the function. If the message read doesn't match any of the types, an error will be returned. The method returns a message that was decoded.
func (*Reader) SetDecoder ¶
func (r *Reader) SetDecoder(dec *TextDecoder)
SetDecoder sets a text decoder for the connection.
func (*Reader) SetMaxCmdName ¶
SetMaxCmdName sets a maximal length of the protocol command name in bytes.
type RevConnectToMe ¶
type RevConnectToMe struct {
From, To string
}
func (*RevConnectToMe) MarshalNMDC ¶
func (m *RevConnectToMe) MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error
func (*RevConnectToMe) Type ¶
func (m *RevConnectToMe) Type() string
func (*RevConnectToMe) UnmarshalNMDC ¶
func (m *RevConnectToMe) UnmarshalNMDC(dec *TextDecoder, data []byte) error
type SR ¶
type SR struct { From string Path []string IsDir bool Size uint64 // only set for files FreeSlots int TotalSlots int HubName string TTH *TTH HubAddress string To string }
func (*SR) MarshalNMDC ¶
func (m *SR) MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error
func (*SR) UnmarshalNMDC ¶
func (m *SR) UnmarshalNMDC(dec *TextDecoder, data []byte) error
type Search ¶
type Search struct { Address string User string SizeRestricted bool IsMaxSize bool Size uint64 DataType DataType Pattern string TTH *TTH }
func (*Search) MarshalNMDC ¶
func (m *Search) MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error
func (*Search) UnmarshalNMDC ¶
func (m *Search) UnmarshalNMDC(dec *TextDecoder, data []byte) error
type String ¶
type String string
String is a value type encoded and decoded as a NMDC string value.
func (String) MarshalNMDC ¶
func (s String) MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error
func (*String) UnmarshalNMDC ¶
func (s *String) UnmarshalNMDC(dec *TextDecoder, data []byte) error
type Supports ¶
type Supports struct {
Ext []string
}
Supports command lists extensions supported by the peer.
http://nmdc.sourceforge.net/NMDC.html#_supports
func (*Supports) MarshalNMDC ¶
func (m *Supports) MarshalNMDC(_ *TextEncoder, buf *bytes.Buffer) error
func (*Supports) UnmarshalNMDC ¶
func (m *Supports) UnmarshalNMDC(_ *TextDecoder, data []byte) error
type TTHSearchActive ¶ added in v0.5.2
TTHSearchActive is added by TTHS extension.
func (*TTHSearchActive) MarshalNMDC ¶ added in v0.5.2
func (m *TTHSearchActive) MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error
func (*TTHSearchActive) Type ¶ added in v0.5.2
func (*TTHSearchActive) Type() string
func (*TTHSearchActive) UnmarshalNMDC ¶ added in v0.5.2
func (m *TTHSearchActive) UnmarshalNMDC(_ *TextDecoder, data []byte) error
type TTHSearchPassive ¶ added in v0.5.2
TTHSearchPassive is added by TTHS extension.
func (*TTHSearchPassive) MarshalNMDC ¶ added in v0.5.2
func (m *TTHSearchPassive) MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error
func (*TTHSearchPassive) Type ¶ added in v0.5.2
func (*TTHSearchPassive) Type() string
func (*TTHSearchPassive) UnmarshalNMDC ¶ added in v0.5.2
func (m *TTHSearchPassive) UnmarshalNMDC(dec *TextDecoder, data []byte) error
type TextDecoder ¶
these two aliases allows package users to omit x/text import
type TextEncoder ¶
these two aliases allows package users to omit x/text import
type UCmdContext ¶
type UCmdContext int
type UserAddress ¶ added in v0.8.0
type UserCommand ¶
type UserCommand struct { Typ UCmdType Context UCmdContext Path []string Command string }
func (*UserCommand) MarshalNMDC ¶
func (m *UserCommand) MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error
func (*UserCommand) Type ¶
func (*UserCommand) Type() string
func (*UserCommand) UnmarshalNMDC ¶
func (m *UserCommand) UnmarshalNMDC(dec *TextDecoder, data []byte) error
type UserIP ¶
type UserIP struct {
List []UserAddress
}
func (*UserIP) MarshalNMDC ¶
func (m *UserIP) MarshalNMDC(enc *TextEncoder, buf *bytes.Buffer) error
func (*UserIP) UnmarshalNMDC ¶
func (m *UserIP) UnmarshalNMDC(dec *TextDecoder, data []byte) error
type ValidateDenide ¶
type ValidateDenide struct {
Name
}
func (*ValidateDenide) Type ¶
func (*ValidateDenide) Type() string
type ValidateNick ¶
type ValidateNick struct {
Name
}
ValidateNick is sent from the client to the hub as a request to enter with a specific user name.
The hub will send Hello in case of success or ValidateDenide in case of an error.
func (*ValidateNick) Type ¶
func (*ValidateNick) Type() string
type Version ¶
type Version struct {
Vers string
}
func (*Version) MarshalNMDC ¶
func (m *Version) MarshalNMDC(_ *TextEncoder, buf *bytes.Buffer) error
func (*Version) UnmarshalNMDC ¶
func (m *Version) UnmarshalNMDC(_ *TextDecoder, data []byte) error
type Writer ¶ added in v0.2.0
Writer is protocol message writer for NMDC protocol. It's not safe for a concurrent use.
func NewWriter ¶ added in v0.2.0
NewWriter creates a new NMDC protocol writer with a default buffer size.
func NewWriterSize ¶ added in v0.7.3
NewWriterSize creates a new NMDC protocol writer with a specified buffer size.
func (*Writer) Encoder ¶ added in v0.2.0
func (w *Writer) Encoder() *TextEncoder
Encoder returns current text encoder.
func (*Writer) OnMessage ¶ added in v0.2.1
OnMessage registers a hook that is called each time a NMDC protocol message is written. The function may return (false, nil) to skip writing the message.
This method is not concurrent-safe.
func (*Writer) SetEncoder ¶ added in v0.2.0
func (w *Writer) SetEncoder(enc *TextEncoder)
SetEncoder sets a text encoding used to write messages.
func (*Writer) WriteKeepAlive ¶ added in v0.10.0
WriteKeepAlive writes an empty (keep alive) message. It is caller's responsibility to flush the writer.