@ethereumjs/devp2p / Peer
• new Peer(options)
| Name | Type |
|---|---|
options |
PeerOptions |
packages/devp2p/src/rlpx/peer.ts:98
• _protocols: ProtocolDescriptor[]
Subprotocols (e.g. ETH) derived from the exchange on
capabilities
packages/devp2p/src/rlpx/peer.ts:96
• Readonly clientId: Uint8Array
packages/devp2p/src/rlpx/peer.ts:68
• common: Common
packages/devp2p/src/rlpx/peer.ts:70
• events: EventEmitter
packages/devp2p/src/rlpx/peer.ts:67
• Readonly id: Uint8Array
packages/devp2p/src/rlpx/peer.ts:72
▸ _addFirstPeerDebugger(): void
Called once from the subprotocol (e.g. ETH) on the peer
where a first successful STATUS msg exchange could be achieved.
Can be used together with the devp2p:FIRST_PEER debugger.
void
packages/devp2p/src/rlpx/peer.ts:689
▸ _getProtocol(code): undefined | ProtocolDescriptor
Returns either a protocol object with a protocol parameter
reference to this Peer instance or to a subprotocol instance (e.g. ETH)
(depending on the code provided)
| Name | Type |
|---|---|
code |
number |
undefined | ProtocolDescriptor
packages/devp2p/src/rlpx/peer.ts:651
▸ _handleAck(): void
ACK message received
void
packages/devp2p/src/rlpx/peer.ts:328
▸ _handleAuth(): void
AUTH message received
void
packages/devp2p/src/rlpx/peer.ts:303
▸ _handleBody(): void
Handle message body
void
packages/devp2p/src/rlpx/peer.ts:516
▸ _handleDisconnect(payload): void
DISCONNECT message received
| Name | Type |
|---|---|
payload |
any |
void
packages/devp2p/src/rlpx/peer.ts:440
▸ _handleHeader(): void
Handle message header
void
packages/devp2p/src/rlpx/peer.ts:497
▸ _handleHello(payload): void
HELLO message received
| Name | Type |
|---|---|
payload |
any |
void
packages/devp2p/src/rlpx/peer.ts:359
▸ _handleMessage(code, msg): void
Message handling, called from a SubProtocol context
| Name | Type |
|---|---|
code |
PREFIXES |
msg |
Uint8Array |
void
packages/devp2p/src/rlpx/peer.ts:477
▸ _handlePing(): void
PING message received
void
packages/devp2p/src/rlpx/peer.ts:461
▸ _handlePong(): void
PONG message received
void
packages/devp2p/src/rlpx/peer.ts:468
▸ _onSocketClose(): void
React to socket being closed
void
packages/devp2p/src/rlpx/peer.ts:638
▸ _onSocketData(data): void
Process socket data
| Name | Type |
|---|---|
data |
Uint8Array |
void
packages/devp2p/src/rlpx/peer.ts:608
▸ _sendAck(): void
Send ACK message
void
packages/devp2p/src/rlpx/peer.ts:170
▸ _sendAuth(): void
Send AUTH message
void
packages/devp2p/src/rlpx/peer.ts:149
▸ _sendDisconnect(reason): void
Send DISCONNECT message
| Name | Type |
|---|---|
reason |
DISCONNECT_REASON |
void
packages/devp2p/src/rlpx/peer.ts:253
▸ _sendHello(): void
Send HELLO message
void
packages/devp2p/src/rlpx/peer.ts:217
▸ _sendMessage(code, data): undefined | boolean
Create message HEADER and BODY and send to socket Also called from SubProtocol context
| Name | Type |
|---|---|
code |
number |
data |
Uint8Array |
undefined | boolean
packages/devp2p/src/rlpx/peer.ts:197
▸ _sendPing(): void
Send PING message
void
packages/devp2p/src/rlpx/peer.ts:272
▸ _sendPong(): void
Send PONG message
void
packages/devp2p/src/rlpx/peer.ts:290
▸ disconnect(reason?): void
| Name | Type | Default value |
|---|---|---|
reason |
DISCONNECT_REASON |
DISCONNECT_REASON.DISCONNECT_REQUESTED |
void
packages/devp2p/src/rlpx/peer.ts:679
▸ getDisconnectPrefix(code): string
| Name | Type |
|---|---|
code |
DISCONNECT_REASON |
string
packages/devp2p/src/rlpx/peer.ts:675
▸ getHelloMessage(): null | Hello
null | Hello
packages/devp2p/src/rlpx/peer.ts:663
▸ getId(): null | Uint8Array
null | Uint8Array
packages/devp2p/src/rlpx/peer.ts:658
▸ getMsgPrefix(code): string
| Name | Type |
|---|---|
code |
PREFIXES |
string
packages/devp2p/src/rlpx/peer.ts:671
▸ getProtocols(): Protocol[]
Protocol[]