Documentation ¶
Index ¶
- Constants
- Variables
- func NewMsgFromCbor(msgType uint, data []byte) (protocol.Message, error)
- type Client
- type Config
- type DoneFunc
- type KeepAlive
- type KeepAliveFunc
- type KeepAliveOptionFunc
- func WithDoneFunc(doneFunc DoneFunc) KeepAliveOptionFunc
- func WithKeepAliveFunc(keepAliveFunc KeepAliveFunc) KeepAliveOptionFunc
- func WithKeepAliveResponseFunc(keepAliveResponseFunc KeepAliveResponseFunc) KeepAliveOptionFunc
- func WithPeriod(period time.Duration) KeepAliveOptionFunc
- func WithTimeout(timeout time.Duration) KeepAliveOptionFunc
- type KeepAliveResponseFunc
- type MsgDone
- type MsgKeepAlive
- type MsgKeepAliveResponse
- type Server
Constants ¶
View Source
const ( PROTOCOL_NAME = "keep-alive" PROTOCOL_ID uint16 = 8 // Time between keep-alive probes, in seconds DEFAULT_KEEP_ALIVE_PERIOD = 60 // Timeout for keep-alive responses, in seconds DEFAULT_KEEP_ALIVE_TIMEOUT = 10 )
View Source
const ( MESSAGE_TYPE_KEEP_ALIVE = 0 MESSAGE_TYPE_KEEP_ALIVE_RESPONSE = 1 MESSAGE_TYPE_DONE = 2 )
Variables ¶
View Source
var ( STATE_CLIENT = protocol.NewState(1, "Client") STATE_SERVER = protocol.NewState(2, "Server") STATE_DONE = protocol.NewState(3, "Done") )
View Source
var StateMap = protocol.StateMap{ STATE_CLIENT: protocol.StateMapEntry{ Agency: protocol.AgencyClient, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_KEEP_ALIVE, NewState: STATE_SERVER, }, { MsgType: MESSAGE_TYPE_DONE, NewState: STATE_DONE, }, }, }, STATE_SERVER: protocol.StateMapEntry{ Agency: protocol.AgencyServer, Transitions: []protocol.StateTransition{ { MsgType: MESSAGE_TYPE_KEEP_ALIVE_RESPONSE, NewState: STATE_CLIENT, }, }, }, STATE_DONE: protocol.StateMapEntry{ Agency: protocol.AgencyNone, }, }
Functions ¶
Types ¶
type Client ¶ added in v0.19.0
type Config ¶ added in v0.18.0
type Config struct { KeepAliveFunc KeepAliveFunc KeepAliveResponseFunc KeepAliveResponseFunc DoneFunc DoneFunc Timeout time.Duration Period time.Duration }
func NewConfig ¶ added in v0.25.0
func NewConfig(options ...KeepAliveOptionFunc) Config
type KeepAliveOptionFunc ¶ added in v0.25.0
type KeepAliveOptionFunc func(*Config)
func WithDoneFunc ¶ added in v0.25.0
func WithDoneFunc(doneFunc DoneFunc) KeepAliveOptionFunc
func WithKeepAliveFunc ¶ added in v0.25.0
func WithKeepAliveFunc(keepAliveFunc KeepAliveFunc) KeepAliveOptionFunc
func WithKeepAliveResponseFunc ¶ added in v0.25.0
func WithKeepAliveResponseFunc(keepAliveResponseFunc KeepAliveResponseFunc) KeepAliveOptionFunc
func WithPeriod ¶ added in v0.25.0
func WithPeriod(period time.Duration) KeepAliveOptionFunc
func WithTimeout ¶ added in v0.25.0
func WithTimeout(timeout time.Duration) KeepAliveOptionFunc
type KeepAliveResponseFunc ¶
type MsgDone ¶ added in v0.10.0
type MsgDone struct {
protocol.MessageBase
}
func NewMsgDone ¶ added in v0.12.1
func NewMsgDone() *MsgDone
type MsgKeepAlive ¶ added in v0.10.0
type MsgKeepAlive struct { protocol.MessageBase Cookie uint16 }
func NewMsgKeepAlive ¶ added in v0.10.0
func NewMsgKeepAlive(cookie uint16) *MsgKeepAlive
type MsgKeepAliveResponse ¶ added in v0.10.0
type MsgKeepAliveResponse struct { protocol.MessageBase Cookie uint16 }
func NewMsgKeepAliveResponse ¶ added in v0.10.0
func NewMsgKeepAliveResponse(cookie uint16) *MsgKeepAliveResponse
Click to show internal directories.
Click to hide internal directories.