ethereumjs-monorepo

@ethereumjs/devp2p / DPT

Class: DPT

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new DPT(privateKey, options)

Parameters

Name Type
privateKey Uint8Array
options DPTOptions

Defined in

packages/devp2p/src/dpt/dpt.ts:35

Properties

events

events: EventEmitter

Defined in

packages/devp2p/src/dpt/dpt.ts:18


id

Readonly id: undefined | Uint8Array

Defined in

packages/devp2p/src/dpt/dpt.ts:24

Methods

_addPeerBatch

_addPeerBatch(peers): void

Parameters

Name Type
peers PeerInfo[]

Returns

void

Defined in

packages/devp2p/src/dpt/dpt.ts:105


_onKBucketPing

_onKBucketPing(oldPeers, newPeer): void

Parameters

Name Type
oldPeers PeerInfo[]
newPeer PeerInfo

Returns

void

Defined in

packages/devp2p/src/dpt/dpt.ts:84


addPeer

addPeer(obj): Promise<PeerInfo>

Parameters

Name Type
obj PeerInfo

Returns

Promise<PeerInfo>

Defined in

packages/devp2p/src/dpt/dpt.ts:131


banPeer

banPeer(obj, maxAge?): void

Parameters

Name Type
obj string | Uint8Array | PeerInfo
maxAge? number

Returns

void

Defined in

packages/devp2p/src/dpt/dpt.ts:167


bind

bind(…args): void

Parameters

Name Type
...args any[]

Returns

void

Defined in

packages/devp2p/src/dpt/dpt.ts:75


bootstrap

bootstrap(peer): Promise<void>

Parameters

Name Type
peer PeerInfo

Returns

Promise<void>

Defined in

packages/devp2p/src/dpt/dpt.ts:118


destroy

destroy(…args): void

Parameters

Name Type
...args any[]

Returns

void

Defined in

packages/devp2p/src/dpt/dpt.ts:79


getClosestPeers

getClosestPeers(id): PeerInfo[]

Parameters

Name Type
id Uint8Array

Returns

PeerInfo[]

Defined in

packages/devp2p/src/dpt/dpt.ts:159


getDnsPeers

getDnsPeers(): Promise<PeerInfo[]>

Returns

Promise<PeerInfo[]>

Defined in

packages/devp2p/src/dpt/dpt.ts:172


getPeer

getPeer(obj): null | PeerInfo

Parameters

Name Type
obj string | Uint8Array | PeerInfo

Returns

null | PeerInfo

Defined in

packages/devp2p/src/dpt/dpt.ts:151


getPeers

getPeers(): PeerInfo[]

Returns

PeerInfo[]

Defined in

packages/devp2p/src/dpt/dpt.ts:155


refresh

refresh(): Promise<void>

Returns

Promise<void>

Defined in

packages/devp2p/src/dpt/dpt.ts:176


removePeer

removePeer(obj): void

Parameters

Name Type
obj string | Uint8Array | PeerInfo

Returns

void

Defined in

packages/devp2p/src/dpt/dpt.ts:163