service

package
v2.7.15 Latest Latest
Warning

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

Go to latest
Published: May 6, 2023 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIsConfig

type APIsConfig struct {
	COAP COAPConfig `yaml:"coap" json:"coap"`
}

func (*APIsConfig) Validate

func (c *APIsConfig) Validate() error

type COAPConfig

type COAPConfig struct {
	Addr string    `yaml:"address" json:"address"`
	TLS  TLSConfig `yaml:"tls" json:"tls"`
}

func (*COAPConfig) Validate

func (c *COAPConfig) Validate() error

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 {
	Log       LogConfig    `yaml:"log" json:"log"`
	APIs      APIsConfig   `yaml:"apis" json:"apis"`
	TaskQueue queue.Config `yaml:"taskQueue" json:"taskQueue"`
}

func (Config) String

func (c Config) String() string

func (*Config) Validate

func (c *Config) Validate() error

type LogConfig

type LogConfig struct {
	log.Config       `yaml:",inline" json:",inline"`
	DumpCoapMessages bool `yaml:"dumpCoapMessages" json:"dumpCoapMessages"`
}

Config represents application configuration

type MakeServiceHandler

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

type Option

type Option interface {
	Apply(o *ServiceHandlerConfig)
}

type PublishRequest

type PublishRequest struct {
	DeviceID       string               `json:"di"`
	Links          schema.ResourceLinks `json:"links"`
	TimeToLive     int                  `json:"ttl"`
	SequenceNumber uint64               `json:"-"`
}

type Service

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

Service is a configuration of coap-gateway

func New

func New(ctx context.Context, config Config, fileWatcher *fsnotify.Watcher, logger log.Logger, makeHandler MakeServiceHandler) (*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

func (*Service) Submit

func (s *Service) Submit(task func()) error

type ServiceHandler

type ServiceHandler interface {
	CloseOnError() bool
	SignUp(req coapgwService.CoapSignUpRequest) (coapgwService.CoapSignUpResponse, error)
	SignOff() error
	SignIn(req coapgwService.CoapSignInReq) (coapgwService.CoapSignInResp, error)
	SignOut(req coapgwService.CoapSignInReq) error
	PublishResources(req PublishRequest) error
	UnpublishResources(req UnpublishRequest) error
	RefreshToken(req coapgwService.CoapRefreshTokenReq) (coapgwService.CoapRefreshTokenResp, 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 `yaml:"enabled" json:"enabled"`
	certManagerServer.Config `yaml:",inline" json:",inline"`
}

type UnpublishRequest

type UnpublishRequest struct {
	DeviceID    string
	InstanceIDs []int64
}

type VerifyServiceHandler

type VerifyServiceHandler = func(ServiceHandler)

Jump to

Keyboard shortcuts

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