options

package
v3.3.6 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: Apache-2.0 Imports: 18 Imported by: 22

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockwiseOpt

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

BlockwiseOpt network option.

func WithBlockwise

func WithBlockwise(enable bool, szx blockwise.SZX, transferTimeout time.Duration) BlockwiseOpt

WithBlockwise configure's blockwise transfer.

func (BlockwiseOpt) DTLSServerApply

func (o BlockwiseOpt) DTLSServerApply(cfg *dtlsServer.Config)

func (BlockwiseOpt) TCPClientApply

func (o BlockwiseOpt) TCPClientApply(cfg *tcpClient.Config)

func (BlockwiseOpt) TCPServerApply

func (o BlockwiseOpt) TCPServerApply(cfg *tcpServer.Config)

func (BlockwiseOpt) UDPClientApply

func (o BlockwiseOpt) UDPClientApply(cfg *udpClient.Config)

func (BlockwiseOpt) UDPServerApply

func (o BlockwiseOpt) UDPServerApply(cfg *udpServer.Config)

type CloseSocketOpt

type CloseSocketOpt struct{}

CloseSocketOpt close socket option.

func WithCloseSocket

func WithCloseSocket() CloseSocketOpt

WithCloseSocket closes socket at the close connection.

func (CloseSocketOpt) TCPClientApply

func (o CloseSocketOpt) TCPClientApply(cfg *tcpClient.Config)

func (CloseSocketOpt) UDPClientApply

func (o CloseSocketOpt) UDPClientApply(cfg *udpClient.Config)

type ConnectionCacheSizeOpt

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

ConnectionCacheOpt network option.

func WithConnectionCacheSize

func WithConnectionCacheSize(connectionCacheSize uint16) ConnectionCacheSizeOpt

WithConnectionCacheSize configure's maximum size of cache of read buffer.

func (ConnectionCacheSizeOpt) TCPClientApply

func (o ConnectionCacheSizeOpt) TCPClientApply(cfg *tcpClient.Config)

func (ConnectionCacheSizeOpt) TCPServerApply

func (o ConnectionCacheSizeOpt) TCPServerApply(cfg *tcpServer.Config)

type ContextOpt

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

ContextOpt handler function option.

func WithContext

func WithContext(ctx context.Context) ContextOpt

WithContext sets parent context of server.

func (ContextOpt) DTLSServerApply

func (o ContextOpt) DTLSServerApply(cfg *dtlsServer.Config)

func (ContextOpt) TCPClientApply

func (o ContextOpt) TCPClientApply(cfg *tcpClient.Config)

func (ContextOpt) TCPServerApply

func (o ContextOpt) TCPServerApply(cfg *tcpServer.Config)

func (ContextOpt) UDPClientApply

func (o ContextOpt) UDPClientApply(cfg *udpClient.Config)

func (ContextOpt) UDPServerApply

func (o ContextOpt) UDPServerApply(cfg *udpServer.Config)

type DialerOpt

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

DialerOpt dialer option.

func WithDialer

func WithDialer(dialer *net.Dialer) DialerOpt

WithDialer set dialer for dial.

func (DialerOpt) TCPClientApply

func (o DialerOpt) TCPClientApply(cfg *tcpClient.Config)

func (DialerOpt) UDPClientApply

func (o DialerOpt) UDPClientApply(cfg *udpClient.Config)

type DisablePeerTCPSignalMessageCSMsOpt

type DisablePeerTCPSignalMessageCSMsOpt struct{}

DisablePeerTCPSignalMessageCSMsOpt coap-tcp csm option.

func WithDisablePeerTCPSignalMessageCSMs

func WithDisablePeerTCPSignalMessageCSMs() DisablePeerTCPSignalMessageCSMsOpt

WithDisablePeerTCPSignalMessageCSMs ignor peer's CSM message.

func (DisablePeerTCPSignalMessageCSMsOpt) TCPClientApply

func (o DisablePeerTCPSignalMessageCSMsOpt) TCPClientApply(cfg *tcpClient.Config)

func (DisablePeerTCPSignalMessageCSMsOpt) TCPServerApply

func (o DisablePeerTCPSignalMessageCSMsOpt) TCPServerApply(cfg *tcpServer.Config)

type DisableTCPSignalMessageCSMOpt

type DisableTCPSignalMessageCSMOpt struct{}

DisableTCPSignalMessageCSMOpt coap-tcp csm option.

func WithDisableTCPSignalMessageCSM

func WithDisableTCPSignalMessageCSM() DisableTCPSignalMessageCSMOpt

WithDisableTCPSignalMessageCSM don't send CSM when client conn is created.

func (DisableTCPSignalMessageCSMOpt) TCPClientApply

func (o DisableTCPSignalMessageCSMOpt) TCPClientApply(cfg *tcpClient.Config)

func (DisableTCPSignalMessageCSMOpt) TCPServerApply

func (o DisableTCPSignalMessageCSMOpt) TCPServerApply(cfg *tcpServer.Config)

type ErrorFunc

type ErrorFunc = config.ErrorFunc

type ErrorsOpt

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

ErrorsOpt errors option.

func WithErrors

func WithErrors(errors ErrorFunc) ErrorsOpt

WithErrors set function for logging error.

func (ErrorsOpt) DTLSServerApply

func (o ErrorsOpt) DTLSServerApply(cfg *dtlsServer.Config)

func (ErrorsOpt) TCPClientApply

func (o ErrorsOpt) TCPClientApply(cfg *tcpClient.Config)

func (ErrorsOpt) TCPServerApply

func (o ErrorsOpt) TCPServerApply(cfg *tcpServer.Config)

func (ErrorsOpt) UDPClientApply

func (o ErrorsOpt) UDPClientApply(cfg *udpClient.Config)

func (ErrorsOpt) UDPServerApply

func (o ErrorsOpt) UDPServerApply(cfg *udpServer.Config)

type GetTokenOpt

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

GetTokenOpt token option.

func WithGetToken

func WithGetToken(getToken client.GetTokenFunc) GetTokenOpt

WithGetToken set function for generating tokens.

func (GetTokenOpt) DTLSServerApply

func (o GetTokenOpt) DTLSServerApply(cfg *dtlsServer.Config)

func (GetTokenOpt) TCPClientApply

func (o GetTokenOpt) TCPClientApply(cfg *tcpClient.Config)

func (GetTokenOpt) TCPServerApply

func (o GetTokenOpt) TCPServerApply(cfg *tcpServer.Config)

func (GetTokenOpt) UDPClientApply

func (o GetTokenOpt) UDPClientApply(cfg *udpClient.Config)

func (GetTokenOpt) UDPServerApply

func (o GetTokenOpt) UDPServerApply(cfg *udpServer.Config)

type Handler

type Handler interface {
	tcpClient.HandlerFunc | udpClient.HandlerFunc
}

type HandlerFuncOpt

type HandlerFuncOpt[H Handler] struct {
	// contains filtered or unexported fields
}

HandlerFuncOpt handler function option.

func WithHandlerFunc

func WithHandlerFunc[H Handler](h H) HandlerFuncOpt[H]

WithHandlerFunc set handle for handling request's.

func (HandlerFuncOpt[H]) DTLSServerApply

func (o HandlerFuncOpt[H]) DTLSServerApply(cfg *dtlsServer.Config)

func (HandlerFuncOpt[H]) TCPClientApply

func (o HandlerFuncOpt[H]) TCPClientApply(cfg *tcpClient.Config)

func (HandlerFuncOpt[H]) TCPServerApply

func (o HandlerFuncOpt[H]) TCPServerApply(cfg *tcpServer.Config)

func (HandlerFuncOpt[H]) UDPClientApply

func (o HandlerFuncOpt[H]) UDPClientApply(cfg *udpClient.Config)

func (HandlerFuncOpt[H]) UDPServerApply

func (o HandlerFuncOpt[H]) UDPServerApply(cfg *udpServer.Config)

type InactivityMonitorOpt

type InactivityMonitorOpt[C OnInactiveFunc] struct {
	// contains filtered or unexported fields
}

InactivityMonitorOpt notifies when a connection was inactive for a given duration.

func WithInactivityMonitor

func WithInactivityMonitor[C OnInactiveFunc](duration time.Duration, onInactive C) InactivityMonitorOpt[C]

WithInactivityMonitor set deadline's for read operations over client connection.

func (InactivityMonitorOpt[C]) DTLSServerApply

func (o InactivityMonitorOpt[C]) DTLSServerApply(cfg *dtlsServer.Config)

func (InactivityMonitorOpt[C]) TCPClientApply

func (o InactivityMonitorOpt[C]) TCPClientApply(cfg *tcpClient.Config)

func (InactivityMonitorOpt[C]) TCPServerApply

func (o InactivityMonitorOpt[C]) TCPServerApply(cfg *tcpServer.Config)

func (InactivityMonitorOpt[C]) UDPClientApply

func (o InactivityMonitorOpt[C]) UDPClientApply(cfg *udpClient.Config)

func (InactivityMonitorOpt[C]) UDPServerApply

func (o InactivityMonitorOpt[C]) UDPServerApply(cfg *udpServer.Config)

type KeepAliveOpt

type KeepAliveOpt[C OnInactiveFunc] struct {
	// contains filtered or unexported fields
}

KeepAliveOpt keepalive option.

func WithKeepAlive

func WithKeepAlive[C OnInactiveFunc](maxRetries uint32, timeout time.Duration, onInactive C) KeepAliveOpt[C]

WithKeepAlive monitoring's client connection's.

func (KeepAliveOpt[C]) DTLSServerApply

func (o KeepAliveOpt[C]) DTLSServerApply(cfg *dtlsServer.Config)

func (KeepAliveOpt[C]) TCPClientApply

func (o KeepAliveOpt[C]) TCPClientApply(cfg *tcpClient.Config)

func (KeepAliveOpt[C]) TCPServerApply

func (o KeepAliveOpt[C]) TCPServerApply(cfg *tcpServer.Config)

func (KeepAliveOpt[C]) UDPClientApply

func (o KeepAliveOpt[C]) UDPClientApply(cfg *udpClient.Config)

func (KeepAliveOpt[C]) UDPServerApply

func (o KeepAliveOpt[C]) UDPServerApply(cfg *udpServer.Config)

type LimitClientEndpointParallelRequestOpt

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

LimitClientEndpointParallelRequestOpt limit's number of parallel requests to endpoint by client.

func WithLimitClientEndpointParallelRequest

func WithLimitClientEndpointParallelRequest(limitClientEndpointParallelRequests int64) LimitClientEndpointParallelRequestOpt

WithLimitClientEndpointParallelRequest limits number of parallel requests to endpoint from client. (default: 1)

func (LimitClientEndpointParallelRequestOpt) DTLSServerApply

func (LimitClientEndpointParallelRequestOpt) TCPClientApply

func (LimitClientEndpointParallelRequestOpt) TCPServerApply

func (LimitClientEndpointParallelRequestOpt) UDPClientApply

func (LimitClientEndpointParallelRequestOpt) UDPServerApply

type LimitClientParallelRequestOpt

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

LimitClientParallelRequestOpt limit's number of parallel requests from client.

func WithLimitClientParallelRequest

func WithLimitClientParallelRequest(limitClientParallelRequests int64) LimitClientParallelRequestOpt

WithLimitClientParallelRequestOpt limits number of parallel requests from client. (default: 1)

func (LimitClientParallelRequestOpt) DTLSServerApply

func (o LimitClientParallelRequestOpt) DTLSServerApply(cfg *dtlsServer.Config)

func (LimitClientParallelRequestOpt) TCPClientApply

func (o LimitClientParallelRequestOpt) TCPClientApply(cfg *tcpClient.Config)

func (LimitClientParallelRequestOpt) TCPServerApply

func (o LimitClientParallelRequestOpt) TCPServerApply(cfg *tcpServer.Config)

func (LimitClientParallelRequestOpt) UDPClientApply

func (o LimitClientParallelRequestOpt) UDPClientApply(cfg *udpClient.Config)

func (LimitClientParallelRequestOpt) UDPServerApply

func (o LimitClientParallelRequestOpt) UDPServerApply(cfg *udpServer.Config)

type MTUOpt

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

MTUOpt transmission options.

func WithMTU

func WithMTU(mtu uint16) MTUOpt

Setup MTU unit

func (MTUOpt) DTLSServerApply

func (o MTUOpt) DTLSServerApply(cfg *dtlsServer.Config)

func (MTUOpt) UDPClientApply

func (o MTUOpt) UDPClientApply(cfg *udpClient.Config)

func (MTUOpt) UDPServerApply

func (o MTUOpt) UDPServerApply(cfg *udpServer.Config)

type MaxMessageSizeOpt

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

MaxMessageSizeOpt handler function option.

func WithMaxMessageSize

func WithMaxMessageSize(maxMessageSize uint32) MaxMessageSizeOpt

WithMaxMessageSize limit size of processed message.

func (MaxMessageSizeOpt) DTLSServerApply

func (o MaxMessageSizeOpt) DTLSServerApply(cfg *dtlsServer.Config)

func (MaxMessageSizeOpt) TCPClientApply

func (o MaxMessageSizeOpt) TCPClientApply(cfg *tcpClient.Config)

func (MaxMessageSizeOpt) TCPServerApply

func (o MaxMessageSizeOpt) TCPServerApply(cfg *tcpServer.Config)

func (MaxMessageSizeOpt) UDPClientApply

func (o MaxMessageSizeOpt) UDPClientApply(cfg *udpClient.Config)

func (MaxMessageSizeOpt) UDPServerApply

func (o MaxMessageSizeOpt) UDPServerApply(cfg *udpServer.Config)

type MessagePoolOpt

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

ConnectionCacheOpt network option.

func WithMessagePool

func WithMessagePool(messagePool *pool.Pool) MessagePoolOpt

WithMessagePool configure's message pool for acquire/releasing coap messages

func (MessagePoolOpt) DTLSServerApply

func (o MessagePoolOpt) DTLSServerApply(cfg *dtlsServer.Config)

func (MessagePoolOpt) TCPClientApply

func (o MessagePoolOpt) TCPClientApply(cfg *tcpClient.Config)

func (MessagePoolOpt) TCPServerApply

func (o MessagePoolOpt) TCPServerApply(cfg *tcpServer.Config)

func (MessagePoolOpt) UDPClientApply

func (o MessagePoolOpt) UDPClientApply(cfg *udpClient.Config)

func (MessagePoolOpt) UDPServerApply

func (o MessagePoolOpt) UDPServerApply(cfg *udpServer.Config)

type MuxHandlerOpt

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

HandlerFuncOpt handler function option.

func WithMux

func WithMux(m mux.Handler) MuxHandlerOpt

WithMux sets multiplexer for handle requests.

func (MuxHandlerOpt) DTLSServerApply

func (o MuxHandlerOpt) DTLSServerApply(cfg *dtlsServer.Config)

func (MuxHandlerOpt) TCPClientApply

func (o MuxHandlerOpt) TCPClientApply(cfg *tcpClient.Config)

func (MuxHandlerOpt) TCPServerApply

func (o MuxHandlerOpt) TCPServerApply(cfg *tcpServer.Config)

func (MuxHandlerOpt) UDPClientApply

func (o MuxHandlerOpt) UDPClientApply(cfg *udpClient.Config)

func (MuxHandlerOpt) UDPServerApply

func (o MuxHandlerOpt) UDPServerApply(cfg *udpServer.Config)

type NetOpt

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

NetOpt network option.

func WithNetwork

func WithNetwork(net string) NetOpt

WithNetwork define's tcp version (udp4, udp6, tcp) for client.

func (NetOpt) TCPClientApply

func (o NetOpt) TCPClientApply(cfg *tcpClient.Config)

func (NetOpt) UDPClientApply

func (o NetOpt) UDPClientApply(cfg *udpClient.Config)

type OnInactiveFunc

type OnInactiveFunc interface {
	UDPOnInactive | TCPOnInactive
}

type OnNewConnFunc

type OnNewConnFunc interface {
	tcpServer.OnNewConnFunc | udpServer.OnNewConnFunc
}

type OnNewConnOpt

type OnNewConnOpt[F OnNewConnFunc] struct {
	// contains filtered or unexported fields
}

OnNewConnOpt network option.

func WithOnNewConn

func WithOnNewConn[F OnNewConnFunc](onNewConn F) OnNewConnOpt[F]

WithOnNewConn server's notify about new client connection.

func (OnNewConnOpt[F]) DTLSServerApply

func (o OnNewConnOpt[F]) DTLSServerApply(cfg *dtlsServer.Config)

func (OnNewConnOpt[F]) TCPServerApply

func (o OnNewConnOpt[F]) TCPServerApply(cfg *tcpServer.Config)

func (OnNewConnOpt[F]) UDPServerApply

func (o OnNewConnOpt[F]) UDPServerApply(cfg *udpServer.Config)

type PeriodicRunnerOpt

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

PeriodicRunnerOpt function which is executed in every ticks

func WithPeriodicRunner

func WithPeriodicRunner(periodicRunner periodic.Func) PeriodicRunnerOpt

WithPeriodicRunner set function which is executed in every ticks.

func (PeriodicRunnerOpt) DTLSServerApply

func (o PeriodicRunnerOpt) DTLSServerApply(cfg *dtlsServer.Config)

func (PeriodicRunnerOpt) TCPClientApply

func (o PeriodicRunnerOpt) TCPClientApply(cfg *tcpClient.Config)

func (PeriodicRunnerOpt) TCPServerApply

func (o PeriodicRunnerOpt) TCPServerApply(cfg *tcpServer.Config)

func (PeriodicRunnerOpt) UDPClientApply

func (o PeriodicRunnerOpt) UDPClientApply(cfg *udpClient.Config)

func (PeriodicRunnerOpt) UDPServerApply

func (o PeriodicRunnerOpt) UDPServerApply(cfg *udpServer.Config)

type ProcessReceivedMessageOpt added in v3.1.0

type ProcessReceivedMessageOpt[C responsewriter.Client] struct {
	ProcessReceivedMessageFunc config.ProcessReceivedMessageFunc[C]
}

ProcessReceivedMessageOpt gopool option.

func WithProcessReceivedMessageFunc added in v3.1.0

func WithProcessReceivedMessageFunc[C responsewriter.Client](processReceivedMessageFunc config.ProcessReceivedMessageFunc[C]) ProcessReceivedMessageOpt[C]

func (ProcessReceivedMessageOpt[C]) DTLSServerApply added in v3.1.0

func (o ProcessReceivedMessageOpt[C]) DTLSServerApply(cfg *dtlsServer.Config)

func (ProcessReceivedMessageOpt[C]) TCPClientApply added in v3.1.0

func (o ProcessReceivedMessageOpt[C]) TCPClientApply(cfg *tcpClient.Config)

func (ProcessReceivedMessageOpt[C]) TCPServerApply added in v3.1.0

func (o ProcessReceivedMessageOpt[C]) TCPServerApply(cfg *tcpServer.Config)

func (ProcessReceivedMessageOpt[C]) UDPClientApply added in v3.1.0

func (o ProcessReceivedMessageOpt[C]) UDPClientApply(cfg *udpClient.Config)

func (ProcessReceivedMessageOpt[C]) UDPServerApply added in v3.1.0

func (o ProcessReceivedMessageOpt[C]) UDPServerApply(cfg *udpServer.Config)

type ReceivedMessageQueueSizeOpt added in v3.1.0

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

ReceivedMessageQueueSizeOpt limit's message queue size for received messages.

func WithReceivedMessageQueueSize added in v3.1.0

func WithReceivedMessageQueueSize(receivedMessageQueueSize int) ReceivedMessageQueueSizeOpt

WithReceivedMessageQueueSize limit's message queue size for received messages. (default: 16)

func (ReceivedMessageQueueSizeOpt) DTLSServerApply added in v3.1.0

func (o ReceivedMessageQueueSizeOpt) DTLSServerApply(cfg *dtlsServer.Config)

func (ReceivedMessageQueueSizeOpt) TCPClientApply added in v3.1.0

func (o ReceivedMessageQueueSizeOpt) TCPClientApply(cfg *tcpClient.Config)

func (ReceivedMessageQueueSizeOpt) TCPServerApply added in v3.1.0

func (o ReceivedMessageQueueSizeOpt) TCPServerApply(cfg *tcpServer.Config)

func (ReceivedMessageQueueSizeOpt) UDPClientApply added in v3.1.0

func (o ReceivedMessageQueueSizeOpt) UDPClientApply(cfg *udpClient.Config)

func (ReceivedMessageQueueSizeOpt) UDPServerApply added in v3.1.0

func (o ReceivedMessageQueueSizeOpt) UDPServerApply(cfg *udpServer.Config)

type TCPOnInactive

type TCPOnInactive = func(cc *tcpClient.Conn)

type TLSOpt

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

TLSOpt tls configuration option.

func WithTLS

func WithTLS(cfg *tls.Config) TLSOpt

WithTLS creates tls connection.

func (TLSOpt) TCPClientApply

func (o TLSOpt) TCPClientApply(cfg *tcpClient.Config)

type TransmissionOpt

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

TransmissionOpt transmission options.

func WithTransmission

func WithTransmission(transmissionNStart uint32,
	transmissionAcknowledgeTimeout time.Duration,
	transmissionMaxRetransmit uint32,
) TransmissionOpt

WithTransmission set options for (re)transmission for Confirmable message-s.

func (TransmissionOpt) DTLSServerApply

func (o TransmissionOpt) DTLSServerApply(cfg *dtlsServer.Config)

func (TransmissionOpt) UDPClientApply

func (o TransmissionOpt) UDPClientApply(cfg *udpClient.Config)

func (TransmissionOpt) UDPServerApply

func (o TransmissionOpt) UDPServerApply(cfg *udpServer.Config)

type UDPOnInactive

type UDPOnInactive = func(cc *udpClient.Conn)

type WithRequestMonitorFunc added in v3.3.0

type WithRequestMonitorFunc interface {
	tcpClient.RequestMonitorFunc | udpClient.RequestMonitorFunc
}

WithRequestMonitor

type WithRequestMonitorOpt added in v3.3.0

type WithRequestMonitorOpt[F WithRequestMonitorFunc] struct {
	// contains filtered or unexported fields
}

WithRequestMonitorOpt network option.

func WithRequestMonitor added in v3.3.0

func WithRequestMonitor[F WithRequestMonitorFunc](requestMonitor F) WithRequestMonitorOpt[F]

WithRequestMonitor enables request monitoring for the connection. It is called for each CoAP message received from the peer before it is processed. If it returns an error, the connection is closed. If it returns true, the message is dropped.

func (WithRequestMonitorOpt[F]) DTLSServerApply added in v3.3.0

func (o WithRequestMonitorOpt[F]) DTLSServerApply(cfg *dtlsServer.Config)

func (WithRequestMonitorOpt[F]) TCPServerApply added in v3.3.0

func (o WithRequestMonitorOpt[F]) TCPServerApply(cfg *tcpServer.Config)

func (WithRequestMonitorOpt[F]) UDPServerApply added in v3.3.0

func (o WithRequestMonitorOpt[F]) UDPServerApply(cfg *udpServer.Config)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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