 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Variables
- func BytesToGatewayID(id []byte) (lorawan.EUI64, error)
- func GatewayNetworkIDFromPrivateKey(priv *ecdsa.PrivateKey) lorawan.EUI64
- func GatewayPublicKeyToID(pubKey []byte) (lorawan.EUI64, error)
- func NewPostgresStore(ctx context.Context, refreshInterval *time.Duration) (*pgStore, error)
- func NewPostgresStoreWithFilterer(ctx context.Context, refreshInterval *time.Duration, ...) (*pgStore, error)
- func NewYamlFileStore(ctx context.Context, path string, refreshInterval *time.Duration) (*yamlFileStore, error)
- func NewYamlFileStoreWithFilterer(ctx context.Context, path string, refreshInterval *time.Duration, ...) (*yamlFileStore, error)
- func NoGatewayFilterer(gw *Gateway) bool
- func SignPlainBatchOnboardMessage(chainID *big.Int, contract common.Address, owner common.Address, version uint8, ...) ([]byte, error)
- type Config
- type ForwarderGatewayRecordUnknownConfig
- type Gateway
- type GatewayFiltererFunc
- type GatewayRanger
- type GatewayRangerFunc
- type GatewayStore
- type GatewayStoreType
- type StoreConfig
- type ThingsIxID
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GatewayNetworkIDFromPrivateKey ¶ added in v1.0.3
func GatewayNetworkIDFromPrivateKey(priv *ecdsa.PrivateKey) lorawan.EUI64
func NewPostgresStore ¶ added in v1.0.3
NewPostgresStore returns a gateway store that uses a postgresql backend.
func NewPostgresStoreWithFilterer ¶ added in v1.0.3
func NewPostgresStoreWithFilterer(ctx context.Context, refreshInterval *time.Duration, filterer GatewayFiltererFunc) (*pgStore, error)
NewPostgresStore returns a gateway store that uses a postgresql backend and only imports gateways into the store for which the given filterer passes.
func NewYamlFileStore ¶ added in v1.0.3
func NewYamlFileStoreWithFilterer ¶ added in v1.0.3
func NoGatewayFilterer ¶ added in v1.0.3
NoFilterer doesn't filter.
Types ¶
type ForwarderGatewayRecordUnknownConfig ¶ added in v1.0.3
type ForwarderGatewayRecordUnknownConfig struct {
	// File points to a file on the local file system where unknown gateways
	// that connect are recorded.
	File string
	// Postgresql if non nil indicates that unknown gateways must be recorded to
	// a postgresql database.
	Postgresql *bool `mapstructure:"postgresql"`
}
    type Gateway ¶
type Gateway struct {
	// LocalID is the gateway ID as used in the communication between gateway
	// and ThingsIX forwarder and is usually derived from the gateways hardware.
	LocalID lorawan.EUI64
	// NetId is the gateway id as used in the communication between the
	// forwarder and the ThingsIX network.
	NetworkID lorawan.EUI64
	// PrivateKey is the gateways private key
	PrivateKey *ecdsa.PrivateKey
	// PublicKey is the gateways public key from which the ThingsIX is derived.
	PublicKey *ecdsa.PublicKey
	// PublicKeyBytes
	PublicKeyBytes []byte
	// ThingsIxID is the gateway id as used when onboarding the gateway in
	// ThingsIX. It is the gateways public key without the `0x02` prefix.
	ThingsIxID ThingsIxID
	// Owner is the gateways owner if the gateway is onboarded in ThingsIX. If
	// nil it means the gateway is in the store but it is not onboarded in
	// ThingsIX (yet).
	Owner common.Address
}
    Gateway represents a ThingsIX gateway
func NewGateway ¶
func (Gateway) CompressedPubKeyBytes ¶
CompressedPubKeyBytes returns the compressed public key with 0x02 prefix
func (Gateway) ID ¶
func (gw Gateway) ID() ThingsIxID
ID is the identifier as which the gateway is registered in the gateway registry.
type GatewayFiltererFunc ¶ added in v1.0.3
GatewayFiltererFunc is used by gateway stores to filter out gateways that are not (yet) suitable. For instance if these gateways have not yet been onboarded. If the gateway must be added to the in-memory gateway store and traffic must be exchanged between gateways and the ThingsIX network the filterer must return true for the given gw.
type GatewayRanger ¶ added in v1.0.3
type GatewayRangerFunc ¶ added in v1.0.3
func (GatewayRangerFunc) Do ¶ added in v1.0.3
func (fn GatewayRangerFunc) Do(gw *Gateway) bool
type GatewayStore ¶ added in v1.0.3
type GatewayStore interface {
	// Count returns the number of gateways in the store.
	Count() int
	// Range calls fn sequentially for each gateway present in the store.
	// If fn returns false, range stops the iteration.
	Range(GatewayRanger)
	// ByLocalID returns the gateway identified by the given local id.
	// If not found ErrNotFound is returned.
	ByLocalID(localID lorawan.EUI64) (*Gateway, error)
	// Returns the gateway identified by the given local id as string.
	// If not found ErrNotFound is returned.
	ByLocalIDString(id string) (*Gateway, error)
	// ContainsByLocalID returns an indication if there is gateway in the store
	// that is identified by the given local id.
	ContainsByLocalID(localID lorawan.EUI64) bool
	// ByNetworkID returns the gateway identified by the given network id.
	// If not found ErrNotFound is returned.
	ByNetworkID(netID lorawan.EUI64) (*Gateway, error)
	// ByNetworkIDString returns the gateway identified by the given network id
	// as string. If not found ErrNotFound is returned.
	ByNetworkIDString(id string) (*Gateway, error)
	// ContainsByNetID returns an indication if there is gateway in the store
	// that is identified by the given network id.
	ContainsByNetID(netID lorawan.EUI64) bool
	// ByThingsIxID returns the gateway identified by the given ThingsIX id.
	// If not found ErrNotFound is returned.
	ByThingsIxID(id ThingsIxID) (*Gateway, error)
	// Add creates a net gateway record based on the given localID and key and
	// adds it to the store.
	Add(ctx context.Context, localID lorawan.EUI64, key *ecdsa.PrivateKey) (*Gateway, error)
}
    func NewGatewayStore ¶ added in v1.0.3
func NewGatewayStore(ctx context.Context, cfg *StoreConfig) (GatewayStore, error)
NewGatewayStore returns a gateway store that was configured in the given cfg.
type GatewayStoreType ¶ added in v1.0.3
type GatewayStoreType uint
const ( NoGatewayStoreType GatewayStoreType = iota YamlFileGatewayStore PostgresqlGatewayStore )
type StoreConfig ¶ added in v1.0.3
type StoreConfig struct {
	// RefreshInterval indicates how often the gateway store is reloaded from
	// the backend store. If this is a nil ptr hot reloads are disabled.
	RefreshInterval *time.Duration `mapstructure:"refresh"`
	// YamlStorePath indicates that gateways are stored in a
	// YAML based file store located on the local file system.
	// Only data for gateways in the store is forwarded.
	YamlStorePath *string `mapstructure:"file"`
	// Use a PGSQL database to store gateways.
	Postgresql *bool `mapstructure:"postgresql"`
}
    func (StoreConfig) Type ¶ added in v1.0.3
func (sc StoreConfig) Type() GatewayStoreType
type ThingsIxID ¶ added in v1.0.3
type ThingsIxID [32]byte
ThingsIxID is the gateways public key without the leading `0x02`.
func (ThingsIxID) String ¶ added in v1.0.3
func (id ThingsIxID) String() string