Documentation ¶
Index ¶
- type APIsConfig
- type COAPConfig
- type Client
- func (c *Client) Close() error
- func (c *Client) Context() context.Context
- func (c *Client) GetCoapConnection() *coapTcpClient.Conn
- func (c *Client) GetDeviceID() string
- func (c *Client) GetServiceHandler() ServiceHandler
- func (c *Client) OnClose()
- func (c *Client) RemoteAddrString() string
- func (c *Client) SetDeviceID(deviceID string)
- type CoapConnectionOpt
- type Config
- type GetServiceHandler
- type LogConfig
- type OnShutdown
- type Option
- type PublishRequest
- type Service
- type ServiceHandler
- type ServiceHandlerConfig
- type TLSConfig
- type UnpublishRequest
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) GetCoapConnection ¶
func (c *Client) GetCoapConnection() *coapTcpClient.Conn
func (*Client) GetDeviceID ¶
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 (*Client) SetDeviceID ¶
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"` }
type GetServiceHandler ¶ added in v2.13.1
type GetServiceHandler = func(service *Service, opts ...Option) ServiceHandler
type LogConfig ¶
type LogConfig struct { log.Config `yaml:",inline" json:",inline"` DumpCoapMessages bool `yaml:"dumpCoapMessages" json:"dumpCoapMessages"` }
Config represents application configuration
type OnShutdown ¶ added in v2.13.1
type OnShutdown = func(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, getHandler GetServiceHandler) (*Service, error)
New creates server.
func (*Service) GetClients ¶
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 ¶
Click to show internal directories.
Click to hide internal directories.