packetbrokeragent

package
v3.18.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultGatewayOnlineTTL = 10 * time.Minute

DefaultGatewayOnlineTTL is the default time-to-live of the online status reported to Packet Broker. Packet Broker Agent must bump the online status before the previous online status expires, to keep the gateway marked online. A low value results in more calls to Packet Broker Mapper to keep gateways online. A high value results in a longer time until gateways that go offline will be marked offline on the map.

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 Pba interface for Packet Broker registration and routing policy management. Agent also 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 {
	Registration         RegistrationConfig `name:"registration" description:"Registration with Packet Broker"`
	IAMAddress           string             `name:"iam-address" description:"Address of Packet Broker IAM"`
	ControlPlaneAddress  string             `name:"control-plane-address" description:"Address of Packet Broker Control Plane"`
	DataPlaneAddress     string             `name:"data-plane-address" description:"Address of the Packet Broker Data Plane"`
	MapperAddress        string             `name:"mapper-address" description:"Address of Packet Broker Mapper"`
	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 (oauth2)"`
	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 ContactInfoConfig added in v3.12.0

type ContactInfoConfig struct {
	Email string `name:"email" description:"Email address"`
}

ContactInfoConfig defines contact info for Packet Broker.

func (ContactInfoConfig) ContactInfo added in v3.12.0

func (c ContactInfoConfig) ContactInfo(contactType ttnpb.ContactType) *ttnpb.ContactInfo

ContactInfo returns a ContactInfo proto for the configuration.

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:"-"`
	IncludeGatewayEUI bool             `name:"include-gateway-eui" description:"Include the gateway EUI in forwarded metadata"`
	IncludeGatewayID  bool             `name:"include-gateway-id" description:"Include the gateway ID in forwarded metadata"`
	HashGatewayID     bool             `name:"hash-gateway-id" description:"Hash the gateway ID (if forwarded in the metadata)"`
	GatewayOnlineTTL  time.Duration    `name:"gateway-online-ttl" description:"Time-to-live of online status reported to Packet Broker"`
}

ForwarderConfig defines configuration of the Forwarder role.

type GetFrequencyPlansStore added in v3.17.0

type GetFrequencyPlansStore func(ctx context.Context) (frequencyPlansStore, error)

GetFrequencyPlansStore defines a function that returns the frequencyPlansStore interface

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"`
	IncludeHops     bool                  `name:"include-hops" description:"Include hops in the metadata"`
}

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 WithRegistrationInfo added in v3.12.0

func WithRegistrationInfo(extractor RegistrationInfoExtractor) Option

WithRegistrationInfo returns an Option that configures the Agent to use the given registration information extractor.

func WithTenantContextFiller

func WithTenantContextFiller(filler TenantContextFiller) Option

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

func WithTenantIDExtractor added in v3.12.0

func WithTenantIDExtractor(extractor TenantIDExtractor) Option

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

type RegistrationConfig added in v3.12.0

type RegistrationConfig struct {
	Name                  string            `name:"name" description:"Friendly name to register with Packet Broker"`
	AdministrativeContact ContactInfoConfig `name:"administrative-contact" description:"Administrative contact to register with Packet Broker"`
	TechnicalContact      ContactInfoConfig `name:"technical-contact" description:"Technical contact to register with Packet Broker"`
	Listed                bool              `name:"listed" description:"List the Home Network in the Packet Broker catalog"`
}

RegistrationConfig defines the registration configuration for Packet Broker.

type RegistrationInfo added in v3.12.0

type RegistrationInfo struct {
	Name          string
	DevAddrBlocks []*ttnpb.PacketBrokerDevAddrBlock
	ContactInfo   []*ttnpb.ContactInfo
	Listed        bool
}

RegistrationInfo contains information about a Packet Broker registration.

type RegistrationInfoExtractor added in v3.12.0

type RegistrationInfoExtractor func(ctx context.Context, homeNetworkClusterID string) (*RegistrationInfo, error)

RegistrationInfoExtractor extracts registration information from the context.

type TenantContextFiller

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

TenantContextFiller fills the parent context based on the tenant ID.

type TenantIDExtractor added in v3.12.0

type TenantIDExtractor func(ctx context.Context) string

TenantIDExtractor 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