Documentation ¶
Index ¶
Constants ¶
const DefaultStaiExecutableSuffix = "stai-blockchain/venv/bin/stai"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { // StaiExecutable the stai executable e.g. /home/steffen/stai-blockchain/venv/bin/stai StaiExecutable string // Location is the location to filter for Location string // IsDownThreshold is true in case it was set by the user IsDownThreshold bool // DownThreshold is the down speed threshold to filter for DownThreshold float64 // Done indicates that we are done (--help, --version...) Done bool }
Context describes the environment of the tool execution
type FilterByDown ¶
type FilterByDown struct { Nodes []FullNode // threshold the minimum (inclusive down speed) Threshold float64 }
FilterByDown can filter FullNodes by it's down speed. All Nodes which have a lower or equal down speed than specified by threshold will be present
func (FilterByDown) Filter ¶
func (f FilterByDown) Filter() ([]FullNode, error)
Filter performs filtering of FullNodes by down threshold. All Nodes which have a lower or equal down speed than specified by threshold will be present
type FilterByLocation ¶
FilterByLocation can filter FullNodes by it's location
func (FilterByLocation) Filter ¶
func (f FilterByLocation) Filter() ([]FullNode, error)
Filter performs filtering of FullNodes by LocationToFilter. The Filtering is be performed in a case insensitive manner.
type FullNode ¶
type FullNode struct { // Ip V4 e.g. 127.0.0.1, 123.11.12.13 Ip string // Ports in format 61075/8444 Ports string // NodeId represents the node id (e.g. aaaabbcc) NodeId string // LastConnect in format May 14 11:15:20 LastConnect string // Up represents the uplink in MiB Up float64 // Down represents the downlink in MiB Down float64 }
FullNode represents a connected full node
func (FullNode) IpLocation ¶
IpLocation to get the corresponding location of the ipV4 of the FullNode
type GetLocation ¶
GetLocation to get the Geo Ip Location for a ipV4 Address
type Lookup ¶
type Lookup interface { // IpLocation to perform a lookup based on the Geo IP Location IpLocation() (string, error) }
Lookup interface to perform basic lookups
type Stai ¶
type Stai interface { // ListNodes will list all connected FullNodes ListNodes() (nodes []FullNode, err error) // RemoveNode will remove a connected Full Node by it's nodeId RemoveNode(nodeId string) error }
Stai interface to provide basic actions for Stai
type StaiCli ¶
type StaiCli struct { // StaiExecutable represents the stai executable e.g. /home/steffen/stai-blockchain/venv/bin/stai StaiExecutable string }
StaiCli represents the stai command line interface
func (StaiCli) ListNodes ¶
ListNodes will list all connected FullNodes. It basically acts as wrapper around "stai show -c"
func (StaiCli) RemoveNode ¶
RemoveNode will remove the connected full node via "stai show -r nodeId"