@ethereumjs/devp2p / rlpx/peer / Peer
rlpx/peer.Peer
-
EventEmitter
↳ Peer
- _EIP8
- _capabilities
- _clientId
- _closed
- _common
- _connected
- _disconnectReason
- _disconnectWe
- _eciesSession
- _hello
- _id
- _nextPacketSize
- _pingIntervalId
- _pingTimeout
- _pingTimeoutId
- _port
- _protocols
- _remoteClientIdFilter
- _remoteId
- _socket
- _socketData
- _state
- _weHello
- defaultMaxListeners
- _getProtocol
- _handleAck
- _handleAuth
- _handleBody
- _handleDisconnect
- _handleHeader
- _handleHello
- _handleMessage
- _handlePing
- _handlePong
- _onSocketClose
- _onSocketData
- _sendAck
- _sendAuth
- _sendDisconnect
- _sendHello
- _sendMessage
- _sendPing
- _sendPong
- addListener
- disconnect
- emit
- eventNames
- getDisconnectPrefix
- getHelloMessage
- getId
- getMaxListeners
- getMsgPrefix
- getProtocols
- listenerCount
- listeners
- off
- on
- once
- prependListener
- prependOnceListener
- rawListeners
- removeAllListeners
- removeListener
- setMaxListeners
- listenerCount
- once
• new Peer(options
)
Name | Type |
---|---|
options |
any |
EventEmitter.constructor
packages/devp2p/src/rlpx/peer.ts:101
• _EIP8: Buffer
packages/devp2p/src/rlpx/peer.ts:86
• Optional
_capabilities: Capabilities[]
packages/devp2p/src/rlpx/peer.ts:80
• _clientId: Buffer
packages/devp2p/src/rlpx/peer.ts:79
• _closed: boolean
packages/devp2p/src/rlpx/peer.ts:96
• _common: default
packages/devp2p/src/rlpx/peer.ts:81
• _connected: boolean
packages/devp2p/src/rlpx/peer.ts:97
• Optional
_disconnectReason: DISCONNECT_REQUESTED | NETWORK_ERROR | PROTOCOL_ERROR | USELESS_PEER | TOO_MANY_PEERS | ALREADY_CONNECTED | INCOMPATIBLE_VERSION | INVALID_IDENTITY | CLIENT_QUITTING | UNEXPECTED_IDENTITY | SAME_IDENTITY | TIMEOUT | SUBPROTOCOL_ERROR
packages/devp2p/src/rlpx/peer.ts:98
• _disconnectWe: any
packages/devp2p/src/rlpx/peer.ts:99
• _eciesSession: ECIES
packages/devp2p/src/rlpx/peer.ts:87
• _hello: null
| Hello
packages/devp2p/src/rlpx/peer.ts:90
• _id: Buffer
packages/devp2p/src/rlpx/peer.ts:83
• _nextPacketSize: number
packages/devp2p/src/rlpx/peer.ts:91
• _pingIntervalId: null
| Timeout
packages/devp2p/src/rlpx/peer.ts:94
• _pingTimeout: number
packages/devp2p/src/rlpx/peer.ts:100
• _pingTimeoutId: null
| Timeout
packages/devp2p/src/rlpx/peer.ts:95
• _port: number
packages/devp2p/src/rlpx/peer.ts:82
• _protocols: ProtocolDescriptor[]
packages/devp2p/src/rlpx/peer.ts:101
• _remoteClientIdFilter: any
packages/devp2p/src/rlpx/peer.ts:84
• _remoteId: Buffer
packages/devp2p/src/rlpx/peer.ts:85
• _socket: Socket
packages/devp2p/src/rlpx/peer.ts:92
• _socketData: BufferList
packages/devp2p/src/rlpx/peer.ts:93
• _state: string
packages/devp2p/src/rlpx/peer.ts:88
• _weHello: null
| HelloMsg
packages/devp2p/src/rlpx/peer.ts:89
▪ Static
defaultMaxListeners: number
EventEmitter.defaultMaxListeners
node_modules/@types/node/events.d.ts:20
▸ _getProtocol(code
): undefined
| ProtocolDescriptor
Name | Type |
---|---|
code |
number |
undefined
| ProtocolDescriptor
packages/devp2p/src/rlpx/peer.ts:553
▸ _handleAck(): void
ACK message received
void
packages/devp2p/src/rlpx/peer.ts:304
▸ _handleAuth(): void
AUTH message received
void
packages/devp2p/src/rlpx/peer.ts:281
▸ _handleBody(): void
Handle message body
void
packages/devp2p/src/rlpx/peer.ts:468
▸ _handleDisconnect(payload
): void
DISCONNECT message received
Name | Type |
---|---|
payload |
any |
void
packages/devp2p/src/rlpx/peer.ts:397
▸ _handleHeader(): void
Handle message header
void
packages/devp2p/src/rlpx/peer.ts:449
▸ _handleHello(payload
): void
HELLO message received
Name | Type |
---|---|
payload |
any |
void
packages/devp2p/src/rlpx/peer.ts:331
▸ _handleMessage(code
, msg
): void
Message handling, called from a SubProtocol context
Name | Type |
---|---|
code |
PREFIXES |
msg |
Buffer |
void
packages/devp2p/src/rlpx/peer.ts:428
▸ _handlePing(): void
PING message received
void
packages/devp2p/src/rlpx/peer.ts:412
▸ _handlePong(): void
PONG message received
void
packages/devp2p/src/rlpx/peer.ts:419
▸ _onSocketClose(): void
React to socket being closed
void
packages/devp2p/src/rlpx/peer.ts:545
▸ _onSocketData(data
): void
Process socket data
Name | Type |
---|---|
data |
Buffer |
void
packages/devp2p/src/rlpx/peer.ts:515
▸ _sendAck(): void
Send ACK message
void
packages/devp2p/src/rlpx/peer.ts:172
▸ _sendAuth(): void
Send AUTH message
void
packages/devp2p/src/rlpx/peer.ts:151
▸ _sendDisconnect(reason
): void
Send DISCONNECT message
Name | Type |
---|---|
reason |
DISCONNECT_REASONS |
void
packages/devp2p/src/rlpx/peer.ts:240
▸ _sendHello(): void
Send HELLO message
void
packages/devp2p/src/rlpx/peer.ts:216
▸ _sendMessage(code
, data
): undefined
| boolean
Create message HEADER and BODY and send to socket Also called from SubProtocol context
Name | Type |
---|---|
code |
number |
data |
Buffer |
undefined
| boolean
packages/devp2p/src/rlpx/peer.ts:197
▸ _sendPing(): void
Send PING message
void
packages/devp2p/src/rlpx/peer.ts:258
▸ _sendPong(): void
Send PONG message
void
packages/devp2p/src/rlpx/peer.ts:272
▸ addListener(event
, listener
): Peer
Name | Type |
---|---|
event |
string | symbol |
listener |
(...args : any []) => void |
EventEmitter.addListener
node_modules/@types/node/globals.d.ts:595
▸ disconnect(reason?
): void
Name | Type |
---|---|
reason |
DISCONNECT_REASONS |
void
packages/devp2p/src/rlpx/peer.ts:581
▸ emit(event
, ...args
): boolean
Name | Type |
---|---|
event |
string | symbol |
...args |
any [] |
boolean
EventEmitter.emit
node_modules/@types/node/globals.d.ts:605
▸ eventNames(): (string
| symbol
)[]
(string
| symbol
)[]
EventEmitter.eventNames
node_modules/@types/node/globals.d.ts:610
▸ getDisconnectPrefix(code
): string
Name | Type |
---|---|
code |
DISCONNECT_REASONS |
string
packages/devp2p/src/rlpx/peer.ts:577
▸ getHelloMessage(): null
| Hello
null
| Hello
packages/devp2p/src/rlpx/peer.ts:565
▸ getId(): null
| Buffer
null
| Buffer
packages/devp2p/src/rlpx/peer.ts:560
▸ getMaxListeners(): number
number
EventEmitter.getMaxListeners
node_modules/@types/node/globals.d.ts:602
▸ getMsgPrefix(code
): string
Name | Type |
---|---|
code |
PREFIXES |
string
packages/devp2p/src/rlpx/peer.ts:573
▸ getProtocols<T>(): T
[]
Name | Type |
---|---|
T |
T : ETH | LES |
T
[]
packages/devp2p/src/rlpx/peer.ts:569
▸ listenerCount(type
): number
Name | Type |
---|---|
type |
string | symbol |
number
EventEmitter.listenerCount
node_modules/@types/node/globals.d.ts:606
▸ listeners(event
): Function
[]
Name | Type |
---|---|
event |
string | symbol |
Function
[]
EventEmitter.listeners
node_modules/@types/node/globals.d.ts:603
▸ off(event
, listener
): Peer
Name | Type |
---|---|
event |
string | symbol |
listener |
(...args : any []) => void |
EventEmitter.off
node_modules/@types/node/globals.d.ts:599
▸ on(event
, listener
): Peer
Name | Type |
---|---|
event |
string | symbol |
listener |
(...args : any []) => void |
EventEmitter.on
node_modules/@types/node/globals.d.ts:596
▸ once(event
, listener
): Peer
Name | Type |
---|---|
event |
string | symbol |
listener |
(...args : any []) => void |
EventEmitter.once
node_modules/@types/node/globals.d.ts:597
▸ prependListener(event
, listener
): Peer
Name | Type |
---|---|
event |
string | symbol |
listener |
(...args : any []) => void |
EventEmitter.prependListener
node_modules/@types/node/globals.d.ts:608
▸ prependOnceListener(event
, listener
): Peer
Name | Type |
---|---|
event |
string | symbol |
listener |
(...args : any []) => void |
EventEmitter.prependOnceListener
node_modules/@types/node/globals.d.ts:609
▸ rawListeners(event
): Function
[]
Name | Type |
---|---|
event |
string | symbol |
Function
[]
EventEmitter.rawListeners
node_modules/@types/node/globals.d.ts:604
▸ removeAllListeners(event?
): Peer
Name | Type |
---|---|
event? |
string | symbol |
EventEmitter.removeAllListeners
node_modules/@types/node/globals.d.ts:600
▸ removeListener(event
, listener
): Peer
Name | Type |
---|---|
event |
string | symbol |
listener |
(...args : any []) => void |
EventEmitter.removeListener
node_modules/@types/node/globals.d.ts:598
▸ setMaxListeners(n
): Peer
Name | Type |
---|---|
n |
number |
EventEmitter.setMaxListeners
node_modules/@types/node/globals.d.ts:601
▸ Static
listenerCount(emitter
, event
): number
deprecated
since v4.0.0
Name | Type |
---|---|
emitter |
EventEmitter |
event |
string | symbol |
number
EventEmitter.listenerCount
node_modules/@types/node/events.d.ts:17
▸ Static
once(emitter
, event
): Promise
<any[]>
Name | Type |
---|---|
emitter |
NodeEventTarget |
event |
string | symbol |
Promise
<any[]>
EventEmitter.once
node_modules/@types/node/events.d.ts:13
▸ Static
once(emitter
, event
): Promise
<any[]>
Name | Type |
---|---|
emitter |
DOMEventTarget |
event |
string |
Promise
<any[]>
EventEmitter.once
node_modules/@types/node/events.d.ts:14