Documentation ¶
Index ¶
- func NewClientContainerByDeviceId() *clientContainerByDeviceId
- func NewObserveResourceContainer() *observeResourceContainer
- func NewUpdateNotificationContainer() *updateNotificationContainer
- func SendResourceContentToObserver(s gocoap.ResponseWriter, client *Client, contentCtx contentCtx, observe uint32, ...)
- func URIToDeviceIdHref(msg gocoap.Message) (deviceId, href string, err error)
- type Client
- func (client *Client) Close() error
- func (client *Client) OnClose()
- func (client *Client) PublishCloudDeviceStatus(ctx context.Context, deviceID string, authContext pbCQRS.AuthorizationContext) error
- func (client *Client) UpdateCloudDeviceStatus(ctx context.Context, deviceID string, authContext pbCQRS.AuthorizationContext, ...) error
- type ClientContainer
- type CoapClientCertificateVerifier
- type CoapRefreshTokenReq
- type CoapRefreshTokenResp
- type CoapSignInReq
- type CoapSignInResp
- type CoapSignUpRequest
- type CoapSignUpResponse
- type Config
- type Keepalive
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClientContainerByDeviceId ¶
func NewClientContainerByDeviceId() *clientContainerByDeviceId
func NewObserveResourceContainer ¶
func NewObserveResourceContainer() *observeResourceContainer
func NewUpdateNotificationContainer ¶
func NewUpdateNotificationContainer() *updateNotificationContainer
func SendResourceContentToObserver ¶
func SendResourceContentToObserver(s gocoap.ResponseWriter, client *Client, contentCtx contentCtx, observe uint32, path string)
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client a setup of connection
func (*Client) OnClose ¶
func (client *Client) OnClose()
OnClose action when coap connection was closed.
func (*Client) PublishCloudDeviceStatus ¶
func (*Client) UpdateCloudDeviceStatus ¶
type ClientContainer ¶
type ClientContainer struct {
// contains filtered or unexported fields
}
ClientContainer client <-> server connections
func (*ClientContainer) Add ¶
func (c *ClientContainer) Add(remoteAddr string, client *Client)
func (*ClientContainer) Find ¶
func (c *ClientContainer) Find(remoteAddr string) *Client
type CoapClientCertificateVerifier ¶
type CoapClientCertificateVerifier struct {
// contains filtered or unexported fields
}
func NewCoapClientCertificateVerifier ¶
func NewCoapClientCertificateVerifier(cacheTimeout time.Duration) *CoapClientCertificateVerifier
func (*CoapClientCertificateVerifier) PopCachedDeviceId ¶
func (c *CoapClientCertificateVerifier) PopCachedDeviceId(remoteAddr string) (string, bool)
func (*CoapClientCertificateVerifier) Verify ¶
func (c *CoapClientCertificateVerifier) Verify(conn net.Conn, cert *x509.Certificate) error
type CoapRefreshTokenReq ¶
type CoapRefreshTokenResp ¶
type CoapSignInReq ¶
type CoapSignInResp ¶
type CoapSignInResp struct {
ExpiresIn int64 `json:"expiresin"`
}
type CoapSignUpRequest ¶
type CoapSignUpResponse ¶
type Config ¶
type Config struct { KeepaliveTime time.Duration `envconfig:"KEEPALIVE_TIME" default:"20s"` KeepaliveInterval time.Duration `envconfig:"KEEPALIVE_INTERVAL" default:"5s"` KeepaliveRetry int `envconfig:"KEEPALIVE_RETRY" default:"3"` FQDN string `envconfig:"FQDN" default:"gw1.ocf.cloud"` ExternalPort uint16 `envconfig:"EXTERNAL_PORT" default:"5684"` Addr string `envconfig:"ADDRESS" default:"0.0.0.0:5684"` Net string `envconfig:"NETWORK" default:"tcp"` AuthHost string `envconfig:"AUTH_HOST" default:"127.0.0.1:7000"` ResourceAggregateHost string `envconfig:"RESOURCE_AGGREGATE_HOST" default:"127.0.0.1:9083"` ResourceDirectoryHost string `envconfig:"RESOURCE_DIRECTORY_HOST" default:"127.0.0.1:9082"` QueriesTreshold int `envconfig:"QUERIES_TRESHOLD" default:"256"` TimeoutForRequests time.Duration `envconfig:"TIMEOUT_FOR_REQUESTS" default:"10s"` DisableTCPSignalMessages bool `envconfig:"DISABLE_TCP_SIGNAL_MESSAGES" default:"false"` SendErrorTextInResponse bool `envconfig:"SEND_ERROR_TEXT_IN_RESPONSE" default:"true"` TLSConfig security.TLSConfig }
config for application
type Keepalive ¶
type Keepalive struct {
// contains filtered or unexported fields
}
Keepalive setup of keepalive
func NewKeepalive ¶
func NewKeepalive(server *Server, client *gocoap.ClientConn) *Keepalive
NewKeepalive create new Keepalive instance and start check of connection
type Server ¶
type Server struct { FQDN string // fully qualified domain name of GW ExternalPort uint16 // used to construct oic/res response Addr string // Address to listen on, ":COAP" if empty. Net string // if "tcp" or "tcp-tls" (COAP over TLS) it will invoke a TCP listener, otherwise an UDP one DisableTCPSignalMessages bool SendErrorTextInResponse bool TimeoutForRequests time.Duration // contains filtered or unexported fields }
Server a configuration of coapgateway
func New ¶
func New(config Config, store eventstore.EventStore, subscriber eventbus.Subscriber, pool *ants.Pool) *Server
NewServer setup coap gateway
func (*Server) ListenAndServe ¶
ListenAndServe starts a coapgateway on the configured address in *Server.
Source Files ¶
- client.go
- clientContainer.go
- clientContainerByDeviceId.go
- clientObserveHandler.go
- clientResetHandler.go
- clientRetrieveHandler.go
- clientUpdateHandler.go
- config.go
- decodeMsgToDebug.go
- deviceCloudStatus.go
- keepalive.go
- logAndWriteErrorResponse.go
- observeResourceContainer.go
- ping.go
- projection.go
- refreshToken.go
- resourceDirectory.go
- resourceDiscovery.go
- resourceRouteHandler.go
- security.go
- server.go
- signIn.go
- signUp.go
- updateNotificationContainer.go
Click to show internal directories.
Click to hide internal directories.