keepalive

package
v0.32.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 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
	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")
)

Functions

func NewMsgFromCbor

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

Types

type Client added in v0.19.0

type Client struct {
	*protocol.Protocol
	// contains filtered or unexported fields
}

func NewClient added in v0.19.0

func NewClient(protoOptions protocol.ProtocolOptions, cfg *Config) *Client

func (*Client) Start added in v0.19.0

func (c *Client) Start()

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 DoneFunc

type DoneFunc func() error

type KeepAlive

type KeepAlive struct {
	Client *Client
	Server *Server
}

func New

func New(protoOptions protocol.ProtocolOptions, cfg *Config) *KeepAlive

type KeepAliveFunc

type KeepAliveFunc func(uint16) error

Callback function types

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 KeepAliveResponseFunc func(uint16) error

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

type Server added in v0.19.0

type Server struct {
	*protocol.Protocol
	// contains filtered or unexported fields
}

func NewServer added in v0.19.0

func NewServer(protoOptions protocol.ProtocolOptions, cfg *Config) *Server

Jump to

Keyboard shortcuts

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