service

package
v2.7.6 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockWiseTransferSZXFromString added in v2.7.6

func BlockWiseTransferSZXFromString(s string) (blockwise.SZX, error)

func New

func New(ctx context.Context, config Config, router *mux.Router, fileWatcher *fsnotify.Watcher, logger log.Logger, opt ...func(*Options)) (*service.Service, error)

New creates server.

func TLSConfigToDTLSConfig

func TLSConfigToDTLSConfig(tlsConfig *tls.Config) *dtls.Config

func WithMessagePool

func WithMessagePool(p *pool.Pool) func(*Options)

func WithOnInactivityConnection

func WithOnInactivityConnection(f func(conn mux.Conn)) func(*Options)

func WithOnNewConnection

func WithOnNewConnection(f func(conn mux.Conn)) func(*Options)

func WithOverrideTLS

func WithOverrideTLS(f func(cfg *tls.Config) *tls.Config) func(*Options)

Types

type BlockwiseTransferConfig

type BlockwiseTransferConfig struct {
	Enabled bool   `yaml:"enabled" json:"enabled"`
	SZX     string `yaml:"blockSize" json:"blockSize"`
}

func (*BlockwiseTransferConfig) Validate

func (c *BlockwiseTransferConfig) Validate() error

type Config

type Config struct {
	Addr              string                  `yaml:"address" json:"address"`
	Protocols         []Protocol              `yaml:"protocols" json:"protocols"`
	MaxMessageSize    uint32                  `yaml:"maxMessageSize" json:"maxMessageSize"`
	MessagePoolSize   int                     `yaml:"messagePoolSize" json:"messagePoolSize"`
	MessageQueueSize  int                     `yaml:"messageQueueSize" json:"messageQueueSize"`
	BlockwiseTransfer BlockwiseTransferConfig `yaml:"blockwiseTransfer" json:"blockwiseTransfer"`
	TLS               TLSConfig               `yaml:"tls" json:"tls"`
	InactivityMonitor *InactivityMonitor      `yaml:"inactivityMonitor,omitempty" json:"inactivityMonitor,omitempty"`
	KeepAlive         *KeepAlive              `yaml:"keepAlive,omitempty" json:"keepAlive,omitempty"`
}

Config represents configuration of coap service

func (*Config) GetTimeout

func (c *Config) GetTimeout() time.Duration

func (Config) String

func (c Config) String() string

String return string representation of Config

func (*Config) Validate

func (c *Config) Validate() error

type InactivityMonitor

type InactivityMonitor struct {
	Timeout time.Duration `yaml:"timeout" json:"timeout"`
}

func (*InactivityMonitor) Validate

func (c *InactivityMonitor) Validate() error

type KeepAlive

type KeepAlive struct {
	Timeout time.Duration `yaml:"timeout" json:"timeout"`
}

func (*KeepAlive) Validate

func (c *KeepAlive) Validate() error

type Options

type Options struct {
	OverrideTLSConfig      func(cfg *tls.Config) *tls.Config
	OnNewConnection        func(conn mux.Conn)
	OnInactivityConnection func(conn mux.Conn)
	MessagePool            *pool.Pool
}

type Protocol

type Protocol string
const (
	TCP Protocol = "tcp"
	UDP Protocol = "udp"
)

type TLSConfig

type TLSConfig struct {
	Enabled                        *bool                    `yaml:"enabled,omitempty" json:"enabled,omitempty"`
	DisconnectOnExpiredCertificate bool                     `yaml:"disconnectOnExpiredCertificate" json:"disconnectOnExpiredCertificate"`
	Embedded                       certManagerServer.Config `yaml:",inline" json:",inline"`
}

func (TLSConfig) IsEnabled

func (c TLSConfig) IsEnabled() bool

IsEnabled returns true if TLS is not set or it is enabled

func (*TLSConfig) Validate

func (c *TLSConfig) Validate() error

Jump to

Keyboard shortcuts

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