feat(p2p): peerId protocol handshake
This commit is contained in:
parent
92fdd54ffa
commit
524b4d9601
@ -68,6 +68,7 @@ class p2p {
|
|||||||
callback({
|
callback({
|
||||||
protocol: 'rats',
|
protocol: 'rats',
|
||||||
version: this.version,
|
version: this.version,
|
||||||
|
peerId: this.peerId,
|
||||||
info: this.info,
|
info: this.info,
|
||||||
peers: shuffle(this.peersList()).slice(0, 4).map(peer => ({address: peer.address, port: peer.port}))
|
peers: shuffle(this.peersList()).slice(0, 4).map(peer => ({address: peer.address, port: peer.port}))
|
||||||
})
|
})
|
||||||
@ -241,6 +242,7 @@ class p2p {
|
|||||||
protocol: 'rats',
|
protocol: 'rats',
|
||||||
port: config.spiderPort,
|
port: config.spiderPort,
|
||||||
version: this.version,
|
version: this.version,
|
||||||
|
peerId: this.peerId,
|
||||||
info: this.info,
|
info: this.info,
|
||||||
peers: shuffle(this.peersList()).slice(0, 4).map(peer => ({address: peer.address, port: peer.port})).concat(this.externalPeers) // also add external peers
|
peers: shuffle(this.peersList()).slice(0, 4).map(peer => ({address: peer.address, port: peer.port})).concat(this.externalPeers) // also add external peers
|
||||||
}, (data) => {
|
}, (data) => {
|
||||||
@ -263,6 +265,7 @@ class p2p {
|
|||||||
this.size++;
|
this.size++;
|
||||||
//extra info
|
//extra info
|
||||||
address.version = data.version
|
address.version = data.version
|
||||||
|
address.peerId = data.peerId
|
||||||
address.info = data.info
|
address.info = data.info
|
||||||
this.send('peer', {
|
this.send('peer', {
|
||||||
size: this.size,
|
size: this.size,
|
||||||
|
Loading…
Reference in New Issue
Block a user