Documentation
¶
Index ¶
- Constants
- Variables
- func CustomToString[T ClientName | ClientOS | ClientArch | ClientLanguage](s T) string
- func IsIPPublic(ip net.IP) bool
- func ParseBootnodes(bnodes []string) ([]*enode.Node, error)
- func ParseStringToEnode(enr string) *enode.Node
- func PubkeyToString(pub *ecdsa.PublicKey) string
- func StringToPubkey(str string) (*ecdsa.PublicKey, error)
- type ChainDetails
- type ClientArch
- type ClientLanguage
- type ClientName
- type ClientOS
- type ConnectionAttempt
- type ConnectionStatus
- type DiscoveryType
- type ENR
- type ENRoption
- type EnodeSet
- type HostInfo
- type IPInfo
- type IPInfoMsg
- type IPInfoResponse
- type NodeInfo
- type NodeInfoOption
- type RemoteNodeClient
Constants ¶
View Source
const EmptyNetworkId = uint64(0)
View Source
const (
IPInfoTTL = 30 * 24 * time.Hour // 30 days
)
Variables ¶
View Source
var ( // GoblaUnknown Unknown string = "unknown" // avail Clients Geth ClientName = "geth" Erigon ClientName = "erigon" Reth ClientName = "reth" Nethermind ClientName = "nethermind" Besu ClientName = "besu" OpenEthereum ClientName = "open-ethereum" Parity ClientName = "parity" Reosc ClientName = "reosc" EthereumJS ClientName = "ethereum-js" NimbusEth1 ClientName = "nimbus-eth1" // avail OSs LinuxOS ClientOS = "linux" WindowsOS ClientOS = "windows" MaxOS ClientOS = "mac" FreeBsdOS ClientOS = "free-bsd" // Client Archs Amd64Arch ClientArch = "amd64" X86Arch ClientArch = "x86" ArmArch ClientArch = "arm" // Client Languages GoLanguage ClientLanguage = "go" RustLanguage ClientLanguage = "rust" JavaLanguage ClientLanguage = "java" JavaScriptLanguage ClientLanguage = "js" DotnetLanguage ClientLanguage = "dotnet" NimLanguage ClientLanguage = "nim" )
View Source
var PrivateIPNetworks = []net.IPNet{ net.IPNet{ IP: net.ParseIP("10.0.0.0"), Mask: net.CIDRMask(8, 32), }, net.IPNet{ IP: net.ParseIP("172.16.0.0"), Mask: net.CIDRMask(12, 32), }, net.IPNet{ IP: net.ParseIP("192.168.0.0"), Mask: net.CIDRMask(16, 32), }, }
View Source
var ValidArchs = map[ClientArch][]string{ Amd64Arch: {"amd64", "x64"}, X86Arch: {"x86_64", "86"}, ArmArch: {"arm", "arm64"}, }
View Source
var ValidClientNames = map[ClientName][]string{ Geth: {"geth", "go-ethereum"}, Reth: {"reth"}, Erigon: {"erigon"}, Nethermind: {"nethermind"}, Besu: {"besu"}, OpenEthereum: {"openethereum"}, Parity: {"parity"}, EthereumJS: {"ethereum-js"}, NimbusEth1: {"nimbus", "nim"}, }
Valid strings
View Source
var ValidLanguages = map[ClientLanguage][]string{ GoLanguage: {"go"}, RustLanguage: {"rust", "reth"}, JavaLanguage: {"java", "arm64"}, JavaScriptLanguage: {"js", "nodejs"}, DotnetLanguage: {"arm", "arm64"}, NimLanguage: {"nim", "nimvm"}, }
Functions ¶
func CustomToString ¶
func CustomToString[T ClientName | ClientOS | ClientArch | ClientLanguage](s T) string
func IsIPPublic ¶
func ParseStringToEnode ¶
func PubkeyToString ¶
Types ¶
type ChainDetails ¶
type ChainDetails struct {
ForkID forkid.ID
ProtocolVersion uint32
HeadHash common.Hash
NetworkID uint64
TotalDifficulty *big.Int
}
func (*ChainDetails) IsEmpty ¶
func (d *ChainDetails) IsEmpty() bool
type ClientArch ¶
type ClientArch string
type ClientLanguage ¶
type ClientLanguage string
type ClientName ¶
type ClientName string
type ConnectionAttempt ¶
type ConnectionAttempt struct {
Timestamp time.Time
ID enode.ID
Status ConnectionStatus
Error string
Latency time.Duration
Deprecable bool
}
func NewConnectionAttempt ¶
func NewConnectionAttempt(id enode.ID) ConnectionAttempt
type ConnectionStatus ¶
type ConnectionStatus int8
const ( NotAttempted ConnectionStatus = iota FailedConnection SuccessfulConnection )
func (ConnectionStatus) String ¶
func (s ConnectionStatus) String() (str string)
type DiscoveryType ¶
type DiscoveryType int8
const ( UnknownDiscovery DiscoveryType = iota Discovery4 Discovery5 CsvFile )
func (DiscoveryType) String ¶
func (t DiscoveryType) String() string
type ENR ¶
type ENR struct {
Timestamp time.Time
Node *enode.Node
Record *ogEnr.Record
DiscType DiscoveryType
ID enode.ID
IP string
UDP int
TCP int
Pubkey string
Score int
Seq uint64
}
Basic structure that can be readed from the discovery services
func (ENR) CSVheaders ¶
func (*ENR) ComposeCSVItems ¶
func (n *ENR) ComposeCSVItems() []interface{}
func (*ENR) GetHostInfo ¶
type ENRoption ¶
func FromCSVline ¶
func FromDiscv4 ¶
the Discv4 Node won't search for the Eth2data and so on (could be still worth look for it?)
func WithTimestamp ¶
WithTimestamp adds any given timestamp into any given ENR
type EnodeSet ¶
type EnodeSet struct {
// contains filtered or unexported fields
}
func NewEnodeSet ¶
func NewEnodeSet() *EnodeSet
func (*EnodeSet) RowComposer ¶
type IPInfoMsg ¶
type IPInfoMsg struct {
IP string `json:"query"`
Status string `json:"status"`
Continent string `json:"continent"`
ContinentCode string `json:"continentCode"`
Country string `json:"country"`
CountryCode string `json:"countryCode"`
Region string `json:"region"`
RegionName string `json:"regionName"`
City string `json:"city"`
Zip string `json:"zip"`
Lat float64 `json:"lat"`
Lon float64 `json:"lon"`
Isp string `json:"isp"`
Org string `json:"org"`
As string `json:"as"`
AsName string `json:"asname"`
Mobile bool `json:"mobile"`
Proxy bool `json:"proxy"`
Hosting bool `json:"hosting"`
}
IP-API message structure
type IPInfoResponse ¶
type NodeInfo ¶
type NodeInfo struct {
Timestamp time.Time
ID enode.ID
HostInfo
ethtest.HandshakeDetails
ChainDetails
}
func NewNodeInfo ¶
func NewNodeInfo(id enode.ID, opts ...NodeInfoOption) (*NodeInfo, error)
func (*NodeInfo) UpdateTimestamp ¶
func (n *NodeInfo) UpdateTimestamp()
type NodeInfoOption ¶
func WithChainDetails ¶
func WithChainDetails(cd ChainDetails) NodeInfoOption
WithHostInfo adds the give host info to the NodeInfo struct
func WithHandShakeDetails ¶
func WithHandShakeDetails(d ethtest.HandshakeDetails) NodeInfoOption
WithHandshakeDetails adds the give handshake info to the NodeInfo struct
func WithHostInfo ¶
func WithHostInfo(hInfo HostInfo) NodeInfoOption
WithHostInfo adds the give host info to the NodeInfo struct
type RemoteNodeClient ¶
type RemoteNodeClient struct {
RawClientName string
ClientName ClientName
ClientVersion string
ClientCleanVersion string
ClientOS ClientOS
ClientArch ClientArch
ClientLanguage ClientLanguage
}
func ParseUserAgent ¶
func ParseUserAgent(rawString string) RemoteNodeClient
Click to show internal directories.
Click to hide internal directories.