Skip to content

Latest commit

 

History

History
1237 lines (686 loc) · 23.4 KB

rlpx_peer.peer.md

File metadata and controls

1237 lines (686 loc) · 23.4 KB

@ethereumjs/devp2p / rlpx/peer / Peer

Class: Peer

rlpx/peer.Peer

Hierarchy

  • EventEmitter

    Peer

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Peer(options)

Parameters

Name Type
options any

Overrides

EventEmitter.constructor

Defined in

packages/devp2p/src/rlpx/peer.ts:101

Properties

_EIP8

_EIP8: Buffer

Defined in

packages/devp2p/src/rlpx/peer.ts:86


_capabilities

Optional _capabilities: Capabilities[]

Defined in

packages/devp2p/src/rlpx/peer.ts:80


_clientId

_clientId: Buffer

Defined in

packages/devp2p/src/rlpx/peer.ts:79


_closed

_closed: boolean

Defined in

packages/devp2p/src/rlpx/peer.ts:96


_common

_common: default

Defined in

packages/devp2p/src/rlpx/peer.ts:81


_connected

_connected: boolean

Defined in

packages/devp2p/src/rlpx/peer.ts:97


_disconnectReason

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

Defined in

packages/devp2p/src/rlpx/peer.ts:98


_disconnectWe

_disconnectWe: any

Defined in

packages/devp2p/src/rlpx/peer.ts:99


_eciesSession

_eciesSession: ECIES

Defined in

packages/devp2p/src/rlpx/peer.ts:87


_hello

_hello: null | Hello

Defined in

packages/devp2p/src/rlpx/peer.ts:90


_id

_id: Buffer

Defined in

packages/devp2p/src/rlpx/peer.ts:83


_nextPacketSize

_nextPacketSize: number

Defined in

packages/devp2p/src/rlpx/peer.ts:91


_pingIntervalId

_pingIntervalId: null | Timeout

Defined in

packages/devp2p/src/rlpx/peer.ts:94


_pingTimeout

_pingTimeout: number

Defined in

packages/devp2p/src/rlpx/peer.ts:100


_pingTimeoutId

_pingTimeoutId: null | Timeout

Defined in

packages/devp2p/src/rlpx/peer.ts:95


_port

_port: number

Defined in

packages/devp2p/src/rlpx/peer.ts:82


_protocols

_protocols: ProtocolDescriptor[]

Defined in

packages/devp2p/src/rlpx/peer.ts:101


_remoteClientIdFilter

_remoteClientIdFilter: any

Defined in

packages/devp2p/src/rlpx/peer.ts:84


_remoteId

_remoteId: Buffer

Defined in

packages/devp2p/src/rlpx/peer.ts:85


_socket

_socket: Socket

Defined in

packages/devp2p/src/rlpx/peer.ts:92


_socketData

_socketData: BufferList

Defined in

packages/devp2p/src/rlpx/peer.ts:93


_state

_state: string

Defined in

packages/devp2p/src/rlpx/peer.ts:88


_weHello

_weHello: null | HelloMsg

Defined in

packages/devp2p/src/rlpx/peer.ts:89


defaultMaxListeners

Static defaultMaxListeners: number

Inherited from

EventEmitter.defaultMaxListeners

Defined in

node_modules/@types/node/events.d.ts:20

Methods

_getProtocol

_getProtocol(code): undefined | ProtocolDescriptor

Parameters

Name Type
code number

Returns

undefined | ProtocolDescriptor

Defined in

packages/devp2p/src/rlpx/peer.ts:553


_handleAck

_handleAck(): void

ACK message received

Returns

void

Defined in

packages/devp2p/src/rlpx/peer.ts:304


_handleAuth

_handleAuth(): void

AUTH message received

Returns

void

Defined in

packages/devp2p/src/rlpx/peer.ts:281


_handleBody

_handleBody(): void

Handle message body

Returns

void

Defined in

packages/devp2p/src/rlpx/peer.ts:468


_handleDisconnect

_handleDisconnect(payload): void

DISCONNECT message received

Parameters

Name Type
payload any

Returns

void

Defined in

packages/devp2p/src/rlpx/peer.ts:397


_handleHeader

_handleHeader(): void

Handle message header

Returns

void

Defined in

packages/devp2p/src/rlpx/peer.ts:449


_handleHello

_handleHello(payload): void

HELLO message received

Parameters

Name Type
payload any

Returns

void

Defined in

packages/devp2p/src/rlpx/peer.ts:331


_handleMessage

_handleMessage(code, msg): void

Message handling, called from a SubProtocol context

Parameters

Name Type
code PREFIXES
msg Buffer

Returns

void

Defined in

packages/devp2p/src/rlpx/peer.ts:428


_handlePing

_handlePing(): void

PING message received

Returns

void

Defined in

packages/devp2p/src/rlpx/peer.ts:412


_handlePong

_handlePong(): void

PONG message received

Returns

void

Defined in

packages/devp2p/src/rlpx/peer.ts:419


_onSocketClose

_onSocketClose(): void

React to socket being closed

Returns

void

Defined in

packages/devp2p/src/rlpx/peer.ts:545


_onSocketData

_onSocketData(data): void

Process socket data

Parameters

Name Type
data Buffer

Returns

void

Defined in

packages/devp2p/src/rlpx/peer.ts:515


_sendAck

_sendAck(): void

Send ACK message

Returns

void

Defined in

packages/devp2p/src/rlpx/peer.ts:172


_sendAuth

_sendAuth(): void

Send AUTH message

Returns

void

Defined in

packages/devp2p/src/rlpx/peer.ts:151


_sendDisconnect

_sendDisconnect(reason): void

Send DISCONNECT message

Parameters

Name Type
reason DISCONNECT_REASONS

Returns

void

Defined in

packages/devp2p/src/rlpx/peer.ts:240


_sendHello

_sendHello(): void

Send HELLO message

Returns

void

Defined in

packages/devp2p/src/rlpx/peer.ts:216


_sendMessage

_sendMessage(code, data): undefined | boolean

Create message HEADER and BODY and send to socket Also called from SubProtocol context

Parameters

Name Type
code number
data Buffer

Returns

undefined | boolean

Defined in

packages/devp2p/src/rlpx/peer.ts:197


_sendPing

_sendPing(): void

Send PING message

Returns

void

Defined in

packages/devp2p/src/rlpx/peer.ts:258


_sendPong

_sendPong(): void

Send PONG message

Returns

void

Defined in

packages/devp2p/src/rlpx/peer.ts:272


addListener

addListener(event, listener): Peer

Parameters

Name Type
event string | symbol
listener (...args: any[]) => void

Returns

Peer

Inherited from

EventEmitter.addListener

Defined in

node_modules/@types/node/globals.d.ts:595


disconnect

disconnect(reason?): void

Parameters

Name Type
reason DISCONNECT_REASONS

Returns

void

Defined in

packages/devp2p/src/rlpx/peer.ts:581


emit

emit(event, ...args): boolean

Parameters

Name Type
event string | symbol
...args any[]

Returns

boolean

Inherited from

EventEmitter.emit

Defined in

node_modules/@types/node/globals.d.ts:605


eventNames

eventNames(): (string | symbol)[]

Returns

(string | symbol)[]

Inherited from

EventEmitter.eventNames

Defined in

node_modules/@types/node/globals.d.ts:610


getDisconnectPrefix

getDisconnectPrefix(code): string

Parameters

Name Type
code DISCONNECT_REASONS

Returns

string

Defined in

packages/devp2p/src/rlpx/peer.ts:577


getHelloMessage

getHelloMessage(): null | Hello

Returns

null | Hello

Defined in

packages/devp2p/src/rlpx/peer.ts:565


getId

getId(): null | Buffer

Returns

null | Buffer

Defined in

packages/devp2p/src/rlpx/peer.ts:560


getMaxListeners

getMaxListeners(): number

Returns

number

Inherited from

EventEmitter.getMaxListeners

Defined in

node_modules/@types/node/globals.d.ts:602


getMsgPrefix

getMsgPrefix(code): string

Parameters

Name Type
code PREFIXES

Returns

string

Defined in

packages/devp2p/src/rlpx/peer.ts:573


getProtocols

getProtocols<T>(): T[]

Type parameters

Name Type
T T: ETH | LES

Returns

T[]

Defined in

packages/devp2p/src/rlpx/peer.ts:569


listenerCount

listenerCount(type): number

Parameters

Name Type
type string | symbol

Returns

number

Inherited from

EventEmitter.listenerCount

Defined in

node_modules/@types/node/globals.d.ts:606


listeners

listeners(event): Function[]

Parameters

Name Type
event string | symbol

Returns

Function[]

Inherited from

EventEmitter.listeners

Defined in

node_modules/@types/node/globals.d.ts:603


off

off(event, listener): Peer

Parameters

Name Type
event string | symbol
listener (...args: any[]) => void

Returns

Peer

Inherited from

EventEmitter.off

Defined in

node_modules/@types/node/globals.d.ts:599


on

on(event, listener): Peer

Parameters

Name Type
event string | symbol
listener (...args: any[]) => void

Returns

Peer

Inherited from

EventEmitter.on

Defined in

node_modules/@types/node/globals.d.ts:596


once

once(event, listener): Peer

Parameters

Name Type
event string | symbol
listener (...args: any[]) => void

Returns

Peer

Inherited from

EventEmitter.once

Defined in

node_modules/@types/node/globals.d.ts:597


prependListener

prependListener(event, listener): Peer

Parameters

Name Type
event string | symbol
listener (...args: any[]) => void

Returns

Peer

Inherited from

EventEmitter.prependListener

Defined in

node_modules/@types/node/globals.d.ts:608


prependOnceListener

prependOnceListener(event, listener): Peer

Parameters

Name Type
event string | symbol
listener (...args: any[]) => void

Returns

Peer

Inherited from

EventEmitter.prependOnceListener

Defined in

node_modules/@types/node/globals.d.ts:609


rawListeners

rawListeners(event): Function[]

Parameters

Name Type
event string | symbol

Returns

Function[]

Inherited from

EventEmitter.rawListeners

Defined in

node_modules/@types/node/globals.d.ts:604


removeAllListeners

removeAllListeners(event?): Peer

Parameters

Name Type
event? string | symbol

Returns

Peer

Inherited from

EventEmitter.removeAllListeners

Defined in

node_modules/@types/node/globals.d.ts:600


removeListener

removeListener(event, listener): Peer

Parameters

Name Type
event string | symbol
listener (...args: any[]) => void

Returns

Peer

Inherited from

EventEmitter.removeListener

Defined in

node_modules/@types/node/globals.d.ts:598


setMaxListeners

setMaxListeners(n): Peer

Parameters

Name Type
n number

Returns

Peer

Inherited from

EventEmitter.setMaxListeners

Defined in

node_modules/@types/node/globals.d.ts:601


listenerCount

Static listenerCount(emitter, event): number

deprecated since v4.0.0

Parameters

Name Type
emitter EventEmitter
event string | symbol

Returns

number

Inherited from

EventEmitter.listenerCount

Defined in

node_modules/@types/node/events.d.ts:17


once

Static once(emitter, event): Promise<any[]>

Parameters

Name Type
emitter NodeEventTarget
event string | symbol

Returns

Promise<any[]>

Inherited from

EventEmitter.once

Defined in

node_modules/@types/node/events.d.ts:13

Static once(emitter, event): Promise<any[]>

Parameters

Name Type
emitter DOMEventTarget
event string

Returns

Promise<any[]>

Inherited from

EventEmitter.once

Defined in

node_modules/@types/node/events.d.ts:14