types

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2020 License: Apache-2.0 Imports: 8 Imported by: 12

Documentation

Index

Constants

View Source
const (
	EventTypeSet       = "node:set"
	EventTypeUpdate    = "node:update"
	EventTypeSetStatus = "node:set_status"
)
View Source
const (
	AttributeKeyProvider = "provider"
	AttributeKeyAddress  = "address"
	AttributeKeyStatus   = "status"
)
View Source
const (
	ModuleName     = "node"
	ParamsSubspace = ModuleName
	QuerierRoute   = ModuleName
)
View Source
const (
	QueryNode             = "node"
	QueryNodes            = "nodes"
	QueryNodesForProvider = "nodes_for_provider"
)
View Source
const (
	Codespace = sdk.CodespaceType(ModuleName)
)
View Source
const (
	DefaultInactiveDuration = 30 * time.Minute
)

Variables

View Source
var (
	RouterKey = ModuleName
	StoreKey  = ModuleName
)
View Source
var (
	NodeKeyPrefix            = []byte{0x00}
	NodeForProviderKeyPrefix = []byte{0x01}
	ActiveNodeAtKeyPrefix    = []byte{0x02}
)
View Source
var (
	KeyInactiveDuration = []byte("InactiveDuration")
)
View Source
var (
	ModuleCdc *codec.Codec
)

Functions

func ActiveNodeAtKey

func ActiveNodeAtKey(at time.Time, address hub.NodeAddress) []byte

func ErrorDuplicateNode

func ErrorDuplicateNode() sdk.Error

func ErrorInvalidField

func ErrorInvalidField(v string) sdk.Error

func ErrorMarshal

func ErrorMarshal() sdk.Error

func ErrorNodeDoesNotExist

func ErrorNodeDoesNotExist() sdk.Error

func ErrorProviderDoesNotExist

func ErrorProviderDoesNotExist() sdk.Error

func ErrorUnknownMsgType

func ErrorUnknownMsgType(v string) sdk.Error

func ErrorUnknownQueryType

func ErrorUnknownQueryType(v string) sdk.Error

func ErrorUnmarshal

func ErrorUnmarshal() sdk.Error

func GetActiveNodeAtKeyPrefix

func GetActiveNodeAtKeyPrefix(at time.Time) []byte

func GetNodeForProviderKeyPrefix

func GetNodeForProviderKeyPrefix(address hub.ProvAddress) []byte

func NodeForProviderKey

func NodeForProviderKey(p hub.ProvAddress, n hub.NodeAddress) []byte

func NodeKey

func NodeKey(address hub.NodeAddress) []byte

func ParamsKeyTable

func ParamsKeyTable() params.KeyTable

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Types

type Category

type Category byte
const (
	CategoryUnknown Category = iota + 0x00
	CategoryOpenVPN
	CategoryWireGuard
)

func CategoryFromString

func CategoryFromString(s string) Category

func (Category) Equal

func (n Category) Equal(v Category) bool

func (Category) IsValid

func (n Category) IsValid() bool

func (Category) String

func (n Category) String() string

type GenesisState

type GenesisState struct {
	Nodes  Nodes  `json:"_"`
	Params Params `json:"params"`
}

func DefaultGenesisState

func DefaultGenesisState() GenesisState

func NewGenesisState

func NewGenesisState(nodes Nodes, params Params) GenesisState

type MsgRegister

type MsgRegister struct {
	From          sdk.AccAddress  `json:"from"`
	Provider      hub.ProvAddress `json:"provider,omitempty"`
	Price         sdk.Coins       `json:"price,omitempty"`
	InternetSpeed hub.Bandwidth   `json:"internet_speed"`
	RemoteURL     string          `json:"remote_url"`
	Version       string          `json:"version"`
	Category      Category        `json:"category"`
}

MsgRegister is for registering a VPN node.

func NewMsgRegister

func NewMsgRegister(from sdk.AccAddress, provider hub.ProvAddress, price sdk.Coins,
	speed hub.Bandwidth, remoteURL, version string, category Category) MsgRegister

func (MsgRegister) GetSignBytes

func (m MsgRegister) GetSignBytes() []byte

func (MsgRegister) GetSigners

func (m MsgRegister) GetSigners() []sdk.AccAddress

func (MsgRegister) Route

func (m MsgRegister) Route() string

func (MsgRegister) Type

func (m MsgRegister) Type() string

func (MsgRegister) ValidateBasic

func (m MsgRegister) ValidateBasic() sdk.Error

type MsgSetStatus

type MsgSetStatus struct {
	From   hub.NodeAddress `json:"from"`
	Status hub.Status      `json:"status"`
}

MsgSetStatus is for updating the status of a VPN node.

func NewMsgSetStatus

func NewMsgSetStatus(from hub.NodeAddress, status hub.Status) MsgSetStatus

func (MsgSetStatus) GetSignBytes

func (m MsgSetStatus) GetSignBytes() []byte

func (MsgSetStatus) GetSigners

func (m MsgSetStatus) GetSigners() []sdk.AccAddress

func (MsgSetStatus) Route

func (m MsgSetStatus) Route() string

func (MsgSetStatus) Type

func (m MsgSetStatus) Type() string

func (MsgSetStatus) ValidateBasic

func (m MsgSetStatus) ValidateBasic() sdk.Error

type MsgUpdate

type MsgUpdate struct {
	From          hub.NodeAddress `json:"from"`
	Provider      hub.ProvAddress `json:"provider,omitempty"`
	Price         sdk.Coins       `json:"price,omitempty"`
	InternetSpeed hub.Bandwidth   `json:"internet_speed,omitempty"`
	RemoteURL     string          `json:"remote_url,omitempty"`
	Version       string          `json:"version,omitempty"`
	Category      Category        `json:"category,omitempty"`
}

MsgUpdate is for updating the information of a VPN node.

func NewMsgUpdate

func NewMsgUpdate(from hub.NodeAddress, provider hub.ProvAddress, price sdk.Coins,
	speed hub.Bandwidth, remoteURL, version string, category Category) MsgUpdate

func (MsgUpdate) GetSignBytes

func (m MsgUpdate) GetSignBytes() []byte

func (MsgUpdate) GetSigners

func (m MsgUpdate) GetSigners() []sdk.AccAddress

func (MsgUpdate) Route

func (m MsgUpdate) Route() string

func (MsgUpdate) Type

func (m MsgUpdate) Type() string

func (MsgUpdate) ValidateBasic

func (m MsgUpdate) ValidateBasic() sdk.Error

type Node

type Node struct {
	Address       hub.NodeAddress `json:"address"`
	Provider      hub.ProvAddress `json:"provider,omitempty"`
	Price         sdk.Coins       `json:"price,omitempty"`
	InternetSpeed hub.Bandwidth   `json:"internet_speed"`
	RemoteURL     string          `json:"remote_url"`
	Version       string          `json:"version"`
	Category      Category        `json:"category"`
	Status        hub.Status      `json:"status"`
	StatusAt      time.Time       `json:"status_at"`
}

func (Node) BandwidthForCoin

func (n Node) BandwidthForCoin(coin sdk.Coin) (hub.Bandwidth, error)

func (Node) PriceForDenom

func (n Node) PriceForDenom(d string) (sdk.Coin, bool)

func (Node) String

func (n Node) String() string

func (Node) Validate

func (n Node) Validate() error

type Nodes

type Nodes []Node

type Params

type Params struct {
	InactiveDuration time.Duration `json:"inactive_duration"`
}

func DefaultParams

func DefaultParams() Params

func NewParams

func NewParams(inactiveDuration time.Duration) Params

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() params.ParamSetPairs

func (Params) String

func (p Params) String() string

func (Params) Validate

func (p Params) Validate() error

type QueryNodeParams

type QueryNodeParams struct {
	Address hub.NodeAddress `json:"address"`
}

func NewQueryNodeParams

func NewQueryNodeParams(address hub.NodeAddress) QueryNodeParams

type QueryNodesForProviderParams

type QueryNodesForProviderParams struct {
	Address hub.ProvAddress `json:"address"`
	Page    int             `json:"page"`
	Limit   int             `json:"limit"`
}

func NewQueryNodesForProviderParams

func NewQueryNodesForProviderParams(address hub.ProvAddress, page, limit int) QueryNodesForProviderParams

type QueryNodesParams

type QueryNodesParams struct {
	Page  int `json:"page"`
	Limit int `json:"limit"`
}

func NewQueryNodesParams

func NewQueryNodesParams(page, limit int) QueryNodesParams

Jump to

Keyboard shortcuts

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