Documentation
¶
Index ¶
- Constants
- func Handshake(ctx context.Context, ip net.IP, rlpxPort int, pubkey *ecdsa.PublicKey, ...) (*HelloMessage, *StatusMessage, *HandshakeError)
- func IsClientIDBlacklisted(clientID string) bool
- func NameFromClientID(clientID string) string
- func StatusLoggerLoop(ctx context.Context, db database.DB, networkID uint, period time.Duration, ...)
- type Command
- type CommandFlags
- type Crawler
- type CrawlerConfig
- type Diplomacy
- type Diplomat
- type DiplomatResult
- type DiscV4Transport
- type HandshakeError
- type HandshakeErrorID
- type HelloMessage
- type InterrogationError
- type InterrogationErrorID
- type InterrogationResult
- type Interrogator
- type Server
- type StatusMessage
Constants ¶
View Source
const ( RLPxMessageIDHello = 0 RLPxMessageIDDisconnect = 1 RLPxMessageIDPing = 2 RLPxMessageIDPong = 3 )
https://github.com/ethereum/devp2p/blob/master/rlpx.md#p2p-capability
Variables ¶
This section is empty.
Functions ¶
func Handshake ¶
func Handshake( ctx context.Context, ip net.IP, rlpxPort int, pubkey *ecdsa.PublicKey, myPrivateKey *ecdsa.PrivateKey, ) (*HelloMessage, *StatusMessage, *HandshakeError)
func IsClientIDBlacklisted ¶
func NameFromClientID ¶
Types ¶
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
func NewCommand ¶
func NewCommand() *Command
func (*Command) AddSubCommand ¶
func (*Command) ExecuteContext ¶
type CommandFlags ¶
type CommandFlags struct { DataDir string StatusLogPeriod time.Duration Chain string Bootnodes string ListenPort int NATDesc string NetRestrict string NodeKeyFile string NodeKeyHex string CrawlerConcurrency uint RefreshTimeout time.Duration MaxPingTries uint KeygenTimeout time.Duration KeygenConcurrency uint HandshakeRefreshTimeout time.Duration HandshakeRetryDelay time.Duration HandshakeMaxTries uint ErigonLogPath string }
type Crawler ¶
type Crawler struct {
// contains filtered or unexported fields
}
func NewCrawler ¶
func NewCrawler( transport DiscV4Transport, db database.DB, config CrawlerConfig, logger log.Logger, ) (*Crawler, error)
type CrawlerConfig ¶
type CrawlerConfig struct { Chain string Bootnodes []*enode.Node PrivateKey *ecdsa.PrivateKey ConcurrencyLimit uint RefreshTimeout time.Duration MaxPingTries uint StatusLogPeriod time.Duration HandshakeRefreshTimeout time.Duration HandshakeRetryDelay time.Duration HandshakeMaxTries uint KeygenTimeout time.Duration KeygenConcurrency uint ErigonLogPath string }
type Diplomacy ¶
type Diplomacy struct {
// contains filtered or unexported fields
}
func NewDiplomacy ¶
type Diplomat ¶
type Diplomat struct {
// contains filtered or unexported fields
}
func NewDiplomat ¶
func (*Diplomat) NextRetryDelay ¶
func (diplomat *Diplomat) NextRetryDelay(handshakeErr *HandshakeError) time.Duration
func (*Diplomat) NextRetryTime ¶
func (diplomat *Diplomat) NextRetryTime(handshakeErr *HandshakeError) time.Time
type DiplomatResult ¶
type DiplomatResult struct { ClientID *string NetworkID *uint64 EthVersion *uint32 HandshakeErr *HandshakeError HasTransientErr bool }
type DiscV4Transport ¶
type HandshakeError ¶
type HandshakeError struct {
// contains filtered or unexported fields
}
func NewHandshakeError ¶
func NewHandshakeError(id HandshakeErrorID, wrappedErr error, param uint64) *HandshakeError
func (*HandshakeError) Error ¶
func (e *HandshakeError) Error() string
func (*HandshakeError) StringCode ¶
func (e *HandshakeError) StringCode() string
func (*HandshakeError) Unwrap ¶
func (e *HandshakeError) Unwrap() error
type HandshakeErrorID ¶
type HandshakeErrorID string
const ( HandshakeErrorIDConnect HandshakeErrorID = "connect" HandshakeErrorIDSetTimeout HandshakeErrorID = "set-timeout" HandshakeErrorIDAuth HandshakeErrorID = "auth" HandshakeErrorIDRead HandshakeErrorID = "read" HandshakeErrorIDUnexpectedMessage HandshakeErrorID = "unexpected-message" HandshakeErrorIDDisconnectDecode HandshakeErrorID = "disconnect-decode" HandshakeErrorIDDisconnect HandshakeErrorID = "disconnect" HandshakeErrorIDHelloEncode HandshakeErrorID = "hello-encode" HandshakeErrorIDHelloDecode HandshakeErrorID = "hello-decode" HandshakeErrorIDStatusDecode HandshakeErrorID = "status-decode" )
type HelloMessage ¶
type HelloMessage struct { Version uint64 ClientID string Caps []p2p.Cap ListenPort uint64 Pubkey []byte // secp256k1 public key // Ignore additional fields (for forward compatibility). Rest []rlp.RawValue `rlp:"tail"` }
HelloMessage is the RLPx Hello message. (same as protoHandshake in p2p/peer.go) https://github.com/ethereum/devp2p/blob/master/rlpx.md#hello-0x00
type InterrogationError ¶
type InterrogationError struct {
// contains filtered or unexported fields
}
func NewInterrogationError ¶
func NewInterrogationError(id InterrogationErrorID, wrappedErr error) *InterrogationError
func (*InterrogationError) Error ¶
func (e *InterrogationError) Error() string
func (*InterrogationError) Unwrap ¶
func (e *InterrogationError) Unwrap() error
type InterrogationErrorID ¶
type InterrogationErrorID int
const ( InterrogationErrorPing InterrogationErrorID = iota + 1 InterrogationErrorENRDecode InterrogationErrorIncompatibleForkID InterrogationErrorBlacklistedClientID InterrogationErrorKeygen InterrogationErrorFindNode InterrogationErrorFindNodeTimeout InterrogationErrorCtxCancelled )
type InterrogationResult ¶
type Interrogator ¶
type Interrogator struct {
// contains filtered or unexported fields
}
func NewInterrogator ¶
func NewInterrogator( node *enode.Node, transport DiscV4Transport, forkFilter forkid.Filter, diplomat *Diplomat, handshakeRetryTime *time.Time, keygenTimeout time.Duration, keygenConcurrency uint, keygenSemaphore *semaphore.Weighted, keygenCachedKeys []*ecdsa.PublicKey, logger log.Logger, ) (*Interrogator, error)
func (*Interrogator) Run ¶
func (interrogator *Interrogator) Run(ctx context.Context) (*InterrogationResult, *InterrogationError)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(ctx context.Context, flags CommandFlags, logger log.Logger) (*Server, error)
func (*Server) PrivateKey ¶
func (server *Server) PrivateKey() *ecdsa.PrivateKey
type StatusMessage ¶
type StatusMessage struct { ProtocolVersion uint32 NetworkID uint64 TD *big.Int Head libcommon.Hash Genesis libcommon.Hash ForkID *forkid.ID `rlp:"-"` // parsed from Rest if exists in v64+ Rest []rlp.RawValue `rlp:"tail"` }
StatusMessage is the Ethereum Status message v63+. (same as StatusPacket in eth/protocols/eth/protocol.go) https://github.com/ethereum/devp2p/blob/master/caps/eth.md#status-0x00
Source Files
¶
Click to show internal directories.
Click to hide internal directories.