packetbrokeragent

package
v3.8.7 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2020 License: Apache-2.0 Imports: 32 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"`
	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 this cluster within a NetID and tenant"`
	TLS              TLSConfig         `name:"tls"`
	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"`
}

HomeNetworkConfig defines the configuration of the Home Network role.

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.

type TLSConfig

type TLSConfig struct {
	Source      string             `name:"source" description:"Source of the TLS certificate (file, key-vault)"`
	Certificate string             `name:"certificate" description:"Location of TLS certificate"`
	Key         string             `name:"key" description:"Location of TLS private key"`
	KeyVault    config.TLSKeyVault `name:"key-vault"`
}

TLSConfig contains TLS configuration for connecting to Packet Broker.

type TenantContextFiller

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

TenantContextFiller fills the parent context based on the tenant ID.

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