service

package
v2.5.3 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client a setup of connection

func (*Client) Close

func (c *Client) Close() error

Close closes coap connection

func (*Client) Context

func (c *Client) Context() context.Context

func (*Client) GetCoapConnection

func (c *Client) GetCoapConnection() *coapTcpClient.Conn

func (*Client) GetDeviceID

func (c *Client) GetDeviceID() string

func (*Client) GetServiceHandler

func (c *Client) GetServiceHandler() ServiceHandler

func (*Client) OnClose

func (c *Client) OnClose()

OnClose is invoked when the coap connection was closed.

func (*Client) RemoteAddrString

func (c *Client) RemoteAddrString() string

func (*Client) SetDeviceID

func (c *Client) SetDeviceID(deviceID string)

type CoapConnectionOpt

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

func WithCoapConnectionOpt

func WithCoapConnectionOpt(c *client.Conn) CoapConnectionOpt

func (CoapConnectionOpt) Apply

func (o CoapConnectionOpt) Apply(opts *ServiceHandlerConfig)

type Config

type Config struct {
	Addr string
	TLS  TLSConfig
}

type GetServiceHandler

type GetServiceHandler = func(service *Service, opts ...Option) ServiceHandler

type OnShutdown

type OnShutdown = func(ServiceHandler)

type Option

type Option interface {
	Apply(o *ServiceHandlerConfig)
}

type Service

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

Service is a configuration of coap-gateway

func New

func New(ctx context.Context, cfg Config, getHandler GetServiceHandler) (*Service, error)

New creates server.

func (*Service) Close

func (s *Service) Close() error

Close turns off the server.

func (*Service) GetClients

func (s *Service) GetClients() []*Client

func (*Service) Serve

func (s *Service) Serve() error

type ServiceHandlerConfig

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

func (*ServiceHandlerConfig) GetCoapConnection

func (s *ServiceHandlerConfig) GetCoapConnection() *client.Conn

type TLSConfig

type TLSConfig struct {
	Enabled bool
	*tls.Config
}

Jump to

Keyboard shortcuts

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