gateways

package
v3.32.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package gateways provides functions to claim gateways.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseGatewayEUIRanges

func ParseGatewayEUIRanges(conf map[string][]string) (map[string][]dcstypes.EUI64Range, error)

ParseGatewayEUIRanges parses the configured upstream map and returns map of ranges.

Types

type Claimer

type Claimer interface {
	// Claim claims a gateway.
	Claim(
		ctx context.Context, eui types.EUI64, ownerToken string, clusterAddress string,
	) (*dcstypes.GatewayMetadata, error)
	// Unclaim unclaims a gateway.
	Unclaim(ctx context.Context, eui types.EUI64) error
	// IsManagedGateway returns true if the gateway is a managed gateway.
	IsManagedGateway(ctx context.Context, eui types.EUI64) (bool, error)
}

Claimer provides methods for claiming Gateways.

type Component

type Component interface {
	GetBaseConfig(context.Context) config.ServiceBase
	GetTLSClientConfig(context.Context, ...tlsconfig.Option) (*tls.Config, error)
}

Component is the interface to the component.

type Config

type Config struct {
	CreateOnNotFound            bool                `name:"create-on-not-found" description:"DEPRECATED"`                                      // nolint:lll
	DefaultGatewayServerAddress string              `name:"default-gateway-server-address" description:"The default Gateway Server Address"`   // nolint:lll
	Upstreams                   map[string][]string `name:"upstreams" description:"Map of upstream type and the supported Gateway EUI ranges"` // nolint:lll
}

Config is the configuration for the Gateway Claiming Server.

type Option

type Option func(*Upstream)

Option configures Upstream.

func WithClaimer

func WithClaimer(name string, ranges []dcstypes.EUI64Range, claimer Claimer) Option

WithClaimer adds a claimer to Upstream.

type Upstream

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

Upstream is a gateway claiming upstream.

func NewUpstream

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

NewUpstream returns a new upstream based on the provided configuration.

func (*Upstream) Claimer

func (upstream *Upstream) Claimer(gatewayEUI types.EUI64) Claimer

Claimer returns the Claimer for the given Gateway EUI.

Directories

Path Synopsis
Package ttgc provides functions to use The Things Gateway Controller.
Package ttgc provides functions to use The Things Gateway Controller.

Jump to

Keyboard shortcuts

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