Documentation ¶
Index ¶
- func DefaultCodeToLevel(code codes.Code, logger log.Logger) func(args ...interface{})
- func MakeGetConfigForClient(tlsCfg *tls.Config) tls.Config
- func NewExchangeCache() *exchangeCache
- func NewRefreshCache() *refreshCache
- func ParsePublishedResources(data io.ReadSeeker, deviceID string) (wkRd, error)
- func PublishResourceLinks(ctx context.Context, raClient raService.ResourceAggregateClient, ...) ([]*commands.Resource, error)
- func SendResourceContentToObserver(client *Client, resourceChanged *events.ResourceChanged, observe uint32, ...)
- func ValidUntil(expiry time.Time) (validUntil int64, ok bool)
- func WantToLog(code codes.Code, logger log.Logger) bool
- type APIsConfig
- type AuthorizationConfig
- type BlockwiseTransferConfig
- type COAPConfig
- type Client
- func (client *Client) CleanUp(resetAuthContext bool) *authorizationContext
- func (client *Client) Close() error
- func (client *Client) Context() context.Context
- func (client *Client) CreateResource(ctx context.Context, event *events.ResourceCreatePending) error
- func (client *Client) Debugf(fmt string, args ...interface{})
- func (client *Client) DeleteResource(ctx context.Context, event *events.ResourceDeletePending) error
- func (client *Client) Do(req *pool.Message, correlationID string) (*pool.Message, error)
- func (client *Client) Errorf(fmt string, args ...interface{})
- func (client *Client) ErrorfRequest(req *mux.Message, fmt string, args ...interface{})
- func (client *Client) Get(ctx context.Context, path string, opts ...message.Option) (*pool.Message, error)
- func (client *Client) GetAuthorizationContext() (*authorizationContext, error)
- func (client *Client) GetContext() context.Context
- func (client *Client) GetDevicesMetadata(ctx context.Context, in *pb.GetDevicesMetadataRequest, opts ...grpc.CallOption) (pb.GrpcGateway_GetDevicesMetadataClient, error)
- func (client *Client) GetResourceLinks(ctx context.Context, in *pb.GetResourceLinksRequest, opts ...grpc.CallOption) (pb.GrpcGateway_GetResourceLinksClient, error)
- func (client *Client) Infof(fmt string, args ...interface{})
- func (client *Client) Observe(ctx context.Context, path string, observeFunc func(req *pool.Message), ...) (*tcp.Observation, error)
- func (client *Client) OnClose()
- func (client *Client) OnDeviceSubscriberReconnectError(err error)
- func (client *Client) ReleaseMessage(m *pool.Message)
- func (c *Client) ResolveDeviceID(claim pkgJwt.Claims, paramDeviceID string) string
- func (client *Client) RetrieveResource(ctx context.Context, event *events.ResourceRetrievePending) error
- func (client *Client) SetAuthorizationContext(authCtx *authorizationContext) (oldDeviceID *authorizationContext)
- func (client *Client) UpdateDeviceMetadata(ctx context.Context, event *events.DeviceMetadataUpdatePending) error
- func (client *Client) UpdateResource(ctx context.Context, event *events.ResourceUpdatePending) error
- func (c *Client) ValidateToken(ctx context.Context, token string) (pkgJwt.Claims, error)
- type ClientsConfig
- type CoapRefreshTokenReq
- type CoapRefreshTokenResp
- type CoapSignInReq
- type CoapSignInResp
- type CoapSignUpRequest
- type CoapSignUpResponse
- type Config
- type DeviceStatusExpirationConfig
- type EventBusConfig
- type GrpcServerConfig
- type IdentityStoreConfig
- type Interceptor
- type KeepAlive
- type LogConfig
- type ProvidersConfig
- type ResourceAggregateConfig
- type Service
- type TLSConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultCodeToLevel ¶ added in v2.2.4
DefaultCodeToLevel is the default implementation of gRPC return codes and interceptor log level for server side.
func NewExchangeCache ¶
func NewExchangeCache() *exchangeCache
func NewRefreshCache ¶
func NewRefreshCache() *refreshCache
func ParsePublishedResources ¶
func ParsePublishedResources(data io.ReadSeeker, deviceID string) (wkRd, error)
func PublishResourceLinks ¶
func SendResourceContentToObserver ¶
func SendResourceContentToObserver(client *Client, resourceChanged *events.ResourceChanged, observe uint32, token coapMessage.Token)
func ValidUntil ¶
ValidUntil returns time until expiration. No expiration is denoted by expiry = 0 for which 0 is returned. When expired, ok is false.
Types ¶
type APIsConfig ¶
type APIsConfig struct {
COAP COAPConfig `yaml:"coap" json:"coap"`
}
func (*APIsConfig) Validate ¶
func (c *APIsConfig) Validate() error
type AuthorizationConfig ¶
type AuthorizationConfig struct { DeviceIDClaim string `yaml:"deviceIDClaim" json:"deviceIdClaim"` OwnerClaim string `yaml:"ownerClaim" json:"ownerClaim"` Providers []ProvidersConfig `yaml:"providers" json:"providers"` }
func (*AuthorizationConfig) Validate ¶
func (c *AuthorizationConfig) Validate() error
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 COAPConfig ¶
type COAPConfig struct { Addr string `yaml:"address" json:"address"` ExternalAddress string `yaml:"externalAddress" json:"externalAddress"` MaxMessageSize uint32 `yaml:"maxMessageSize" json:"maxMessageSize"` OwnerCacheExpiration time.Duration `yaml:"ownerCacheExpiration" json:"ownerCacheExpiration"` SubscriptionBufferSize int `yaml:"subscriptionBufferSize" json:"subscriptionBufferSize"` MessagePoolSize int `yaml:"messagePoolSize" json:"messagePoolSize"` KeepAlive KeepAlive `yaml:"keepAlive" json:"keepAlive"` BlockwiseTransfer BlockwiseTransferConfig `yaml:"blockwiseTransfer" json:"blockwiseTransfer"` TLS TLSConfig `yaml:"tls" json:"tls"` Authorization AuthorizationConfig `yaml:"authorization" json:"authorization"` }
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) CreateResource ¶
func (*Client) DeleteResource ¶
func (*Client) ErrorfRequest ¶ added in v2.2.4
func (*Client) GetAuthorizationContext ¶
func (*Client) GetContext ¶
func (*Client) GetDevicesMetadata ¶ added in v2.2.4
func (client *Client) GetDevicesMetadata(ctx context.Context, in *pb.GetDevicesMetadataRequest, opts ...grpc.CallOption) (pb.GrpcGateway_GetDevicesMetadataClient, error)
func (*Client) GetResourceLinks ¶ added in v2.2.4
func (client *Client) GetResourceLinks(ctx context.Context, in *pb.GetResourceLinksRequest, opts ...grpc.CallOption) (pb.GrpcGateway_GetResourceLinksClient, error)
func (*Client) OnClose ¶
func (client *Client) OnClose()
OnClose action when coap connection was closed.
func (*Client) OnDeviceSubscriberReconnectError ¶
func (*Client) ReleaseMessage ¶ added in v2.2.4
func (*Client) ResolveDeviceID ¶
func (*Client) RetrieveResource ¶
func (*Client) SetAuthorizationContext ¶
func (client *Client) SetAuthorizationContext(authCtx *authorizationContext) (oldDeviceID *authorizationContext)
func (*Client) UpdateDeviceMetadata ¶
func (*Client) UpdateResource ¶
type ClientsConfig ¶
type ClientsConfig struct { Eventbus EventBusConfig `yaml:"eventBus" json:"eventBus"` IdentityStore IdentityStoreConfig `yaml:"identityStore" json:"identityStore"` ResourceAggregate ResourceAggregateConfig `yaml:"resourceAggregate" json:"resourceAggregate"` ResourceDirectory GrpcServerConfig `yaml:"resourceDirectory" json:"resourceDirectory"` }
func (*ClientsConfig) Validate ¶
func (c *ClientsConfig) Validate() 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 { Log LogConfig `yaml:"log" json:"log"` APIs APIsConfig `yaml:"apis" json:"apis"` Clients ClientsConfig `yaml:"clients" json:"clients"` TaskQueue queue.Config `yaml:"taskQueue" json:"taskQueue"` }
Config represent application configuration
type DeviceStatusExpirationConfig ¶
type DeviceStatusExpirationConfig struct { Enabled bool `yaml:"enabled" json:"enabled"` ExpiresIn time.Duration `yaml:"expiresIn" json:"expiresIn"` }
func (*DeviceStatusExpirationConfig) Validate ¶
func (c *DeviceStatusExpirationConfig) Validate() error
type EventBusConfig ¶
type EventBusConfig struct {
NATS natsClient.Config `yaml:"nats" json:"nats"`
}
func (*EventBusConfig) Validate ¶
func (c *EventBusConfig) Validate() error
type GrpcServerConfig ¶
func (*GrpcServerConfig) Validate ¶
func (c *GrpcServerConfig) Validate() error
type IdentityStoreConfig ¶
func (*IdentityStoreConfig) Validate ¶
func (c *IdentityStoreConfig) Validate() error
type Interceptor ¶
type LogConfig ¶
type LogConfig struct { DumpBody bool `yaml:"dumpBody" json:"dumpBody"` log.Config `yaml:",inline"` }
Config represent application configuration
type ProvidersConfig ¶
type ResourceAggregateConfig ¶
type ResourceAggregateConfig struct { Connection client.Config `yaml:"grpc" json:"grpc"` DeviceStatusExpiration DeviceStatusExpirationConfig `yaml:"deviceStatusExpiration" json:"deviceStatusExpiration"` }
func (*ResourceAggregateConfig) Validate ¶
func (c *ResourceAggregateConfig) Validate() error
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is a configuration of coap-gateway
func (*Service) ValidateToken ¶
Source Files ¶
- auth.go
- client.go
- clientCreateHandler.go
- clientDeleteHandler.go
- clientLogAndWriteErrorResponse.go
- clientObserveHandler.go
- clientObserver.go
- clientResetHandler.go
- clientRetrieveHandler.go
- clientSendResponse.go
- clientSubscriber.go
- clientUpdateHandler.go
- config.go
- devicesStatusUpdater.go
- exchangeCache.go
- log.go
- refreshCache.go
- refreshToken.go
- resourceDirectory.go
- resourceDiscovery.go
- resourceRouteHandler.go
- service.go
- signIn.go
- signOff.go
- signUp.go
- validUntil.go
Click to show internal directories.
Click to hide internal directories.