Documentation ¶
Index ¶
- type ApplicationPackagesConfig
- type ApplicationServer
- func (as *ApplicationServer) Context() context.Context
- func (as *ApplicationServer) DeleteLink(ctx context.Context, ids *ttnpb.ApplicationIdentifiers) (*types.Empty, error)
- func (as *ApplicationServer) DownlinkQueueList(ctx context.Context, ids ttnpb.EndDeviceIdentifiers) ([]*ttnpb.ApplicationDownlink, error)
- func (as *ApplicationServer) DownlinkQueuePush(ctx context.Context, ids ttnpb.EndDeviceIdentifiers, ...) error
- func (as *ApplicationServer) DownlinkQueueReplace(ctx context.Context, ids ttnpb.EndDeviceIdentifiers, ...) error
- func (as *ApplicationServer) GetConfig(ctx context.Context) (*Config, error)
- func (as *ApplicationServer) GetLink(ctx context.Context, req *ttnpb.GetApplicationLinkRequest) (*ttnpb.ApplicationLink, error)
- func (as *ApplicationServer) GetLinkStats(ctx context.Context, ids *ttnpb.ApplicationIdentifiers) (*ttnpb.ApplicationLinkStats, error)
- func (as *ApplicationServer) GetMQTTConfig(ctx context.Context) (*config.MQTT, error)
- func (as *ApplicationServer) HandleUplink(ctx context.Context, req *ttnpb.NsAsHandleUplinkRequest) (*types.Empty, error)
- func (as *ApplicationServer) Publish(ctx context.Context, up *ttnpb.ApplicationUp) error
- func (as *ApplicationServer) RegisterHandlers(s *runtime.ServeMux, conn *grpc.ClientConn)
- func (as *ApplicationServer) RegisterServices(s *grpc.Server)
- func (as *ApplicationServer) Roles() []ttnpb.ClusterRole
- func (as *ApplicationServer) SetLink(ctx context.Context, req *ttnpb.SetApplicationLinkRequest) (*ttnpb.ApplicationLink, error)
- func (as *ApplicationServer) Subscribe(ctx context.Context, protocol string, ids *ttnpb.ApplicationIdentifiers, ...) (*io.Subscription, error)
- type Config
- type DeviceRegistry
- type DistributionConfig
- type EndDeviceFetcher
- type EndDeviceFetcherCacheConfig
- type EndDeviceFetcherConfig
- type InteropClient
- type InteropConfig
- type LinkRegistry
- type NoopEndDeviceFetcher
- type PubSubConfig
- type WebhooksConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplicationPackagesConfig ¶
type ApplicationPackagesConfig struct { packages.Config `name:",squash"` Registry packages.Registry `name:"-"` }
ApplicationPackagesConfig contains application packages associations configuration.
func (ApplicationPackagesConfig) NewApplicationPackages ¶
func (c ApplicationPackagesConfig) NewApplicationPackages(ctx context.Context, server io.Server) (packages.Server, error)
NewApplicationPackages returns a new applications packages frontend based on the configuration. If the registry is nil, it returns nil.
type ApplicationServer ¶
ApplicationServer implements the Application Server component.
The Application Server exposes the As, AppAs and AsEndDeviceRegistry services.
func New ¶
func New(c *component.Component, conf *Config) (as *ApplicationServer, err error)
New returns new *ApplicationServer.
func (*ApplicationServer) Context ¶
func (as *ApplicationServer) Context() context.Context
Context returns the context of the Application Server.
func (*ApplicationServer) DeleteLink ¶
func (as *ApplicationServer) DeleteLink(ctx context.Context, ids *ttnpb.ApplicationIdentifiers) (*types.Empty, error)
DeleteLink implements ttnpb.AsServer.
func (*ApplicationServer) DownlinkQueueList ¶
func (as *ApplicationServer) DownlinkQueueList(ctx context.Context, ids ttnpb.EndDeviceIdentifiers) ([]*ttnpb.ApplicationDownlink, error)
DownlinkQueueList lists the application downlink queue of the given end device.
func (*ApplicationServer) DownlinkQueuePush ¶
func (as *ApplicationServer) DownlinkQueuePush(ctx context.Context, ids ttnpb.EndDeviceIdentifiers, items []*ttnpb.ApplicationDownlink) error
DownlinkQueuePush pushes the given downlink messages to the end device's application downlink queue. This operation changes FRMPayload in the given items.
func (*ApplicationServer) DownlinkQueueReplace ¶
func (as *ApplicationServer) DownlinkQueueReplace(ctx context.Context, ids ttnpb.EndDeviceIdentifiers, items []*ttnpb.ApplicationDownlink) error
DownlinkQueueReplace replaces the end device's application downlink queue with the given downlink messages. This operation changes FRMPayload in the given items.
func (*ApplicationServer) GetConfig ¶
func (as *ApplicationServer) GetConfig(ctx context.Context) (*Config, error)
GetConfig returns the Application Server config based on the context.
func (*ApplicationServer) GetLink ¶
func (as *ApplicationServer) GetLink(ctx context.Context, req *ttnpb.GetApplicationLinkRequest) (*ttnpb.ApplicationLink, error)
GetLink implements ttnpb.AsServer.
func (*ApplicationServer) GetLinkStats ¶
func (as *ApplicationServer) GetLinkStats(ctx context.Context, ids *ttnpb.ApplicationIdentifiers) (*ttnpb.ApplicationLinkStats, error)
GetLinkStats implements ttnpb.AsServer.
func (*ApplicationServer) GetMQTTConfig ¶
GetMQTTConfig returns the MQTT frontend configuration based on the context.
func (*ApplicationServer) HandleUplink ¶ added in v3.11.0
func (as *ApplicationServer) HandleUplink(ctx context.Context, req *ttnpb.NsAsHandleUplinkRequest) (*types.Empty, error)
HandleUplink implements ttnpb.NsAsServer.
func (*ApplicationServer) Publish ¶ added in v3.11.0
func (as *ApplicationServer) Publish(ctx context.Context, up *ttnpb.ApplicationUp) error
Publish processes the given upstream message and then publishes it to the application frontends.
func (*ApplicationServer) RegisterHandlers ¶
func (as *ApplicationServer) RegisterHandlers(s *runtime.ServeMux, conn *grpc.ClientConn)
RegisterHandlers registers gRPC handlers.
func (*ApplicationServer) RegisterServices ¶
func (as *ApplicationServer) RegisterServices(s *grpc.Server)
RegisterServices registers services provided by as at s.
func (*ApplicationServer) Roles ¶
func (as *ApplicationServer) Roles() []ttnpb.ClusterRole
Roles returns the roles that the Application Server fulfills.
func (*ApplicationServer) SetLink ¶
func (as *ApplicationServer) SetLink(ctx context.Context, req *ttnpb.SetApplicationLinkRequest) (*ttnpb.ApplicationLink, error)
SetLink implements ttnpb.AsServer.
func (*ApplicationServer) Subscribe ¶
func (as *ApplicationServer) Subscribe(ctx context.Context, protocol string, ids *ttnpb.ApplicationIdentifiers, cluster bool) (*io.Subscription, error)
Subscribe subscribes an application or integration by its identifiers to the Application Server, and returns a Subscription for traffic and control. If the cluster parameter is true, the subscription receives all of the traffic of the application. Otherwise, only traffic that was processed locally is sent.
type Config ¶
type Config struct { LinkMode string `name:"link-mode" description:"Deprecated - mode to link applications to their Network Server (all, explicit)"` Devices DeviceRegistry `name:"-"` Links LinkRegistry `name:"-"` Distribution DistributionConfig `name:"distribution" description:"Distribution configuration"` EndDeviceFetcher EndDeviceFetcherConfig `name:"fetcher" description:"End Device fetcher configuration"` MQTT config.MQTT `name:"mqtt" description:"MQTT configuration"` Webhooks WebhooksConfig `name:"webhooks" description:"Webhooks configuration"` PubSub PubSubConfig `name:"pubsub" description:"Pub/sub messaging configuration"` Packages ApplicationPackagesConfig `name:"packages" description:"Application packages configuration"` Interop InteropConfig `name:"interop" description:"Interop client configuration"` DeviceKEKLabel string `name:"device-kek-label" description:"Label of KEK used to encrypt device keys at rest"` }
Config represents the ApplicationServer configuration.
type DeviceRegistry ¶
type DeviceRegistry interface { // Get returns the end device by its identifiers. Get(ctx context.Context, ids ttnpb.EndDeviceIdentifiers, paths []string) (*ttnpb.EndDevice, error) // Set creates, updates or deletes the end device by its identifiers. Set(ctx context.Context, ids ttnpb.EndDeviceIdentifiers, paths []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) }
DeviceRegistry is a store for end devices.
type DistributionConfig ¶ added in v3.11.0
type DistributionConfig struct { PubSub distribution.PubSub `name:"-"` Timeout time.Duration `name:"timeout" description:"Wait timeout of an empty subscription set"` }
DistributionConfig contains the upstream traffic distribution configuration of the Application Server.
type EndDeviceFetcher ¶ added in v3.10.0
type EndDeviceFetcher interface {
Get(ctx context.Context, ids ttnpb.EndDeviceIdentifiers, fieldMaskPaths ...string) (*ttnpb.EndDevice, error)
}
EndDeviceFetcher fetches end device protos.
func NewCachedEndDeviceFetcher ¶ added in v3.10.0
func NewCachedEndDeviceFetcher(fetcher EndDeviceFetcher, cache gcache.Cache) EndDeviceFetcher
NewCachedEndDeviceFetcher wraps an EndDeviceFetcher with a local cache.
func NewRegistryEndDeviceFetcher ¶ added in v3.10.0
func NewRegistryEndDeviceFetcher(c *component.Component) EndDeviceFetcher
NewRegistryEndDeviceFetcher returns a new endDeviceFetcher.
type EndDeviceFetcherCacheConfig ¶ added in v3.10.0
type EndDeviceFetcherCacheConfig struct { Enable bool `name:"enable" description:"Cache fetched end devices"` TTL time.Duration `name:"ttl" description:"TTL for cached end devices"` Size int `name:"size" description:"Cache size"` }
EndDeviceFetcherCacheConfig represents configuration for device information caching in Application Server.
type EndDeviceFetcherConfig ¶ added in v3.10.0
type EndDeviceFetcherConfig struct { Fetcher EndDeviceFetcher `name:"-"` Cache EndDeviceFetcherCacheConfig `name:"cache" description:"Cache configuration options for the end device fetcher"` }
EndDeviceFetcherConfig represents configuration for the end device fetcher in Application Server.
func (EndDeviceFetcherConfig) NewFetcher ¶ added in v3.10.0
func (c EndDeviceFetcherConfig) NewFetcher(comp *component.Component) (EndDeviceFetcher, error)
NewFetcher creates an EndDeviceFetcher from config.
type InteropClient ¶
type InteropClient interface {
GetAppSKey(ctx context.Context, asID string, req *ttnpb.SessionKeyRequest) (*ttnpb.AppSKeyResponse, error)
}
InteropClient is a client, which Application Server can use for interoperability.
type InteropConfig ¶
type InteropConfig struct { config.InteropClient `name:",squash"` ID string `name:"id" description:"AS-ID used for interoperability"` }
InteropConfig represents interoperability client configuration.
type LinkRegistry ¶
type LinkRegistry interface { // Get returns the link by the application identifiers. Get(ctx context.Context, ids ttnpb.ApplicationIdentifiers, paths []string) (*ttnpb.ApplicationLink, error) // Range ranges the links and calls the callback function, until false is returned. Range(ctx context.Context, paths []string, f func(context.Context, ttnpb.ApplicationIdentifiers, *ttnpb.ApplicationLink) bool) error // Set creates, updates or deletes the link by the application identifiers. Set(ctx context.Context, ids ttnpb.ApplicationIdentifiers, paths []string, f func(*ttnpb.ApplicationLink) (*ttnpb.ApplicationLink, []string, error)) (*ttnpb.ApplicationLink, error) }
LinkRegistry is a store for application links.
type NoopEndDeviceFetcher ¶ added in v3.10.0
type NoopEndDeviceFetcher struct{}
NoopEndDeviceFetcher is a no-op.
type PubSubConfig ¶
PubSubConfig contains go-cloud pub/sub configuration of the Application Server.
type WebhooksConfig ¶
type WebhooksConfig struct { Registry web.WebhookRegistry `name:"-"` Target string `name:"target" description:"Target of the integration (direct)"` Timeout time.Duration `name:"timeout" description:"Wait timeout of the target to process the request"` QueueSize int `name:"queue-size" description:"Number of requests to queue"` Workers int `name:"workers" description:"Number of workers to process requests"` Templates web.TemplatesConfig `name:"templates" description:"The store of the webhook templates"` Downlinks web.DownlinksConfig `name:"downlink" description:"The downlink queue operations configuration"` }
WebhooksConfig defines the configuration of the webhooks integration.
func (WebhooksConfig) NewWebhooks ¶
NewWebhooks returns a new web.Webhooks based on the configuration. If Target is empty, this method returns nil.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
mqtt
Package mqtt implements the MQTT frontend.
|
Package mqtt implements the MQTT frontend. |
pubsub
Package pubsub implements the go-cloud pub/sub frontend.
|
Package pubsub implements the go-cloud pub/sub frontend. |
pubsub/provider/mock
Package mock implements a mock pub/sub provider using the mempubsub driver.
|
Package mock implements a mock pub/sub provider using the mempubsub driver. |
pubsub/provider/mqtt
Package mqtt implements the MQTT provider using the mqtt driver.
|
Package mqtt implements the MQTT provider using the mqtt driver. |
pubsub/provider/nats
Package nats implements the NATS provider using the natspubsub driver.
|
Package nats implements the NATS provider using the natspubsub driver. |
web
Package web implements the webhooks integration.
|
Package web implements the webhooks integration. |