Documentation ¶
Index ¶
- type CID
- func (id CID) Base32() string
- func (id *CID) FromBase32(s string) error
- func (id CID) Hash() CID
- func (id CID) IsZero() bool
- func (id CID) MarshalADC(buf *bytes.Buffer) error
- func (id CID) MarshalText() ([]byte, error)
- func (id CID) String() string
- func (id *CID) UnmarshalADC(s []byte) error
- func (id *CID) UnmarshalText(text []byte) error
- type PID
- type SID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CID ¶
CID (Client ID) globally and publicly identify a unique client and underlie client to client communication.
They are generated by hashing the (unencoded) PID with the session hash algorithm.
Hubs should register clients by CID. CID length follows the length of the hash algorithm used for the session. Clients must be prepared to handle CIDs of varying lengths.
func MustParseCID ¶
MustParseCID parses a base32 CID string and panics on error.
func MustParseCIDP ¶
MustParseCIDP is the same as MustParseCID, but returns a pointer to a new value.
func (*CID) FromBase32 ¶
FromBase32 parses CID from base32 encoding.
func (CID) MarshalADC ¶
MarshalADC implements adc.Marshaler.
func (CID) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*CID) UnmarshalADC ¶
UnmarshalADC implements adc.Unmarshaler.
func (*CID) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type PID ¶
type PID = CID
PID (Private ID) globally identify a unique client.
They function during initial protocol negotiation to generate the CID and are invisible to other clients. PIDs should be generated in a way to avoid collisions, for example using the hash of the current time and primary network card MAC address if sufficient randomness cannot be generated.
Hubs and clients may not disclose PIDs to other clients; doing so weakens the security of the ADC network. Clients should should keep the same PID between sessions and hubs. PID length follows the length of the hash algorithm used for the session.
type SID ¶
type SID [4]byte
SID (Session ID) appears in all communication that interacts with the hub. They identify a unique user on a single hub and are assigned by the hub during initial protocol negotiation. SIDs are 20 bits long and encoded using a 4-byte base32 encoded string.
func SIDFromString ¶
SIDFromString parses a 4-byte base32 encoded SID value. It panics on error.
func (SID) MarshalADC ¶
MarshalADC implements adc.Marshaler.
func (*SID) UnmarshalADC ¶
UnmarshalADC implements adc.Unmarshaler.