Documentation ¶
Index ¶
Constants ¶
const ( Good = "good" // our defintiion Old = "old" // our definition Unstable = "unknown" // from the ledger data Insane = "insane" // from the ledger data )
These constants define the stability nature of an XRPL peer
Variables ¶
var DefaultStabilityChecker = &PeerList{}
DefaultStabilityChecker is the packages own opintionated check function for use with a peers StableWith method.
var MinVersion = semver.Must(semver.NewVersion("1.2.4"))
MinVersion is another opinion but it can be set at runtime...
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct { Command string `json:"command"` AdminUser string `json:"admin_user,omitempty"` AdminPassword string `json:"admin_password,omitempty"` }
Command is a rippled admin command
type Node ¶
Node is an XRPL proxy or validator node
func (*Node) DoCommand ¶
func (n *Node) DoCommand(cmd RPCCommand) *WsMessage
DoCommand runs a single command
func (*Node) RepeatCommand ¶
RepeatCommand dials the ws/wss RPC endpoint for admin commands then repeats a command periodically
type Peer ¶
type Peer struct { Address string `json:"address"` CompleteLedgers string `json:"complete_ledgers,omitempty"` Inbound bool `json:"inbound,omitempty"` Latency int `json:"latency"` Ledger string `json:"ledger,omitempty"` Load int `json:"load"` PublicKey string `json:"public_key"` Uptime int `json:"uptime"` Version string `json:"version"` Sanity string `json:"sanity,omitempty"` Cluster bool `json:"cluster,omitempty"` }
Peer defines a validator/stock peer node
func (*Peer) SemVer ¶
SemVer returns the semantic version of the node software, if the version string is unrecognised e.g. not 'rippled-x.x.x' it returns a nil version and error
func (*Peer) StableWith ¶
func (p *Peer) StableWith(checker StabilityChecker) bool
StableWith checks the stability of a node with a StabilityChecker
type PeerCommand ¶
type PeerCommand struct {
*Command
}
PeerCommand is a "peers" rpc admin command
func NewPeerCommand ¶
func NewPeerCommand() *PeerCommand
NewPeerCommand creates a new "peers" command
type PeerList ¶
type PeerList struct { Result struct { Peers []*Peer `json:"peers"` Status string `json:"status"` } `json:"result"` }
PeerList represents the output from the 'peers' admin commnad
func UnmarshalPeers ¶
UnmarshalPeers is a convenience function to marshal a JSON peer list into a *PeerList
func (*PeerList) Anonymise ¶
func (pl *PeerList) Anonymise()
Anonymise (randomise) the IP's of a peerlist - for testing / CI purposes... public keys are obviously in the public domain but lets be polite about the IP's
func (*PeerList) Check ¶
Check is an opinionated view of the peers stability based on the reported sanity field, the version and the connected uptime. This checker returns true only if the peer is sane, is a recent version of rippled, and has been connected long enough to decide on it's sanity.
type RPCCommand ¶
type RPCCommand interface {
JSON() []byte
}
RPCCommand defines commands that can be sent to the nodes
type StabilityChecker ¶
StabilityChecker is the interface that a peer can consumer to check the stability of a peer against some custom rules.
type Toml ¶ added in v0.0.8
type Toml struct { METADATA *TomlMetadata VALIDATORS []*TomlValidator PRINCIPLES []*TomlPrinciple SERVERS []*TomlServer }
Toml is a representation of /.well-known/srp-ledger.toml
type TomlMetadata ¶ added in v0.0.8
type TomlMetadata struct {
Modified string
}
TomlMetadata represents the [[METADATA]] entry
type TomlPrinciple ¶ added in v0.0.8
type TomlPrinciple struct { Name string // contains filtered or unexported fields }
TomlPrinciple represents an dentry in the [[PRINCIPLES]] toml list
type TomlServer ¶ added in v0.0.8
TomlServer represents an dentry in the [[SERVERS]] toml list