 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- func Run(cmd *cobra.Command, args []string)
- type Config
- type GatewayPool
- func (gp *GatewayPool) AllOffline(forwarderID uuid.UUID)
- func (gp *GatewayPool) DownlinkFrame(frame *gw.DownlinkFrame)
- func (gp *GatewayPool) SetOffline(forwarderID uuid.UUID, gatewayID lorawan.EUI64)
- func (gp *GatewayPool) SetOnline(forwarderID uuid.UUID, gatewayID lorawan.EUI64, gatewayOwner common.Address, ...)
 
- type JoinFilterGenerator
- type Router
- func (r *Router) Events(forwarder router.RouterV1_EventsServer) error
- func (r *Router) GatewayCommandExecHandler(cmdExec *gw.GatewayCommandExecRequest)
- func (r *Router) GatewayConfigurationHandler(conf *gw.GatewayConfiguration)
- func (r *Router) JoinFilter(ctx context.Context, req *router.JoinFilterRequest) (*router.JoinFilterResponse, error)
- func (r *Router) MustRun(ctx context.Context)
- func (r *Router) RawPacketForwarderCommandHandler(cmd *gw.RawPacketForwarderCommand)
- func (r *Router) Run(ctx context.Context) error
 
- type RouterConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
	Log struct {
		Level     logrus.Level
		Timestamp bool
	}
	Router RouterConfig `mapstructure:"router"`
	Metrics *struct {
		Prometheus *struct {
			Address string
			Path    string
		}
	}
}
    func (Config) MetricsPrometheusAddress ¶
func (Config) MetricsPrometheusPath ¶
func (Config) PrometheusEnabled ¶
type GatewayPool ¶
type GatewayPool struct {
	// contains filtered or unexported fields
}
    func NewGatewayPool ¶
func NewGatewayPool() (*GatewayPool, error)
func (*GatewayPool) AllOffline ¶
func (gp *GatewayPool) AllOffline(forwarderID uuid.UUID)
AllOffline must be called whan a forwarder goes offline and all its gateways are therefore immediatly offline.
func (*GatewayPool) DownlinkFrame ¶
func (gp *GatewayPool) DownlinkFrame(frame *gw.DownlinkFrame)
DownlinkFrame is a callback that must be called by the integration layer if it wants to send a downlink frame to a gateway through the forwarder it is connected to.
func (*GatewayPool) SetOffline ¶
func (gp *GatewayPool) SetOffline(forwarderID uuid.UUID, gatewayID lorawan.EUI64)
SetOffline must be called when a forwarder detects one of its gateways is offline so it won't be able to deliver packages to it.
func (*GatewayPool) SetOnline ¶
func (gp *GatewayPool) SetOnline(forwarderID uuid.UUID, gatewayID lorawan.EUI64, gatewayOwner common.Address, forwarderEventSender chan<- *router.RouterToGatewayEvent)
SetOnline must be called when the forwarder has a gateway connected and is able to deliver packets to it.
type JoinFilterGenerator ¶
type JoinFilterGenerator interface {
	JoinFilter(ctx context.Context) (*router.JoinFilter, error)
	UpdateFilter(ctx context.Context) error
}
    func NewJoinFilterGenerator ¶
func NewJoinFilterGenerator(config RouterConfig) (JoinFilterGenerator, error)
type Router ¶
type Router struct {
	router.UnimplementedRouterV1Server
	// contains filtered or unexported fields
}
    Router accepts connections from forwarders and can exchange message between gateways and the integration layer this router is configured for. It ensures that messages from the integrations layer are send to the correct forwarder that can deliver the packet to the targeted gateways.
func NewRouter ¶
func NewRouter(cfg *Config, in integration.Integration) (*Router, error)
func (*Router) Events ¶
func (r *Router) Events(forwarder router.RouterV1_EventsServer) error
Called by the forwarder to start bi-directional communication stream on which events from gateways are send through the forwarder to this router or in reverse from the integrations connected to this router to the forwarder and eventually to its gateways that the event is targeted for.
func (*Router) GatewayCommandExecHandler ¶
func (r *Router) GatewayCommandExecHandler(cmdExec *gw.GatewayCommandExecRequest)
func (*Router) GatewayConfigurationHandler ¶
func (r *Router) GatewayConfigurationHandler(conf *gw.GatewayConfiguration)
func (*Router) JoinFilter ¶
func (r *Router) JoinFilter(ctx context.Context, req *router.JoinFilterRequest) (*router.JoinFilterResponse, error)
func (*Router) RawPacketForwarderCommandHandler ¶
func (r *Router) RawPacketForwarderCommandHandler(cmd *gw.RawPacketForwarderCommand)
type RouterConfig ¶
type RouterConfig struct {
	JoinFilterGenerator struct {
		RenewInterval time.Duration `mapstructure:"renew_interval"`
		ChirpStack    struct {
			Target   string `mapstructure:"target"`
			Insecure bool
			APIKey   string `mapstructure:"api_key"`
		} `mapstructure:"chirpstack"`
	}
	Forwarder struct {
		Endpoint struct {
			Host string
			Port uint16
		}
	}
	Integration struct {
		Marshaler string `mapstructure:"marshaler"`
		MQTT *struct {
			EventTopicTemplate      string        `mapstructure:"event_topic_template"`
			CommandTopicTemplate    string        `mapstructure:"command_topic_template"`
			StateTopicTemplate      string        `mapstructure:"state_topic_template"`
			StateRetained           bool          `mapstructure:"state_retained"`
			KeepAlive               time.Duration `mapstructure:"keep_alive"`
			MaxReconnectInterval    time.Duration `mapstructure:"max_reconnect_interval"`
			TerminateOnConnectError bool          `mapstructure:"terminate_on_connect_error"`
			MaxTokenWait            time.Duration `mapstructure:"max_token_wait"`
			Auth *struct {
				Generic *struct {
					Server       string   `mapstructure:"server"`
					Servers      []string `mapstructure:"servers"`
					Username     string   `mapstructure:"username"`
					Password     string   `mapstrucure:"password"`
					CACert       string   `mapstructure:"ca_cert"`
					TLSCert      string   `mapstructure:"tls_cert"`
					TLSKey       string   `mapstructure:"tls_key"`
					QOS          uint8    `mapstructure:"qos"`
					CleanSession bool     `mapstructure:"clean_session"`
					ClientID     string   `mapstructure:"client_id"`
				} `mapstructure:"generic"`
				GCPCloudIoTCore *struct {
					Server        string        `mapstructure:"server"`
					DeviceID      string        `mapstructure:"device_id"`
					ProjectID     string        `mapstructure:"project_id"`
					CloudRegion   string        `mapstructure:"cloud_region"`
					RegistryID    string        `mapstructure:"registry_id"`
					JWTExpiration time.Duration `mapstructure:"jwt_expiration"`
					JWTKeyFile    string        `mapstructure:"jwt_key_file"`
				} `mapstructure:"gcp_cloud_iot_core"`
				AzureIoTHub *struct {
					DeviceConnectionString string        `mapstructure:"device_connection_string"`
					DeviceID               string        `mapstructure:"device_id"`
					Hostname               string        `mapstructure:"hostname"`
					DeviceKey              string        `mapstructure:"-"`
					SASTokenExpiration     time.Duration `mapstructure:"sas_token_expiration"`
					TLSCert                string        `mapstructure:"tls_cert"`
					TLSKey                 string        `mapstructure:"tls_key"`
				} `mapstructure:"azure_iot_hub"`
			} `mapstructure:"auth"`
		} `mapstructure:"mqtt"`
	} `mapstructure:"integration"`
}
    func (RouterConfig) ForwarderListenerAddress ¶
func (rc RouterConfig) ForwarderListenerAddress() string