Documentation ¶
Index ¶
- Constants
- Variables
- func InitLogger(level int)
- type Client
- func (c *Client) DelFromPath()
- func (c *Client) Disconnected() (err error)
- func (c *Client) GetCookieIn() []byte
- func (c *Client) GetType() (prot.AddressType, bool)
- func (c *Client) Pack(h prot.Header, pm prot.PayloadMarshaler) ([]byte, error)
- func (c *Client) Received(b []byte)
- func (c *Client) SetType(t prot.AddressType)
- func (c *Client) Unpack(data []byte) (msg interface{}, err error)
- type CombinedSequenceNumber
- func (csn *CombinedSequenceNumber) AsBytes() ([]byte, error)
- func (csn *CombinedSequenceNumber) EqualsTo(targetCsn *CombinedSequenceNumber) bool
- func (csn *CombinedSequenceNumber) GetOverflowNumber() uint16
- func (csn *CombinedSequenceNumber) GetSequenceNumber() uint32
- func (csn *CombinedSequenceNumber) HasErrOverflowSentinel() bool
- func (csn *CombinedSequenceNumber) Increment() error
- func (csn *CombinedSequenceNumber) WillHaveErrOverflowSentinel() bool
- func (csn *CombinedSequenceNumber) Write(w io.Writer) error
- type Conn
- type Path
- func (p *Path) AddResponder(c *Client) (prot.AddressType, error)
- func (p *Path) Del(id prot.AddressType)
- func (p *Path) Get(id prot.AddressType) (*Client, bool)
- func (p *Path) GetInitiator() (*Client, bool)
- func (p *Path) Iter() <-chan hm.KeyValue
- func (p *Path) SetInitiator(c *Client)
- func (p *Path) Walk(cb func(c *Client))
- type Paths
- type Server
Constants ¶
const ( None = iota + 1 ServerHello ClientHello ClientAuth ServerAuth )
STATES
const ( DebugLevel = 0 InfoLevel = 10 InfoLevel11 = 11 // enable timestamp InfoLevel12 = 12 // enable caller InfoLevel13 = 13 // enable caller and timestamp WarnLevel = 20 ErrorLevel = 30 PanicLevel = 40 DPanicLevel45 = 45 FatalLevel = 50 )
Logging levels
const ( // MaxJobs .. MaxJobs = 32 // MaxWorkers .. MaxWorkers = 8 )
Variables ¶
var ( // ErrOverflowSentinel .. ErrOverflowSentinel = errors.New("OverflowSentinel") // ErrInvalidOverflowNumber .. ErrInvalidOverflowNumber = errors.New("Invalid overflow number") // ErrNotExpectedCsn .. ErrNotExpectedCsn = errors.New("unexpected sequence number") )
var CloseFrameDropByInitiator = compileCloseFrame(prot.CloseCodeDropByInitiator, "")
CloseFrameDropByInitiator //
var CloseFrameGoingAway = compileCloseFrame(prot.CloseCodeGoingAway, "")
CloseFrameGoingAway //
var CloseFrameHandover = compileCloseFrame(prot.CloseCodeHandover, "")
CloseFrameHandover //
var CloseFrameInitiatorCouldNotDecrypt = compileCloseFrame(prot.CloseCodeInitiatorCouldNotDecrypt, "")
CloseFrameInitiatorCouldNotDecrypt //
var CloseFrameInternalError = compileCloseFrame(prot.CloseCodeInternalError, "")
CloseFrameInternalError //
var CloseFrameInvalidKey = compileCloseFrame(prot.CloseCodeInvalidKey, "")
CloseFrameInvalidKey //
CloseFrameNoSharedTasks //
var CloseFrameNormalClosure = compileCloseFrame(prot.CloseCodeNormalClosure, "")
CloseFrameNormalClosure //
var CloseFramePathFullError = compileCloseFrame(prot.CloseCodePathFullError, "")
CloseFramePathFullError //
var CloseFrameProtocolError = compileCloseFrame(prot.CloseCodeProtocolError, "")
CloseFrameProtocolError //
var CloseFrameSubprotocolError = compileCloseFrame(prot.CloseCodeSubprotocolError, "")
CloseFrameSubprotocolError //
var CloseFrameTimeout = compileCloseFrame(prot.CloseCodeTimeout, "")
CloseFrameTimeout //
var Logger *zap.Logger
Logger ..
var Sugar *zap.SugaredLogger
Sugar ..
Functions ¶
Types ¶
type Client ¶
type Client struct { ClientKey [nacl.NaclKeyBytesSize]byte ServerSessionBox *nacl.BoxKeyPair ServerPermanentBox *nacl.BoxKeyPair CookieOut []byte CombinedSequenceNumberOut *CombinedSequenceNumber CombinedSequenceNumberIn *CombinedSequenceNumber Authenticated bool ID prot.AddressType Path *Path Server *Server State int // contains filtered or unexported fields }
Client ..
func NewClient ¶
func NewClient(conn *Conn, clientKey [prot.KeyBytesSize]byte, permanentBox, sessionBox *nacl.BoxKeyPair) (*Client, error)
NewClient ..
type CombinedSequenceNumber ¶
type CombinedSequenceNumber struct {
// contains filtered or unexported fields
}
CombinedSequenceNumber ..
func NewCombinedSequenceNumber ¶
func NewCombinedSequenceNumber(initialSequenceNum uint32) *CombinedSequenceNumber
NewCombinedSequenceNumber ..
func ParseCombinedSequenceNumber ¶
func ParseCombinedSequenceNumber(csnBytes []byte) (*CombinedSequenceNumber, error)
ParseCombinedSequenceNumber ..
func (*CombinedSequenceNumber) AsBytes ¶
func (csn *CombinedSequenceNumber) AsBytes() ([]byte, error)
AsBytes gets csn as bytes
func (*CombinedSequenceNumber) EqualsTo ¶
func (csn *CombinedSequenceNumber) EqualsTo(targetCsn *CombinedSequenceNumber) bool
EqualsTo ..
func (*CombinedSequenceNumber) GetOverflowNumber ¶
func (csn *CombinedSequenceNumber) GetOverflowNumber() uint16
GetOverflowNumber ..
func (*CombinedSequenceNumber) GetSequenceNumber ¶
func (csn *CombinedSequenceNumber) GetSequenceNumber() uint32
GetSequenceNumber ..
func (*CombinedSequenceNumber) HasErrOverflowSentinel ¶
func (csn *CombinedSequenceNumber) HasErrOverflowSentinel() bool
HasErrOverflowSentinel ..
func (*CombinedSequenceNumber) Increment ¶
func (csn *CombinedSequenceNumber) Increment() error
Increment increase csn one
func (*CombinedSequenceNumber) WillHaveErrOverflowSentinel ¶
func (csn *CombinedSequenceNumber) WillHaveErrOverflowSentinel() bool
WillHaveErrOverflowSentinel states if the next csn will have ErrOverflowSentinel
type Path ¶
type Path struct {
// contains filtered or unexported fields
}
Path ..
func (*Path) AddResponder ¶
func (p *Path) AddResponder(c *Client) (prot.AddressType, error)
AddResponder ..
type Paths ¶
type Paths struct {
// contains filtered or unexported fields
}
Paths stores path instances
func (*Paths) GetOrCreate ¶
GetOrCreate ..