enddevices

package
v3.31.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package enddevices provides functions to configure End Device claiming clients.

Index

Constants

View Source
const JSClientConfigurationName = "config.yml"

JSClientConfigurationName is the filename of Join Server client configuration.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component interface {
	httpclient.Provider
	KeyService() crypto.KeyService
	GetBaseConfig(ctx context.Context) config.ServiceBase
	GetPeerConn(ctx context.Context, role ttnpb.ClusterRole, ids cluster.EntityIdentifiers) (*grpc.ClientConn, error)
	AllowInsecureForCredentials() bool
}

Component abstracts the underlying *component.Component.

type Config

type Config struct {
	NetID types.NetID  `name:"net-id" description:"NetID of the Network Server to configure when claiming"`
	NSID  *types.EUI64 `name:"ns-id" description:"NSID of the Network Server to configure when claiming"`
	ASID  string       `name:"as-id" description:"AS-ID of the Application Server to configure when claiming"`

	// TODO: Remove (https://github.com/TheThingsNetwork/lorawan-stack/issues/6048)
	NetworkServer NetworkServer `name:"network-server" description:"DEPRECATED"`

	Source    string                `name:"source" description:"Source of the file containing Join Server settings (directory, url, blob)"`
	Directory string                `name:"directory" description:"OS filesystem directory, which contains the config.yml and the client-specific files"`
	URL       string                `name:"url" description:"URL, which contains Join Server client configuration"`
	Blob      config.BlobPathConfig `name:"blob"`
}

Config contains options for end device claiming clients.

func (Config) Fetcher

func (c Config) Fetcher(
	ctx context.Context, blobConf config.BlobConfig, httpClientProvider httpclient.Provider,
) (fetch.Interface, error)

Fetcher returns a fetch.Interface based on the configuration. If no configuration source is set, this method returns nil, nil.

type EndDeviceClaimer

type EndDeviceClaimer interface {
	// SupportsJoinEUI returns whether the Join Server supports this JoinEUI.
	SupportsJoinEUI(joinEUI types.EUI64) bool
	// Claim claims an End Device.
	Claim(ctx context.Context, joinEUI, devEUI types.EUI64, claimAuthenticationCode string) error
	// GetClaimStatus returns the claim status an End Device.
	GetClaimStatus(ctx context.Context, ids *ttnpb.EndDeviceIdentifiers) (*ttnpb.GetClaimStatusResponse, error)
	// Unclaim releases the claim on an End Device.
	Unclaim(ctx context.Context, ids *ttnpb.EndDeviceIdentifiers) (err error)

	// BatchUnclaim releases the claim on a batch of end devices.
	// All devices in a batch must have the same Join EUI.
	// Callers should first try to unmarshal returned error to DeviceError using errors.As().
	BatchUnclaim(
		ctx context.Context,
		ids []*ttnpb.EndDeviceIdentifiers,
	) error
}

EndDeviceClaimer provides methods for Claiming End Devices on (external) Join Server.

type NetworkServer added in v3.19.2

type NetworkServer struct {
	HomeNSID *types.EUI64 `name:"home-ns-id" description:"DEPRECATED"`
	Hostname string       `name:"hostname" description:"DEPRECATED"`
}

NetworkServer contains information related to the Network Server. TODO: Remove (https://github.com/TheThingsNetwork/lorawan-stack/issues/6048)

type Option

type Option func(*Upstream)

Option configures Upstream.

func WithClaimer added in v3.26.2

func WithClaimer(name string, claimer EndDeviceClaimer) Option

WithClaimer adds a claimer to Upstream.

type Upstream

type Upstream struct {
	// contains filtered or unexported fields
}

Upstream abstracts EndDeviceClaimingServer.

func NewUpstream

func NewUpstream(ctx context.Context, c Component, conf Config, opts ...Option) (*Upstream, error)

NewUpstream returns a new Upstream.

func (*Upstream) JoinEUIClaimer added in v3.26.2

func (upstream *Upstream) JoinEUIClaimer(_ context.Context, joinEUI types.EUI64) EndDeviceClaimer

JoinEUIClaimer returns the EndDeviceClaimer for the given JoinEUI.

Directories

Path Synopsis
Package errors defines common error types for all upstreams.
Package errors defines common error types for all upstreams.
Package ttjsv2 provides the claiming client implementation for The Things Join Server 2.0 API.
Package ttjsv2 provides the claiming client implementation for The Things Join Server 2.0 API.

Jump to

Keyboard shortcuts

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