types

package
v0.16.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2019 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CID

type CID [tiger.Size]byte

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

func MustParseCID(s string) (out CID)

func MustParseCIDP

func MustParseCIDP(s string) *CID

func (*CID) FromBase32

func (id *CID) FromBase32(s string) error

func (CID) Hash

func (id CID) Hash() CID

func (CID) IsZero

func (id CID) IsZero() bool

func (CID) MarshalAdc

func (id CID) MarshalAdc() ([]byte, error)

func (CID) MarshalText

func (id CID) MarshalText() ([]byte, error)

func (CID) String

func (id CID) String() string

func (CID) ToBase32

func (id CID) ToBase32() string

func (*CID) UnmarshalAdc

func (id *CID) UnmarshalAdc(s []byte) error

func (*CID) UnmarshalText

func (id *CID) UnmarshalText(text []byte) error

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.

func NewPID

func NewPID() (id PID)

NewPID generates a new Private ID using a cryptographic random source.

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 SIDFromInt

func SIDFromInt(v uint32) (id SID)

SIDFromInt converts a 20 bit integer to a SID.

func SIDFromString

func SIDFromString(s string) (id SID)

SIDFromString parses a 4-byte base32 encoded SID value. It panics on error.

func (SID) MarshalAdc

func (id SID) MarshalAdc() ([]byte, error)

func (SID) String

func (id SID) String() string

func (*SID) UnmarshalAdc

func (id *SID) UnmarshalAdc(s []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL