keepalive

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PROTOCOL_NAME        = "keep-alive"
	PROTOCOL_ID   uint16 = 8

	// Time between keep-alive probes, in seconds
	KEEP_ALIVE_PERIOD = 60
)
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")
)

Functions

func NewMsgFromCbor

func NewMsgFromCbor(msgType uint, data []byte) (protocol.Message, error)

Types

type DoneFunc

type DoneFunc func() error

type KeepAlive

type KeepAlive struct {
	// contains filtered or unexported fields
}

func New

func New(options protocol.ProtocolOptions, callbackConfig *KeepAliveCallbackConfig) *KeepAlive

func (*KeepAlive) KeepAlive

func (k *KeepAlive) KeepAlive(cookie uint16) error

func (*KeepAlive) Start

func (k *KeepAlive) Start()

func (*KeepAlive) Stop

func (k *KeepAlive) Stop()

type KeepAliveCallbackConfig

type KeepAliveCallbackConfig struct {
	KeepAliveFunc         KeepAliveFunc
	KeepAliveResponseFunc KeepAliveResponseFunc
	DoneFunc              DoneFunc
}

type KeepAliveFunc

type KeepAliveFunc func(uint16) error

Callback function types

type KeepAliveResponseFunc

type KeepAliveResponseFunc func(uint16) error

type MsgDone added in v0.10.0

type MsgDone struct {
	protocol.MessageBase
}

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

Jump to

Keyboard shortcuts

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