gateway

package
v0.0.1-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStoreNotExists   = fmt.Errorf("gateway store doesn't exists")
	ErrNotFound         = fmt.Errorf("not found")
	ErrAlreadyExists    = fmt.Errorf("already exists")
	ErrInvalidGatewayID = fmt.Errorf("invalid gateway ID")
)
View Source
var (
	Cmd = &cobra.Command{
		Use:   "gateway",
		Short: "gateway related commands",
	}
)

Functions

func CalculateCompressedPublicKeyBytes

func CalculateCompressedPublicKeyBytes(pub *ecdsa.PublicKey) []byte

func CalculateNetworkGatewayID

func CalculateNetworkGatewayID(priv *ecdsa.PrivateKey) lorawan.EUI64

func CalculatePublicKeyBytes

func CalculatePublicKeyBytes(pub *ecdsa.PublicKey) []byte

func GeneratePrivateKey

func GeneratePrivateKey() (*ecdsa.PrivateKey, error)

func SignPlainBatchOnboardMessage

func SignPlainBatchOnboardMessage(chainID *big.Int, contract common.Address, owner common.Address, version uint8, gw *Gateway) ([]byte, error)

SignPlainBatchOnboardMessage signs a gateway onboard message for the PlainBatchGatewayOnboarder smart contract

Types

type Config

type Config struct {
	BlockChain struct {
		Endpoint      string
		ChainID       uint64
		Confirmations uint64
	} `mapstructure:"blockchain"`
}

type Gateway

type Gateway struct {
	LocalGatewayID           lorawan.EUI64
	NetworkGatewayID         lorawan.EUI64
	PrivateKey               *ecdsa.PrivateKey
	PublicKey                *ecdsa.PublicKey
	PublicKeyBytes           []byte
	CompressedPublicKeyBytes []byte
	Owner                    common.Address
}

func GenerateNewGateway

func GenerateNewGateway(localID lorawan.EUI64) (*Gateway, error)

func NewGateway

func NewGateway(localGatewayID lorawan.EUI64, priv *ecdsa.PrivateKey) (*Gateway, error)

func (*Gateway) Address

func (gw *Gateway) Address() common.Address

func (Gateway) CompressedPubKeyBytes

func (gw Gateway) CompressedPubKeyBytes() []byte

CompressedPubKeyBytes returns the compressed public key including 0x02 prefix

func (Gateway) ID

func (gw Gateway) ID() [32]byte

ID is the identifier as which the gateway is registered in the gateway registry.

type GatewayYamlFileStore

type GatewayYamlFileStore struct {
	Path string
	// contains filtered or unexported fields
}

func LoadGatewayYamlFileStore

func LoadGatewayYamlFileStore(path string) (*GatewayYamlFileStore, error)

func (*GatewayYamlFileStore) AddGateway

func (store *GatewayYamlFileStore) AddGateway(localID lorawan.EUI64, key *ecdsa.PrivateKey) error

func (*GatewayYamlFileStore) GatewayByLocalID

func (store *GatewayYamlFileStore) GatewayByLocalID(id lorawan.EUI64) (*Gateway, error)

func (*GatewayYamlFileStore) GatewayByLocalIDBytes

func (store *GatewayYamlFileStore) GatewayByLocalIDBytes(id []byte) (*Gateway, error)

func (*GatewayYamlFileStore) GatewayByNetworkID

func (store *GatewayYamlFileStore) GatewayByNetworkID(id lorawan.EUI64) (*Gateway, error)

func (*GatewayYamlFileStore) GatewayByNetworkIDString

func (store *GatewayYamlFileStore) GatewayByNetworkIDString(id string) (*Gateway, error)

func (*GatewayYamlFileStore) GatewayByThingsIxID

func (store *GatewayYamlFileStore) GatewayByThingsIxID(id [32]byte) (*Gateway, error)

func (*GatewayYamlFileStore) Gateways

func (store *GatewayYamlFileStore) Gateways() []*Gateway

type Store

type Store interface {
	Gateways() []*Gateway
	GatewayByLocalID(id lorawan.EUI64) (*Gateway, error)
	GatewayByLocalIDBytes(id []byte) (*Gateway, error)
	GatewayByNetworkID(id lorawan.EUI64) (*Gateway, error)
	GatewayByNetworkIDString(id string) (*Gateway, error)
	GatewayByThingsIxID([32]byte) (*Gateway, error)
	AddGateway(localID lorawan.EUI64, key *ecdsa.PrivateKey) error
}

Store defines a gateway store.

Jump to

Keyboard shortcuts

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