packetbrokeragent

package
v3.10.7 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	*component.Component
	// contains filtered or unexported fields
}

Agent implements the Packet Broker Agent component, acting as Home Network.

Agent exposes the GsPba and NsPba interfaces for forwarding uplink and subscribing to uplink.

func New

func New(c *component.Component, conf *Config, opts ...Option) (*Agent, error)

New returns a new Packet Broker Agent.

func (*Agent) Context

func (a *Agent) Context() context.Context

Context returns the context.

func (*Agent) RegisterHandlers

func (a *Agent) RegisterHandlers(s *runtime.ServeMux, conn *grpc.ClientConn)

RegisterHandlers registers gRPC handlers.

func (*Agent) RegisterServices

func (a *Agent) RegisterServices(s *grpc.Server)

RegisterServices registers services provided by a at s.

func (*Agent) Roles

func (a *Agent) Roles() []ttnpb.ClusterRole

Roles returns the Packet Broker Agent cluster role.

type Config

type Config struct {
	DataPlaneAddress     string               `name:"data-plane-address" description:"Address of the Packet Broker Data Plane"`
	Insecure             bool                 `name:"insecure" description:"Connect without using TLS"`
	NetID                types.NetID          `name:"net-id" description:"LoRa Alliance NetID"`
	TenantID             string               `name:"tenant-id" description:"Tenant ID within the NetID"`
	ClusterID            string               `name:"cluster-id" description:"Cluster ID uniquely identifying the Forwarder in the NetID and Tenant ID"`
	HomeNetworkClusterID string               `name:"home-network-cluster-id" description:"Home Network Cluster ID, if different from the Cluster ID"`
	AuthenticationMode   string               `name:"authentication-mode" description:"Authentication mode (tls, oauth2)"`
	TLS                  tlsconfig.ClientAuth `name:"tls" description:"TLS client certificate (DEPRECATED)"`
	OAuth2               OAuth2Config         `name:"oauth2" description:"OAuth 2.0 configuration"`
	Forwarder            ForwarderConfig      `name:"forwarder" description:"Forwarder configuration for publishing uplink messages and subscribing to downlink messages"`
	HomeNetwork          HomeNetworkConfig    `name:"home-network" description:"Home Network configuration for subscribing to uplink and publishing downlink messages"`
}

Config configures Packet Broker clients.

type ForwarderConfig

type ForwarderConfig struct {
	Enable         bool             `name:"enable" description:"Enable Forwarder role"`
	WorkerPool     WorkerPoolConfig `name:"worker-pool" description:"Workers pool configuration"`
	TokenKey       []byte           `name:"token-key" description:"AES 128 or 256-bit key for encrypting tokens"`
	TokenEncrypter jose.Encrypter   `name:"-"`
}

ForwarderConfig defines configuration of the Forwarder role.

type HomeNetworkConfig

type HomeNetworkConfig struct {
	Enable             bool                  `name:"enable" description:"Enable Home Network role"`
	DevAddrPrefixes    []types.DevAddrPrefix `name:"dev-addr-prefixes" description:"DevAddr prefixes to subscribe to"`
	WorkerPool         WorkerPoolConfig      `name:"worker-pool" description:"Workers pool configuration"`
	BlacklistForwarder bool                  `name:"blacklist-forwarder" description:"Blacklist traffic from Forwarder to avoid traffic loops (DEPRECATED)"`
}

HomeNetworkConfig defines the configuration of the Home Network role.

type OAuth2Config added in v3.10.6

type OAuth2Config struct {
	ClientID     string `name:"client-id" description:"API key ID used as client ID"`
	ClientSecret string `name:"client-secret" description:"Secret API key value used as client secret"`
	TokenURL     string `name:"token-url" description:"Token URL"`
}

OAuth2Config defines OAuth 2.0 configuration for authentication.

type Option

type Option func(*Agent)

Option configures Agent.

func WithTenantContextFiller

func WithTenantContextFiller(filler TenantContextFiller) Option

WithTenantContextFiller returns an Option that appends the given filler to the end device identifiers context fillers.

func WithTenantExtractor added in v3.10.6

func WithTenantExtractor(extractor TenantExtractor) Option

WithTenantExtractor returns an Option that configures the Agent to use the given tenant extractor.

type TenantContextFiller

type TenantContextFiller func(parent context.Context, tenantID string) (context.Context, error)

TenantContextFiller fills the parent context based on the tenant ID.

type TenantExtractor added in v3.10.6

type TenantExtractor func(context context.Context) string

TenantExtractor extracts the tenant ID from the context.

type WorkerPoolConfig

type WorkerPoolConfig struct {
	Limit int `name:"limit" description:"Limit of active workers"`
}

WorkerPoolConfig contains the worker pool configuration for a Packet Broker role.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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