packetbrokeragent

package
v0.0.0-...-60b8695 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: Apache-2.0 Imports: 39 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 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"`
	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 ContactInfoConfig

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

func (ContactInfoConfig) ContactInfo

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

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)"`
}

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"`
}

HomeNetworkConfig defines the configuration of the Home Network role.

type OAuth2Config

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

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

func WithTenantIDExtractor(extractor TenantIDExtractor) Option

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

type RegistrationConfig

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"`
}

type RegistrationInfo

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

RegistrationInfo contains information about a Packet Broker registration.

type RegistrationInfoExtractor

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

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