package inactivity

import "github.com/plgd-dev/go-coap/v3/net/monitor/inactivity"

Index

Functions

func CloseConn

func CloseConn(cc Conn)

Types

type Conn

type Conn = interface {
	Context() context.Context
	Close() error
}

type KeepAlive

type KeepAlive[C Conn] struct {
	// contains filtered or unexported fields
}

func NewKeepAlive

func NewKeepAlive[C Conn](maxRetries uint32, onInactive OnInactiveFunc[C], sendPing func(cc C, receivePong func()) (func(), error)) *KeepAlive[C]

func (*KeepAlive[C]) OnInactive

func (m *KeepAlive[C]) OnInactive(cc C)

type Monitor

type Monitor[C Conn] struct {
	// contains filtered or unexported fields
}

func New

func New[C Conn](duration time.Duration, onInactive OnInactiveFunc[C]) *Monitor[C]

func (*Monitor[C]) CheckInactivity

func (m *Monitor[C]) CheckInactivity(now time.Time, cc C)

func (*Monitor[C]) LastActivity

func (m *Monitor[C]) LastActivity() time.Time

func (*Monitor[C]) Notify

func (m *Monitor[C]) Notify()

type NilMonitor

type NilMonitor[C Conn] struct{}

func NewNilMonitor

func NewNilMonitor[C Conn]() *NilMonitor[C]

func (*NilMonitor[C]) CheckInactivity

func (m *NilMonitor[C]) CheckInactivity(time.Time, C)

func (*NilMonitor[C]) Notify

func (m *NilMonitor[C]) Notify()

type OnInactiveFunc

type OnInactiveFunc[C Conn] func(cc C)

Source Files

keepalive.go monitor.go

Version
v3.3.6 (latest)
Published
Sep 18, 2024
Platform
linux/amd64
Imports
5 packages
Last checked
1 week ago

Tools for package owners.