Documentation ¶
Overview ¶
Package gatewayserver contains the structs and methods necessary to start a gRPC Gateway Server
Index ¶
- type BasicStationConfig
- type Config
- type GatewayConnectionStatsRegistry
- type GatewayServer
- func (gs *GatewayServer) ClaimDownlink(ctx context.Context, ids ttnpb.GatewayIdentifiers) error
- func (gs *GatewayServer) Connect(ctx context.Context, frontend io.Frontend, ids ttnpb.GatewayIdentifiers) (*io.Connection, error)
- func (gs *GatewayServer) Context() context.Context
- func (gs *GatewayServer) FillGatewayContext(ctx context.Context, ids ttnpb.GatewayIdentifiers) (context.Context, ttnpb.GatewayIdentifiers, error)
- func (gs *GatewayServer) GetConfig(ctx context.Context) (*Config, error)
- func (gs *GatewayServer) GetConnection(ctx context.Context, ids ttnpb.GatewayIdentifiers) (*io.Connection, bool)
- func (gs *GatewayServer) GetFrequencyPlans(ctx context.Context, ids ttnpb.GatewayIdentifiers) (map[string]*frequencyplans.FrequencyPlan, error)
- func (gs *GatewayServer) GetGatewayConnectionStats(ctx context.Context, ids *ttnpb.GatewayIdentifiers) (*ttnpb.GatewayConnectionStats, error)
- func (gs *GatewayServer) GetMQTTConfig(ctx context.Context) (*config.MQTT, error)
- func (gs *GatewayServer) RegisterHandlers(s *runtime.ServeMux, conn *grpc.ClientConn)
- func (gs *GatewayServer) RegisterServices(s *grpc.Server)
- func (gs *GatewayServer) Roles() []ttnpb.ClusterRole
- func (gs *GatewayServer) ScheduleDownlink(ctx context.Context, down *ttnpb.DownlinkMessage) (*ttnpb.ScheduleDownlinkResponse, error)
- func (gs *GatewayServer) UnclaimDownlink(ctx context.Context, ids ttnpb.GatewayIdentifiers) error
- type Option
- type UDPConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicStationConfig ¶
type BasicStationConfig struct { ws.Config `name:",squash"` MaxValidRoundTripDelay time.Duration `name:"max-valid-round-trip-delay" description:"Maximum valid round trip delay to qualify for RTT calculations"` FallbackFrequencyPlanID string `name:"fallback-frequency-plan-id" description:"Fallback frequency plan ID for non-registered gateways"` Listen string `name:"listen" description:"Address for the Basic Station frontend to listen on"` ListenTLS string `name:"listen-tls" description:"Address for the Basic Station frontend to listen on (with TLS)"` }
BasicStationConfig defines the LoRa Basics Station configuration of the Gateway Server.
type Config ¶
type Config struct { RequireRegisteredGateways bool `name:"require-registered-gateways" description:"Require the gateways to be registered in the Identity Server"` UpdateGatewayLocationDebounceTime time.Duration `name:"update-gateway-location-debounce-time" description:"Debounce time for gateway location updates from status messages"` Stats GatewayConnectionStatsRegistry `name:"-"` UpdateConnectionStatsDebounceTime time.Duration `name:"update-connection-stats-debounce-time" description:"Time before repeated refresh of the gateway connection stats"` Forward map[string][]string `name:"forward" description:"Forward the DevAddr prefixes to the specified hosts"` MQTT config.MQTT `name:"mqtt"` MQTTV2 config.MQTT `name:"mqtt-v2"` UDP UDPConfig `name:"udp"` BasicStation BasicStationConfig `name:"basic-station"` }
Config represents the Gateway Server configuration.
func (Config) ForwardDevAddrPrefixes ¶
func (c Config) ForwardDevAddrPrefixes() (map[string][]types.DevAddrPrefix, error)
ForwardDevAddrPrefixes parses the configured forward map.
type GatewayConnectionStatsRegistry ¶
type GatewayConnectionStatsRegistry interface { // Get returns connection stats for a gateway. Get(ctx context.Context, ids ttnpb.GatewayIdentifiers) (*ttnpb.GatewayConnectionStats, error) // Set sets or clears the connection stats for a gateway. Set(ctx context.Context, ids ttnpb.GatewayIdentifiers, stats *ttnpb.GatewayConnectionStats) error }
GatewayConnectionStatsRegistry stores, updates and cleans up gateway connection stats.
type GatewayServer ¶
GatewayServer implements the Gateway Server component.
The Gateway Server exposes the Gs, GtwGs and NsGs services and MQTT and UDP frontends for gateways.
func (*GatewayServer) ClaimDownlink ¶
func (gs *GatewayServer) ClaimDownlink(ctx context.Context, ids ttnpb.GatewayIdentifiers) error
ClaimDownlink claims the downlink path for the given gateway.
func (*GatewayServer) Connect ¶
func (gs *GatewayServer) Connect(ctx context.Context, frontend io.Frontend, ids ttnpb.GatewayIdentifiers) (*io.Connection, error)
Connect connects a gateway by its identifiers to the Gateway Server, and returns a io.Connection for traffic and control.
func (*GatewayServer) Context ¶
func (gs *GatewayServer) Context() context.Context
Context returns the context of the Gateway Server.
func (*GatewayServer) FillGatewayContext ¶
func (gs *GatewayServer) FillGatewayContext(ctx context.Context, ids ttnpb.GatewayIdentifiers) (context.Context, ttnpb.GatewayIdentifiers, error)
FillGatewayContext fills the given context and identifiers. This method should only be used for request contexts.
func (*GatewayServer) GetConfig ¶
func (gs *GatewayServer) GetConfig(ctx context.Context) (*Config, error)
GetConfig returns the Gateway Server config based on the context.
func (*GatewayServer) GetConnection ¶
func (gs *GatewayServer) GetConnection(ctx context.Context, ids ttnpb.GatewayIdentifiers) (*io.Connection, bool)
GetConnection returns the *io.Connection for the given gateway. If not found, this method returns nil, false.
func (*GatewayServer) GetFrequencyPlans ¶
func (gs *GatewayServer) GetFrequencyPlans(ctx context.Context, ids ttnpb.GatewayIdentifiers) (map[string]*frequencyplans.FrequencyPlan, error)
GetFrequencyPlans gets the frequency plans by the gateway identifiers.
func (*GatewayServer) GetGatewayConnectionStats ¶
func (gs *GatewayServer) GetGatewayConnectionStats(ctx context.Context, ids *ttnpb.GatewayIdentifiers) (*ttnpb.GatewayConnectionStats, error)
GetGatewayConnectionStats returns statistics about a gateway connection.
func (*GatewayServer) GetMQTTConfig ¶
GetMQTTConfig returns the MQTT frontend configuration based on the context.
func (*GatewayServer) RegisterHandlers ¶
func (gs *GatewayServer) RegisterHandlers(s *runtime.ServeMux, conn *grpc.ClientConn)
RegisterHandlers registers gRPC handlers.
func (*GatewayServer) RegisterServices ¶
func (gs *GatewayServer) RegisterServices(s *grpc.Server)
RegisterServices registers services provided by gs at s.
func (*GatewayServer) Roles ¶
func (gs *GatewayServer) Roles() []ttnpb.ClusterRole
Roles returns the roles that the Gateway Server fulfills.
func (*GatewayServer) ScheduleDownlink ¶
func (gs *GatewayServer) ScheduleDownlink(ctx context.Context, down *ttnpb.DownlinkMessage) (*ttnpb.ScheduleDownlinkResponse, error)
ScheduleDownlink instructs the Gateway Server to schedule a downlink message request. This method returns an error if the downlink path cannot be found, if the requested parameters are invalid for the gateway's frequency plan or if there is no transmission window available because of scheduling conflicts or regional limitations such as duty-cycle and dwell time.
func (*GatewayServer) UnclaimDownlink ¶
func (gs *GatewayServer) UnclaimDownlink(ctx context.Context, ids ttnpb.GatewayIdentifiers) error
UnclaimDownlink releases the claim of the downlink path for the given gateway.
type Option ¶
type Option func(*GatewayServer)
Option configures GatewayServer.
func WithRegistry ¶
func WithRegistry(registry ttnpb.GatewayRegistryClient) Option
WithRegistry overrides the registry.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package scheduling implements a packet scheduling that detects and avoids conflicts and enforces regional restrictions like duty-cycle and dwell time.
|
Package scheduling implements a packet scheduling that detects and avoids conflicts and enforces regional restrictions like duty-cycle and dwell time. |
mock
Package mock provides mock implementation of necessary NS interfaces for testing.
|
Package mock provides mock implementation of necessary NS interfaces for testing. |
ns
Package ns abstracts the V3 Network Server to the upstream.Handler interface.
|
Package ns abstracts the V3 Network Server to the upstream.Handler interface. |
packetbroker
Package packetbroker abstracts the Packet Broker Agent to the upstream.Handler interface.
|
Package packetbroker abstracts the Packet Broker Agent to the upstream.Handler interface. |