Documentation ¶
Index ¶
- Constants
- Variables
- func Marshal(buf *bytes.Buffer, o Message) error
- func MustMarshal(o Message) []byte
- func NormalizeAddr(addr string) (string, error)
- func ParseAddr(addr string) (*url.URL, error)
- func RegisterMessage(m Message)
- func Unmarshal(s []byte, o interface{}) error
- type AddFeatures
- type AwayType
- type BoolInt
- type BroadcastPacket
- func (p *BroadcastPacket) DecodeMessage() error
- func (p *BroadcastPacket) DecodeMessageTo(m Message) error
- func (*BroadcastPacket) Kind() byte
- func (p *BroadcastPacket) MarshalPacketADC(buf *bytes.Buffer) error
- func (p *BroadcastPacket) Message() Message
- func (p *BroadcastPacket) SetMessage(m Message)
- func (p *BroadcastPacket) Source() SID
- func (p *BroadcastPacket) UnmarshalPacketADC(name MsgType, data []byte) error
- type CID
- type Category
- type ChatMessage
- type ClientPacket
- func (p *ClientPacket) DecodeMessage() error
- func (p *ClientPacket) DecodeMessageTo(m Message) error
- func (*ClientPacket) Kind() byte
- func (p *ClientPacket) MarshalPacketADC(buf *bytes.Buffer) error
- func (p *ClientPacket) Message() Message
- func (p *ClientPacket) SetMessage(m Message)
- func (p *ClientPacket) UnmarshalPacketADC(name MsgType, data []byte) error
- type ConnectRequest
- type DirectPacket
- func (p *DirectPacket) DecodeMessage() error
- func (p *DirectPacket) DecodeMessageTo(m Message) error
- func (*DirectPacket) Kind() byte
- func (p *DirectPacket) MarshalPacketADC(buf *bytes.Buffer) error
- func (p *DirectPacket) Message() Message
- func (p *DirectPacket) SetMessage(m Message)
- func (p *DirectPacket) Source() SID
- func (p *DirectPacket) Target() SID
- func (p *DirectPacket) UnmarshalPacketADC(name MsgType, data []byte) error
- type Disconnect
- type EchoPacket
- func (p *EchoPacket) DecodeMessage() error
- func (p *EchoPacket) DecodeMessageTo(m Message) error
- func (*EchoPacket) Kind() byte
- func (p *EchoPacket) MarshalPacketADC(buf *bytes.Buffer) error
- func (p *EchoPacket) Message() Message
- func (p *EchoPacket) SetMessage(m Message)
- func (p *EchoPacket) Source() SID
- func (p *EchoPacket) Target() SID
- func (p *EchoPacket) UnmarshalPacketADC(name MsgType, data []byte) error
- type Error
- type ExtFeatures
- type ExtGroup
- type Feature
- type FeaturePacket
- func (p *FeaturePacket) DecodeMessage() error
- func (p *FeaturePacket) DecodeMessageTo(m Message) error
- func (*FeaturePacket) Kind() byte
- func (p *FeaturePacket) MarshalPacketADC(buf *bytes.Buffer) error
- func (p *FeaturePacket) Message() Message
- func (p *FeaturePacket) SetMessage(m Message)
- func (p *FeaturePacket) Source() SID
- func (p *FeaturePacket) UnmarshalPacketADC(name MsgType, data []byte) error
- type FeatureSel
- type Field
- type Fields
- type FileType
- type GetInfoRequest
- type GetPassword
- type GetRequest
- type GetResponse
- type HubInfo
- type HubPacket
- func (p *HubPacket) DecodeMessage() error
- func (p *HubPacket) DecodeMessageTo(m Message) error
- func (*HubPacket) Kind() byte
- func (p *HubPacket) MarshalPacketADC(buf *bytes.Buffer) error
- func (p *HubPacket) Message() Message
- func (p *HubPacket) SetMessage(m Message)
- func (p *HubPacket) UnmarshalPacketADC(name MsgType, data []byte) error
- type InfoPacket
- func (p *InfoPacket) DecodeMessage() error
- func (p *InfoPacket) DecodeMessageTo(m Message) error
- func (*InfoPacket) Kind() byte
- func (p *InfoPacket) MarshalPacketADC(buf *bytes.Buffer) error
- func (p *InfoPacket) Message() Message
- func (p *InfoPacket) SetMessage(m Message)
- func (p *InfoPacket) UnmarshalPacketADC(name MsgType, data []byte) error
- type Marshaler
- type Message
- type ModFeatures
- func (f ModFeatures) Clone() ModFeatures
- func (f ModFeatures) Intersect(fp ModFeatures) ModFeatures
- func (f ModFeatures) IsSet(s Feature) bool
- func (f ModFeatures) Join() string
- func (f ModFeatures) MarshalADC(buf *bytes.Buffer) error
- func (f ModFeatures) SetFrom(fp ModFeatures) ModFeatures
- func (f *ModFeatures) UnmarshalADC(s []byte) error
- type MsgType
- type NoArgs
- type PID
- type Packet
- type Password
- type Path
- type PeerPacket
- type RawMessage
- type Reader
- type RevConnectRequest
- type SID
- type SIDAssign
- type SearchRequest
- type SearchResult
- type Severity
- type Status
- type String
- type Supported
- type TTH
- type TargetPacket
- type UDPPacket
- func (p *UDPPacket) DecodeMessage() error
- func (p *UDPPacket) DecodeMessageTo(m Message) error
- func (*UDPPacket) Kind() byte
- func (p *UDPPacket) MarshalPacketADC(buf *bytes.Buffer) error
- func (p *UDPPacket) Message() Message
- func (p *UDPPacket) SetMessage(m Message)
- func (p *UDPPacket) UnmarshalPacketADC(name MsgType, data []byte) error
- type Unmarshaler
- type UserCommand
- type UserInfo
- type UserInfoMod
- type UserType
- type WriteStream
- type Writer
- func (w *Writer) BroadcastStream(from SID) WriteStream
- func (w *Writer) ClientStream() WriteStream
- func (w *Writer) DirectStream(from, to SID) WriteStream
- func (w *Writer) EchoStream(from, to SID) WriteStream
- func (w *Writer) FeatureStream(from SID, sel []FeatureSel) WriteStream
- func (w *Writer) Flush() error
- func (w *Writer) HubStream() WriteStream
- func (w *Writer) InfoStream() WriteStream
- func (w *Writer) WriteBroadcast(id SID, msg Message) error
- func (w *Writer) WriteClient(msg Message) error
- func (w *Writer) WriteDirect(from, to SID, msg Message) error
- func (w *Writer) WriteEcho(from, to SID, msg Message) error
- func (w *Writer) WriteFeature(from SID, sel []FeatureSel, msg Message) error
- func (w *Writer) WriteHub(msg Message) error
- func (w *Writer) WriteInfo(msg Message) error
- func (w *Writer) WriteKeepAlive() error
- func (w *Writer) WritePacket(p Packet) error
- type ZOff
- type ZOn
Constants ¶
const ( ProtoADC = `ADC/1.0` // ADC protocol name in CTM requests ProtoADCS = `ADCS/0.10` // ADCS protocol name in CTM requests SchemaADC = "adc" // URL scheme for ADC protocol SchemaADCS = "adcs" // URL scheme for ADC-over-TLS protocol )
const ( CategoryHub = Category(1) CategoryUser = Category(2) CategorySearch = Category(4) CategoryFileList = Category(8) )
const ( Success = Severity(0) Recoverable = Severity(1) Fatal = Severity(2) )
const (
FileListBZIP = "files.xml.bz2"
)
Variables ¶
var ( // FeaBASE indicates base ADC protocol support. // // See: https://adc.dcbase.org/Protocol, http://adc.sourceforge.net/ADC.html FeaBASE = Feature{'B', 'A', 'S', 'E'} FeaBAS0 = Feature{'B', 'A', 'S', '0'} // TODO: clarify FeaTIGR = Feature{'T', 'I', 'G', 'R'} // Tiger hash support FeaPING = Feature{'P', 'I', 'N', 'G'} // Send additional field in hub's info message FeaONID = Feature{'O', 'N', 'I', 'D'} // Online services identification FeaBZIP = Feature{'B', 'Z', 'I', 'P'} // bzip2 compression of filelist, adds virtual files.xml.bz2 file FeaTS = Feature{'T', 'S', '0', '0'} // Unix timestamps in messages FeaZLIF = Feature{'Z', 'L', 'I', 'F'} // Compressed communication (Full), adds ZON FeaZLIG = Feature{'Z', 'L', 'I', 'G'} // Compressed communication (Get) FeaSEGA = Feature{'S', 'E', 'G', 'A'} // Grouping of file extensions in search FeaUCMD = Feature{'U', 'C', 'M', 'D'} // User commands FeaUCM0 = Feature{'U', 'C', 'M', '0'} // User commands FeaADCS = Feature{'A', 'D', 'C', 'S'} // ADC over TLS for C-H FeaADC0 = Feature{'A', 'D', 'C', '0'} // ADC over TLS for C-C FeaNAT0 = Feature{'N', 'A', 'T', '0'} // NAT traversal for C-C FeaASCH = Feature{'A', 'S', 'C', 'H'} FeaSUD1 = Feature{'S', 'U', 'D', '1'} FeaSUDP = Feature{'S', 'U', 'D', 'P'} FeaCCPM = Feature{'C', 'C', 'P', 'M'} FeaBLO0 = Feature{'B', 'L', 'O', '0'} // unknown from adch++ FeaSIPR = Feature{'S', 'I', 'P', 'R'} // FeaTCP4 should be set in user's INF to indicate that the client has an open TCP4 port (is active). FeaTCP4 = Feature{'T', 'C', 'P', '4'} // FeaTCP6 should be set in user's INF to indicate that the client has an open TCP6 port (is active). FeaTCP6 = Feature{'T', 'C', 'P', '6'} FeaUDP4 = Feature{'U', 'D', 'P', '4'} FeaUDP6 = Feature{'U', 'D', 'P', '6'} )
Functions ¶
func MustMarshal ¶
MustMarshal encodes an ADC message payload into a byte slice and panics on error.
func NormalizeAddr ¶
NormalizeAddr parses and normalizes the address to scheme://host:port format.
func RegisterMessage ¶
func RegisterMessage(m Message)
Types ¶
type AddFeatures ¶
type AddFeatures []string
func (AddFeatures) MarshalADC ¶
func (f AddFeatures) MarshalADC(buf *bytes.Buffer) error
type BroadcastPacket ¶
func (*BroadcastPacket) DecodeMessage ¶
func (p *BroadcastPacket) DecodeMessage() error
func (*BroadcastPacket) DecodeMessageTo ¶
func (p *BroadcastPacket) DecodeMessageTo(m Message) error
func (*BroadcastPacket) Kind ¶
func (*BroadcastPacket) Kind() byte
func (*BroadcastPacket) MarshalPacketADC ¶
func (p *BroadcastPacket) MarshalPacketADC(buf *bytes.Buffer) error
func (*BroadcastPacket) Message ¶
func (p *BroadcastPacket) Message() Message
func (*BroadcastPacket) SetMessage ¶
func (p *BroadcastPacket) SetMessage(m Message)
func (*BroadcastPacket) Source ¶
func (p *BroadcastPacket) Source() SID
func (*BroadcastPacket) UnmarshalPacketADC ¶
func (p *BroadcastPacket) UnmarshalPacketADC(name MsgType, data []byte) error
type ChatMessage ¶
type ChatMessage struct { Text string `adc:"#"` PM *SID `adc:"PM"` Me bool `adc:"ME"` TS int64 `adc:"TS"` }
func (ChatMessage) Cmd ¶
func (ChatMessage) Cmd() MsgType
type ClientPacket ¶
type ClientPacket struct {
Msg Message
}
func (*ClientPacket) DecodeMessage ¶
func (p *ClientPacket) DecodeMessage() error
func (*ClientPacket) DecodeMessageTo ¶
func (p *ClientPacket) DecodeMessageTo(m Message) error
func (*ClientPacket) Kind ¶
func (*ClientPacket) Kind() byte
func (*ClientPacket) MarshalPacketADC ¶
func (p *ClientPacket) MarshalPacketADC(buf *bytes.Buffer) error
func (*ClientPacket) Message ¶
func (p *ClientPacket) Message() Message
func (*ClientPacket) SetMessage ¶
func (p *ClientPacket) SetMessage(m Message)
func (*ClientPacket) UnmarshalPacketADC ¶
func (p *ClientPacket) UnmarshalPacketADC(name MsgType, data []byte) error
type ConnectRequest ¶
func (ConnectRequest) Cmd ¶
func (ConnectRequest) Cmd() MsgType
type DirectPacket ¶
func (*DirectPacket) DecodeMessage ¶
func (p *DirectPacket) DecodeMessage() error
func (*DirectPacket) DecodeMessageTo ¶
func (p *DirectPacket) DecodeMessageTo(m Message) error
func (*DirectPacket) Kind ¶
func (*DirectPacket) Kind() byte
func (*DirectPacket) MarshalPacketADC ¶
func (p *DirectPacket) MarshalPacketADC(buf *bytes.Buffer) error
func (*DirectPacket) Message ¶
func (p *DirectPacket) Message() Message
func (*DirectPacket) SetMessage ¶
func (p *DirectPacket) SetMessage(m Message)
func (*DirectPacket) Source ¶
func (p *DirectPacket) Source() SID
func (*DirectPacket) Target ¶
func (p *DirectPacket) Target() SID
func (*DirectPacket) UnmarshalPacketADC ¶
func (p *DirectPacket) UnmarshalPacketADC(name MsgType, data []byte) error
type Disconnect ¶
type Disconnect struct { ID SID `adc:"#"` Message string `adc:"MS"` By SID `adc:"ID"` Duration int `adc:"TL"` Redirect string `adc:"RD"` }
func (Disconnect) Cmd ¶
func (Disconnect) Cmd() MsgType
type EchoPacket ¶
type EchoPacket DirectPacket
func (*EchoPacket) DecodeMessage ¶
func (p *EchoPacket) DecodeMessage() error
func (*EchoPacket) DecodeMessageTo ¶
func (p *EchoPacket) DecodeMessageTo(m Message) error
func (*EchoPacket) Kind ¶
func (*EchoPacket) Kind() byte
func (*EchoPacket) MarshalPacketADC ¶
func (p *EchoPacket) MarshalPacketADC(buf *bytes.Buffer) error
func (*EchoPacket) Message ¶
func (p *EchoPacket) Message() Message
func (*EchoPacket) SetMessage ¶
func (p *EchoPacket) SetMessage(m Message)
func (*EchoPacket) Source ¶
func (p *EchoPacket) Source() SID
func (*EchoPacket) Target ¶
func (p *EchoPacket) Target() SID
func (*EchoPacket) UnmarshalPacketADC ¶
func (p *EchoPacket) UnmarshalPacketADC(name MsgType, data []byte) error
type ExtFeatures ¶
type ExtFeatures []Feature
func (ExtFeatures) Has ¶
func (f ExtFeatures) Has(s Feature) bool
func (ExtFeatures) MarshalADC ¶
func (f ExtFeatures) MarshalADC(buf *bytes.Buffer) error
func (*ExtFeatures) UnmarshalADC ¶
func (f *ExtFeatures) UnmarshalADC(s []byte) error
type FeaturePacket ¶
type FeaturePacket struct { ID SID Sel []FeatureSel Msg Message }
func (*FeaturePacket) DecodeMessage ¶
func (p *FeaturePacket) DecodeMessage() error
func (*FeaturePacket) DecodeMessageTo ¶
func (p *FeaturePacket) DecodeMessageTo(m Message) error
func (*FeaturePacket) Kind ¶
func (*FeaturePacket) Kind() byte
func (*FeaturePacket) MarshalPacketADC ¶
func (p *FeaturePacket) MarshalPacketADC(buf *bytes.Buffer) error
func (*FeaturePacket) Message ¶
func (p *FeaturePacket) Message() Message
func (*FeaturePacket) SetMessage ¶
func (p *FeaturePacket) SetMessage(m Message)
func (*FeaturePacket) Source ¶
func (p *FeaturePacket) Source() SID
func (*FeaturePacket) UnmarshalPacketADC ¶
func (p *FeaturePacket) UnmarshalPacketADC(name MsgType, data []byte) error
type FeatureSel ¶
type GetInfoRequest ¶
func (GetInfoRequest) Cmd ¶
func (GetInfoRequest) Cmd() MsgType
type GetPassword ¶
type GetPassword struct {
Salt []byte
}
func (GetPassword) Cmd ¶
func (GetPassword) Cmd() MsgType
func (GetPassword) MarshalADC ¶
func (m GetPassword) MarshalADC(buf *bytes.Buffer) error
func (*GetPassword) UnmarshalADC ¶
func (m *GetPassword) UnmarshalADC(data []byte) error
type GetRequest ¶
func (GetRequest) Cmd ¶
func (GetRequest) Cmd() MsgType
func (GetRequest) MarshalADC ¶ added in v0.10.0
func (m GetRequest) MarshalADC(buf *bytes.Buffer) error
func (*GetRequest) UnmarshalADC ¶ added in v0.10.0
func (m *GetRequest) UnmarshalADC(data []byte) error
type GetResponse ¶
type GetResponse GetRequest
func (GetResponse) Cmd ¶
func (GetResponse) Cmd() MsgType
func (GetResponse) MarshalADC ¶ added in v0.10.0
func (m GetResponse) MarshalADC(buf *bytes.Buffer) error
func (*GetResponse) UnmarshalADC ¶ added in v0.10.0
func (m *GetResponse) UnmarshalADC(data []byte) error
type HubInfo ¶
type HubInfo struct { Name string `adc:"NI,req"` Version string `adc:"VE,req"` Application string `adc:"AP"` Desc string `adc:"DE"` Type UserType `adc:"CT"` Address string `adc:"HH"` // Hub Host address (ADC/ADCS URL address form) Website string `adc:"WS"` // Hub Website Network string `adc:"NE"` // Hub Network Owner string `adc:"OW"` // Hub Owner name Users int `adc:"UC"` // Current user count, required Files int `adc:"SF"` // Total files shared MinSlots int `adc:"ML"` // Minimum slots required to enter hub MaxSlots int `adc:"XL"` // Maximum slots for entering hub UsersLimit int `adc:"MC"` // Maximum possible clients ( users ) who can connect Uptime int `adc:"UP"` // Hub uptime (seconds) //int `adc:"MU"` // Minimum hubs connected where clients can be users //int `adc:"MR"` // Minimum hubs connected where client can be registered //int `adc:"MO"` // Minimum hubs connected where client can be operators MaxHubsUser int `adc:"XU"` // Maximum hubs connected where clients can be users MaxHubsReg int `adc:"XR"` // Maximum hubs connected where client can be registered MaxHubsOp int `adc:"XO"` // Maximum hubs connected where client can be operators }
type HubPacket ¶
type HubPacket InfoPacket
func (*HubPacket) DecodeMessage ¶
func (*HubPacket) DecodeMessageTo ¶
func (*HubPacket) SetMessage ¶
type InfoPacket ¶
type InfoPacket struct {
Msg Message
}
func (*InfoPacket) DecodeMessage ¶
func (p *InfoPacket) DecodeMessage() error
func (*InfoPacket) DecodeMessageTo ¶
func (p *InfoPacket) DecodeMessageTo(m Message) error
func (*InfoPacket) Kind ¶
func (*InfoPacket) Kind() byte
func (*InfoPacket) MarshalPacketADC ¶
func (p *InfoPacket) MarshalPacketADC(buf *bytes.Buffer) error
func (*InfoPacket) Message ¶
func (p *InfoPacket) Message() Message
func (*InfoPacket) SetMessage ¶
func (p *InfoPacket) SetMessage(m Message)
func (*InfoPacket) UnmarshalPacketADC ¶
func (p *InfoPacket) UnmarshalPacketADC(name MsgType, data []byte) error
type ModFeatures ¶
func (ModFeatures) Clone ¶
func (f ModFeatures) Clone() ModFeatures
func (ModFeatures) Intersect ¶
func (f ModFeatures) Intersect(fp ModFeatures) ModFeatures
func (ModFeatures) IsSet ¶
func (f ModFeatures) IsSet(s Feature) bool
func (ModFeatures) Join ¶
func (f ModFeatures) Join() string
func (ModFeatures) MarshalADC ¶
func (f ModFeatures) MarshalADC(buf *bytes.Buffer) error
func (ModFeatures) SetFrom ¶
func (f ModFeatures) SetFrom(fp ModFeatures) ModFeatures
func (*ModFeatures) UnmarshalADC ¶
func (f *ModFeatures) UnmarshalADC(s []byte) error
type Packet ¶
type Packet interface { Kind() byte Message() Message SetMessage(m Message) DecodeMessage() error DecodeMessageTo(m Message) error MarshalPacketADC(buf *bytes.Buffer) error UnmarshalPacketADC(name MsgType, data []byte) error }
func DecodePacket ¶
DecodePacket decodes ADC line. The message payload is a copy.
func DecodePacketRaw ¶
DecodePacketRaw decodes ADC line and returns packet with a RawMessage. RawMessage data slice will point to p, thus it's the caller's responsibility to copy it.
type PeerPacket ¶
type RawMessage ¶
func (*RawMessage) Cmd ¶
func (m *RawMessage) Cmd() MsgType
func (*RawMessage) Decode ¶
func (m *RawMessage) Decode() (Message, error)
func (*RawMessage) MarshalADC ¶
func (m *RawMessage) MarshalADC(buf *bytes.Buffer) error
func (*RawMessage) UnmarshalADC ¶
func (m *RawMessage) UnmarshalADC(data []byte) error
type Reader ¶
type Reader struct { *lineproto.Reader // OnKeepAlive is called when an empty (keep-alive) message is received. OnKeepAlive func() error }
Reader is not safe for concurrent use.
func (*Reader) ReadClient ¶
func (*Reader) ReadPacket ¶
ReadPacket reads and decodes a single ADC command.
func (*Reader) ReadPacketRaw ¶
ReadPacketRaw reads and decodes a single ADC command. The caller must copy the payload.
type RevConnectRequest ¶
func (RevConnectRequest) Cmd ¶
func (RevConnectRequest) Cmd() MsgType
type SearchRequest ¶
type SearchRequest struct { Token string `adc:"TO"` And []string `adc:"AN"` Not []string `adc:"NO"` Ext []string `adc:"EX"` Le int64 `adc:"LE"` Ge int64 `adc:"GE"` Eq int64 `adc:"EQ"` Type FileType `adc:"TY"` // TIGR ext TTH *TTH `adc:"TR"` // SEGA ext Group ExtGroup `adc:"GR"` NoExt []string `adc:"RX"` }
func (SearchRequest) Cmd ¶
func (SearchRequest) Cmd() MsgType
type SearchResult ¶
type SearchResult struct { Token string `adc:"TO"` Path string `adc:"FN"` Size int64 `adc:"SI"` Slots int `adc:"SL"` // TIGR ext TTH *TTH `adc:"TR"` }
func (SearchResult) Cmd ¶
func (SearchResult) Cmd() MsgType
type TargetPacket ¶
type UDPPacket ¶
func (*UDPPacket) DecodeMessage ¶
func (*UDPPacket) DecodeMessageTo ¶
func (*UDPPacket) SetMessage ¶
type Unmarshaler ¶
Unmarshaler is an interface for ADC messages that can marshal itself.
type UserCommand ¶
type UserCommand struct { Path Path `adc:"#"` Command string `adc:"TT"` Category Category `adc:"CT"` Remove int `adc:"RM"` Constrained int `adc:"CO"` Separator int `adc:"SP"` }
func (UserCommand) Cmd ¶
func (UserCommand) Cmd() MsgType
type UserInfo ¶
type UserInfo struct { Id CID `adc:"ID"` Pid *PID `adc:"PD"` // sent only to hub Name string `adc:"NI,req"` Ip4 string `adc:"I4"` Ip6 string `adc:"I6"` Udp4 int `adc:"U4"` Udp6 int `adc:"U6"` Version string `adc:"VE,req"` Application string `adc:"AP"` MaxUpload string `adc:"US"` MaxDownload string `adc:"DS"` Slots int `adc:"SL,req"` SlotsFree int `adc:"FS,req"` AutoSlotLimit int `adc:"AS"` Email string `adc:"EM"` Desc string `adc:"DE"` HubsNormal int `adc:"HN,req"` HubsRegistered int `adc:"HR,req"` HubsOperator int `adc:"HO,req"` Token string `adc:"TO"` // C-C only Type UserType `adc:"CT"` Away AwayType `adc:"AW"` Ref string `adc:"RF"` Features ExtFeatures `adc:"SU,req"` KP string `adc:"KP"` Address string `adc:"EA"` }
type UserInfoMod ¶
type UserInfoMod Fields
func (UserInfoMod) Cmd ¶
func (UserInfoMod) Cmd() MsgType
func (UserInfoMod) MarshalADC ¶
func (m UserInfoMod) MarshalADC(buf *bytes.Buffer) error
func (*UserInfoMod) UnmarshalADC ¶
func (m *UserInfoMod) UnmarshalADC(data []byte) error
type WriteStream ¶
type WriteStream interface { // WriteMessage writes a single message to the buffer. WriteMessage(msg Message) error // Flush flushes the buffer. Flush() error }
WriteStream is a stream of ADC messages to a specific destination.
type Writer ¶
Writer is protocol message writer for ADC protocol. It's not safe for a concurrent use.
func NewWriterSize ¶
NewWriterSize creates a new ADC protocol writer with a specified buffer size.
func (*Writer) BroadcastStream ¶ added in v0.10.0
func (w *Writer) BroadcastStream(from SID) WriteStream
BroadcastStream creates a stream of BroadcastPackets from a given SID.
func (*Writer) ClientStream ¶ added in v0.10.0
func (w *Writer) ClientStream() WriteStream
ClientStream creates a stream of ClientPackets.
func (*Writer) DirectStream ¶ added in v0.10.0
func (w *Writer) DirectStream(from, to SID) WriteStream
DirectStream creates a stream of DirectPackets from a given SID to a given target SID.
func (*Writer) EchoStream ¶ added in v0.10.0
func (w *Writer) EchoStream(from, to SID) WriteStream
EchoStream creates a stream of EchoPackets from a given SID to a given target SID.
func (*Writer) FeatureStream ¶ added in v0.10.0
func (w *Writer) FeatureStream(from SID, sel []FeatureSel) WriteStream
FeatureStream creates a stream of FeaturePackets from a given SID to peers matching a selector.
func (*Writer) HubStream ¶ added in v0.10.0
func (w *Writer) HubStream() WriteStream
HubStream creates a stream of HubPackets.
func (*Writer) InfoStream ¶ added in v0.10.0
func (w *Writer) InfoStream() WriteStream
InfoStream creates a stream of InfoPackets.
func (*Writer) WriteBroadcast ¶
WriteBroadcast writes a single BroadcastPacket to the buffer.
func (*Writer) WriteClient ¶ added in v0.10.0
WriteClient writes a single ClientPacket to the buffer.
func (*Writer) WriteDirect ¶
WriteDirect writes a single DirectPacket to the buffer.
func (*Writer) WriteFeature ¶ added in v0.10.0
func (w *Writer) WriteFeature(from SID, sel []FeatureSel, msg Message) error
WriteFeature writes a single FeaturePacket to the buffer.
func (*Writer) WriteKeepAlive ¶
WriteKeepAlive writes an empty (keep alive) message. It is caller's responsibility to flush the writer.