@libp2p/identify 3.0.38 → 3.0.39-a02cb0461
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +4 -4
- package/dist/src/identify-push.d.ts +2 -2
- package/dist/src/identify-push.d.ts.map +1 -1
- package/dist/src/identify-push.js +24 -31
- package/dist/src/identify-push.js.map +1 -1
- package/dist/src/identify.d.ts +2 -2
- package/dist/src/identify.d.ts.map +1 -1
- package/dist/src/identify.js +50 -54
- package/dist/src/identify.js.map +1 -1
- package/dist/src/utils.d.ts +3 -9
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +6 -19
- package/dist/src/utils.js.map +1 -1
- package/package.json +15 -18
- package/src/identify-push.ts +26 -32
- package/src/identify.ts +57 -62
- package/src/utils.ts +9 -22
- package/dist/typedoc-urls.json +0 -18
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { serviceCapabilities } from '@libp2p/interface';
|
|
2
2
|
import { AbstractIdentify } from './utils.js';
|
|
3
3
|
import type { IdentifyPush as IdentifyPushInterface, IdentifyPushComponents, IdentifyPushInit } from './index.js';
|
|
4
|
-
import type { Startable,
|
|
4
|
+
import type { Stream, Startable, Connection } from '@libp2p/interface';
|
|
5
5
|
export declare class IdentifyPush extends AbstractIdentify implements Startable, IdentifyPushInterface {
|
|
6
6
|
private readonly connectionManager;
|
|
7
7
|
private readonly concurrency;
|
|
@@ -16,6 +16,6 @@ export declare class IdentifyPush extends AbstractIdentify implements Startable,
|
|
|
16
16
|
/**
|
|
17
17
|
* Reads the Identify Push message from the given `connection`
|
|
18
18
|
*/
|
|
19
|
-
handleProtocol(
|
|
19
|
+
handleProtocol(stream: Stream, connection: Connection): Promise<void>;
|
|
20
20
|
}
|
|
21
21
|
//# sourceMappingURL=identify-push.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identify-push.d.ts","sourceRoot":"","sources":["../../src/identify-push.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"identify-push.d.ts","sourceRoot":"","sources":["../../src/identify-push.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAevD,OAAO,EAAE,gBAAgB,EAAyC,MAAM,YAAY,CAAA;AACpF,OAAO,KAAK,EAAE,YAAY,IAAI,qBAAqB,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AACjH,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAGtE,qBAAa,YAAa,SAAQ,gBAAiB,YAAW,SAAS,EAAE,qBAAqB;IAC5F,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAmB;IACrD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;IACpC,OAAO,CAAC,KAAK,CAAY;gBAEZ,UAAU,EAAE,sBAAsB,EAAE,IAAI,GAAE,gBAAqB;IAsB5E,CAAC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAE9B;IAED;;OAEG;IACG,IAAI,IAAK,OAAO,CAAC,IAAI,CAAC;YAId,eAAe;IA0E7B;;OAEG;IACG,cAAc,CAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAsB7E"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { serviceCapabilities } from '@libp2p/interface';
|
|
2
2
|
import { RecordEnvelope, PeerRecord } from '@libp2p/peer-record';
|
|
3
|
-
import { debounce } from '@libp2p/utils
|
|
3
|
+
import { debounce, pbStream } from '@libp2p/utils';
|
|
4
4
|
import { protocols } from '@multiformats/multiaddr';
|
|
5
5
|
import drain from 'it-drain';
|
|
6
6
|
import parallel from 'it-parallel';
|
|
7
|
-
import { pbStream } from 'it-protobuf-stream';
|
|
8
7
|
import { setMaxListeners } from 'main-event';
|
|
9
8
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string';
|
|
10
9
|
import { toString as uint8ArrayToString } from 'uint8arrays/to-string';
|
|
@@ -48,20 +47,20 @@ export class IdentifyPush extends AbstractIdentify {
|
|
|
48
47
|
return;
|
|
49
48
|
}
|
|
50
49
|
try {
|
|
51
|
-
const listenAddresses = this.addressManager.getAddresses().map(ma => ma.decapsulateCode(protocols('p2p').code));
|
|
50
|
+
const listenAddresses = this.components.addressManager.getAddresses().map(ma => ma.decapsulateCode(protocols('p2p').code));
|
|
52
51
|
const peerRecord = new PeerRecord({
|
|
53
|
-
peerId: this.peerId,
|
|
52
|
+
peerId: this.components.peerId,
|
|
54
53
|
multiaddrs: listenAddresses
|
|
55
54
|
});
|
|
56
|
-
const signedPeerRecord = await RecordEnvelope.seal(peerRecord, this.privateKey);
|
|
57
|
-
const supportedProtocols = this.registrar.getProtocols();
|
|
58
|
-
const peer = await this.peerStore.get(this.peerId);
|
|
55
|
+
const signedPeerRecord = await RecordEnvelope.seal(peerRecord, this.components.privateKey);
|
|
56
|
+
const supportedProtocols = this.components.registrar.getProtocols();
|
|
57
|
+
const peer = await this.components.peerStore.get(this.components.peerId);
|
|
59
58
|
const agentVersion = uint8ArrayToString(peer.metadata.get('AgentVersion') ?? uint8ArrayFromString(this.host.agentVersion));
|
|
60
59
|
const protocolVersion = uint8ArrayToString(peer.metadata.get('ProtocolVersion') ?? uint8ArrayFromString(this.host.protocolVersion));
|
|
61
60
|
const self = this;
|
|
62
61
|
async function* pushToConnections() {
|
|
63
62
|
for (const connection of self.connectionManager.getConnections()) {
|
|
64
|
-
const peer = await self.peerStore.get(connection.remotePeer);
|
|
63
|
+
const peer = await self.components.peerStore.get(connection.remotePeer);
|
|
65
64
|
if (!peer.protocols.includes(self.protocol)) {
|
|
66
65
|
continue;
|
|
67
66
|
}
|
|
@@ -91,8 +90,9 @@ export class IdentifyPush extends AbstractIdentify {
|
|
|
91
90
|
});
|
|
92
91
|
}
|
|
93
92
|
catch (err) {
|
|
94
|
-
// Just log errors
|
|
95
|
-
|
|
93
|
+
// Just log errors if the stream was opened
|
|
94
|
+
const log = stream?.log.newScope('identify-push');
|
|
95
|
+
log?.error('could not push identify update to peer', err);
|
|
96
96
|
stream?.abort(err);
|
|
97
97
|
}
|
|
98
98
|
};
|
|
@@ -109,28 +109,21 @@ export class IdentifyPush extends AbstractIdentify {
|
|
|
109
109
|
/**
|
|
110
110
|
* Reads the Identify Push message from the given `connection`
|
|
111
111
|
*/
|
|
112
|
-
async handleProtocol(
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
throw new Error('received push from ourselves?');
|
|
117
|
-
}
|
|
118
|
-
const options = {
|
|
119
|
-
signal: AbortSignal.timeout(this.timeout)
|
|
120
|
-
};
|
|
121
|
-
const pb = pbStream(stream, {
|
|
122
|
-
maxDataLength: this.maxMessageSize
|
|
123
|
-
}).pb(IdentifyMessage);
|
|
124
|
-
const message = await pb.read(options);
|
|
125
|
-
await stream.close(options);
|
|
126
|
-
await consumeIdentifyMessage(this.peerStore, this.events, this.log, connection, message);
|
|
127
|
-
}
|
|
128
|
-
catch (err) {
|
|
129
|
-
this.log.error('received invalid message', err);
|
|
130
|
-
stream.abort(err);
|
|
131
|
-
return;
|
|
112
|
+
async handleProtocol(stream, connection) {
|
|
113
|
+
const log = stream.log.newScope('identify-push');
|
|
114
|
+
if (this.components.peerId.equals(connection.remotePeer)) {
|
|
115
|
+
throw new Error('received push from ourselves?');
|
|
132
116
|
}
|
|
133
|
-
|
|
117
|
+
const options = {
|
|
118
|
+
signal: AbortSignal.timeout(this.timeout)
|
|
119
|
+
};
|
|
120
|
+
const pb = pbStream(stream, {
|
|
121
|
+
maxDataLength: this.maxMessageSize
|
|
122
|
+
}).pb(IdentifyMessage);
|
|
123
|
+
const message = await pb.read(options);
|
|
124
|
+
await stream.close(options);
|
|
125
|
+
await consumeIdentifyMessage(this.components.peerStore, this.components.events, log, connection, message);
|
|
126
|
+
log.trace('handled push from %p', connection.remotePeer);
|
|
134
127
|
}
|
|
135
128
|
}
|
|
136
129
|
//# sourceMappingURL=identify-push.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identify-push.js","sourceRoot":"","sources":["../../src/identify-push.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"identify-push.js","sourceRoot":"","sources":["../../src/identify-push.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,KAAK,MAAM,UAAU,CAAA;AAC5B,OAAO,QAAQ,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC5E,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AACtE,OAAO,EACL,sCAAsC,EACtC,yCAAyC,EACzC,gBAAgB,EACjB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAKpF,MAAM,OAAO,YAAa,SAAQ,gBAAgB;IAC/B,iBAAiB,CAA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
|
package/dist/src/identify.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { serviceCapabilities } from '@libp2p/interface';
|
|
|
2
2
|
import { Identify as IdentifyMessage } from './pb/message.js';
|
|
3
3
|
import { AbstractIdentify } from './utils.js';
|
|
4
4
|
import type { Identify as IdentifyInterface, IdentifyComponents, IdentifyInit } from './index.js';
|
|
5
|
-
import type { IdentifyResult, AbortOptions, Connection,
|
|
5
|
+
import type { IdentifyResult, AbortOptions, Connection, Stream, Startable } from '@libp2p/interface';
|
|
6
6
|
export declare class Identify extends AbstractIdentify implements Startable, IdentifyInterface {
|
|
7
7
|
constructor(components: IdentifyComponents, init?: IdentifyInit);
|
|
8
8
|
[serviceCapabilities]: string[];
|
|
@@ -13,6 +13,6 @@ export declare class Identify extends AbstractIdentify implements Startable, Ide
|
|
|
13
13
|
* Sends the `Identify` response with the Signed Peer Record
|
|
14
14
|
* to the requesting peer over the given `connection`
|
|
15
15
|
*/
|
|
16
|
-
handleProtocol(
|
|
16
|
+
handleProtocol(stream: Stream, connection: Connection): Promise<void>;
|
|
17
17
|
}
|
|
18
18
|
//# sourceMappingURL=identify.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identify.d.ts","sourceRoot":"","sources":["../../src/identify.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"identify.d.ts","sourceRoot":"","sources":["../../src/identify.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAW5E,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAA4D,MAAM,YAAY,CAAA;AACvG,OAAO,KAAK,EAAE,QAAQ,IAAI,iBAAiB,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACjG,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAU,MAAM,mBAAmB,CAAA;AAE5G,qBAAa,QAAS,SAAQ,gBAAiB,YAAW,SAAS,EAAE,iBAAiB;gBACvE,UAAU,EAAE,kBAAkB,EAAE,IAAI,GAAE,YAAiB;IAiBpE,CAAC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAE9B;IAEK,SAAS,CAAE,UAAU,EAAE,UAAU,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,eAAe,CAAC;IAuCxF,QAAQ,CAAE,UAAU,EAAE,UAAU,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,cAAc,CAAC;IAgC5F,OAAO,CAAC,uBAAuB;IAgC/B;;;OAGG;IACG,cAAc,CAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAkD7E"}
|
package/dist/src/identify.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { publicKeyFromProtobuf, publicKeyToProtobuf } from '@libp2p/crypto/keys';
|
|
2
|
-
import { InvalidMessageError,
|
|
2
|
+
import { InvalidMessageError, serviceCapabilities } from '@libp2p/interface';
|
|
3
3
|
import { peerIdFromCID } from '@libp2p/peer-id';
|
|
4
4
|
import { RecordEnvelope, PeerRecord } from '@libp2p/peer-record';
|
|
5
|
-
import { isGlobalUnicast } from '@libp2p/utils
|
|
6
|
-
import {
|
|
7
|
-
import { CODE_IP6, CODE_IP6ZONE, protocols } from '@multiformats/multiaddr';
|
|
5
|
+
import { isGlobalUnicast, isPrivate, pbStream } from '@libp2p/utils';
|
|
6
|
+
import { CODE_IP6, CODE_IP6ZONE, CODE_P2P } from '@multiformats/multiaddr';
|
|
8
7
|
import { IP_OR_DOMAIN, TCP } from '@multiformats/multiaddr-matcher';
|
|
9
|
-
import { pbStream } from 'it-protobuf-stream';
|
|
10
8
|
import { setMaxListeners } from 'main-event';
|
|
11
9
|
import { MULTICODEC_IDENTIFY_PROTOCOL_NAME, MULTICODEC_IDENTIFY_PROTOCOL_VERSION } from './consts.js';
|
|
12
10
|
import { Identify as IdentifyMessage } from './pb/message.js';
|
|
@@ -23,13 +21,7 @@ export class Identify extends AbstractIdentify {
|
|
|
23
21
|
components.events.addEventListener('connection:open', (evt) => {
|
|
24
22
|
const connection = evt.detail;
|
|
25
23
|
this.identify(connection)
|
|
26
|
-
.catch(
|
|
27
|
-
if (err.name === UnsupportedProtocolError.name) {
|
|
28
|
-
// the remote did not support identify, ignore the error
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
this.log.error('error during identify trigged by connection:open', err);
|
|
32
|
-
});
|
|
24
|
+
.catch(() => { });
|
|
33
25
|
});
|
|
34
26
|
}
|
|
35
27
|
}
|
|
@@ -38,6 +30,7 @@ export class Identify extends AbstractIdentify {
|
|
|
38
30
|
];
|
|
39
31
|
async _identify(connection, options = {}) {
|
|
40
32
|
let stream;
|
|
33
|
+
let log;
|
|
41
34
|
if (options.signal == null) {
|
|
42
35
|
const signal = AbortSignal.timeout(this.timeout);
|
|
43
36
|
setMaxListeners(Infinity, signal);
|
|
@@ -51,14 +44,18 @@ export class Identify extends AbstractIdentify {
|
|
|
51
44
|
...options,
|
|
52
45
|
runOnLimitedConnection: this.runOnLimitedConnection
|
|
53
46
|
});
|
|
47
|
+
log = stream.log.newScope('identify');
|
|
54
48
|
const pb = pbStream(stream, {
|
|
55
49
|
maxDataLength: this.maxMessageSize
|
|
56
50
|
}).pb(IdentifyMessage);
|
|
51
|
+
log('read response');
|
|
57
52
|
const message = await pb.read(options);
|
|
58
|
-
|
|
53
|
+
log('close write');
|
|
54
|
+
await pb.unwrap().unwrap().close(options);
|
|
59
55
|
return message;
|
|
60
56
|
}
|
|
61
57
|
catch (err) {
|
|
58
|
+
log?.error('identify failed - %e', err);
|
|
62
59
|
stream?.abort(err);
|
|
63
60
|
throw err;
|
|
64
61
|
}
|
|
@@ -67,21 +64,21 @@ export class Identify extends AbstractIdentify {
|
|
|
67
64
|
const message = await this._identify(connection, options);
|
|
68
65
|
const { publicKey, protocols, observedAddr } = message;
|
|
69
66
|
if (publicKey == null) {
|
|
70
|
-
throw new InvalidMessageError('
|
|
67
|
+
throw new InvalidMessageError('Public key was missing from identify message');
|
|
71
68
|
}
|
|
72
69
|
const key = publicKeyFromProtobuf(publicKey);
|
|
73
70
|
const id = peerIdFromCID(key.toCID());
|
|
74
71
|
if (!connection.remotePeer.equals(id)) {
|
|
75
|
-
throw new InvalidMessageError('
|
|
72
|
+
throw new InvalidMessageError('Identified peer does not match the expected peer');
|
|
76
73
|
}
|
|
77
|
-
if (this.peerId.equals(id)) {
|
|
78
|
-
throw new InvalidMessageError('
|
|
74
|
+
if (this.components.peerId.equals(id)) {
|
|
75
|
+
throw new InvalidMessageError('Identified peer is our own peer id?');
|
|
79
76
|
}
|
|
80
77
|
// if the observed address is publicly routable, add it to the address
|
|
81
78
|
// manager for verification via AutoNAT
|
|
82
79
|
this.maybeAddObservedAddress(observedAddr);
|
|
83
|
-
this.log('
|
|
84
|
-
return consumeIdentifyMessage(this.peerStore, this.events, this.log, connection, message);
|
|
80
|
+
this.log('completed for peer %p and protocols %o', id, protocols);
|
|
81
|
+
return consumeIdentifyMessage(this.components.peerStore, this.components.events, this.log, connection, message);
|
|
85
82
|
}
|
|
86
83
|
maybeAddObservedAddress(observedAddr) {
|
|
87
84
|
const cleanObservedAddr = getCleanMultiaddr(observedAddr);
|
|
@@ -90,7 +87,6 @@ export class Identify extends AbstractIdentify {
|
|
|
90
87
|
}
|
|
91
88
|
this.log.trace('our observed address was %a', cleanObservedAddr);
|
|
92
89
|
if (isPrivate(cleanObservedAddr)) {
|
|
93
|
-
this.log.trace('our observed address was private');
|
|
94
90
|
return;
|
|
95
91
|
}
|
|
96
92
|
const tuples = cleanObservedAddr.getComponents();
|
|
@@ -106,52 +102,52 @@ export class Identify extends AbstractIdentify {
|
|
|
106
102
|
return;
|
|
107
103
|
}
|
|
108
104
|
this.log.trace('storing the observed address');
|
|
109
|
-
this.addressManager.addObservedAddr(cleanObservedAddr);
|
|
105
|
+
this.components.addressManager.addObservedAddr(cleanObservedAddr);
|
|
110
106
|
}
|
|
111
107
|
/**
|
|
112
108
|
* Sends the `Identify` response with the Signed Peer Record
|
|
113
109
|
* to the requesting peer over the given `connection`
|
|
114
110
|
*/
|
|
115
|
-
async handleProtocol(
|
|
116
|
-
const
|
|
111
|
+
async handleProtocol(stream, connection) {
|
|
112
|
+
const log = stream.log.newScope('identify');
|
|
117
113
|
const signal = AbortSignal.timeout(this.timeout);
|
|
118
114
|
setMaxListeners(Infinity, signal);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const envelope = await RecordEnvelope.seal(peerRecord, this.privateKey);
|
|
129
|
-
signedPeerRecord = envelope.marshal().subarray();
|
|
130
|
-
}
|
|
131
|
-
let observedAddr = connection.remoteAddr.bytes;
|
|
132
|
-
if (!IP_OR_DOMAIN.matches(connection.remoteAddr)) {
|
|
133
|
-
observedAddr = undefined;
|
|
134
|
-
}
|
|
135
|
-
const pb = pbStream(stream).pb(IdentifyMessage);
|
|
136
|
-
await pb.write({
|
|
137
|
-
protocolVersion: this.host.protocolVersion,
|
|
138
|
-
agentVersion: this.host.agentVersion,
|
|
139
|
-
publicKey: publicKeyToProtobuf(this.privateKey.publicKey),
|
|
140
|
-
listenAddrs: multiaddrs.map(addr => addr.bytes),
|
|
141
|
-
signedPeerRecord,
|
|
142
|
-
observedAddr,
|
|
143
|
-
protocols: peerData.protocols
|
|
144
|
-
}, {
|
|
145
|
-
signal
|
|
115
|
+
const peerData = await this.components.peerStore.get(this.components.peerId, {
|
|
116
|
+
signal
|
|
117
|
+
});
|
|
118
|
+
const multiaddrs = this.components.addressManager.getAddresses().map(ma => ma.decapsulateCode(CODE_P2P));
|
|
119
|
+
let signedPeerRecord = peerData.peerRecordEnvelope;
|
|
120
|
+
if (multiaddrs.length > 0 && signedPeerRecord == null) {
|
|
121
|
+
const peerRecord = new PeerRecord({
|
|
122
|
+
peerId: this.components.peerId,
|
|
123
|
+
multiaddrs
|
|
146
124
|
});
|
|
147
|
-
await
|
|
125
|
+
const envelope = await RecordEnvelope.seal(peerRecord, this.components.privateKey, {
|
|
148
126
|
signal
|
|
149
127
|
});
|
|
128
|
+
signedPeerRecord = envelope.marshal().subarray();
|
|
150
129
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
130
|
+
let observedAddr = connection.remoteAddr.bytes;
|
|
131
|
+
if (!IP_OR_DOMAIN.matches(connection.remoteAddr)) {
|
|
132
|
+
observedAddr = undefined;
|
|
154
133
|
}
|
|
134
|
+
const pb = pbStream(stream).pb(IdentifyMessage);
|
|
135
|
+
log('send response');
|
|
136
|
+
await pb.write({
|
|
137
|
+
protocolVersion: this.host.protocolVersion,
|
|
138
|
+
agentVersion: this.host.agentVersion,
|
|
139
|
+
publicKey: publicKeyToProtobuf(this.components.privateKey.publicKey),
|
|
140
|
+
listenAddrs: multiaddrs.map(addr => addr.bytes),
|
|
141
|
+
signedPeerRecord,
|
|
142
|
+
observedAddr,
|
|
143
|
+
protocols: peerData.protocols
|
|
144
|
+
}, {
|
|
145
|
+
signal
|
|
146
|
+
});
|
|
147
|
+
log('close write');
|
|
148
|
+
await pb.unwrap().unwrap().close({
|
|
149
|
+
signal
|
|
150
|
+
});
|
|
155
151
|
}
|
|
156
152
|
}
|
|
157
153
|
//# sourceMappingURL=identify.js.map
|
package/dist/src/identify.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identify.js","sourceRoot":"","sources":["../../src/identify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAChF,OAAO,EAAE,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"identify.js","sourceRoot":"","sources":["../../src/identify.ts"],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AC,IAAI,CAAC,eAAe;YAC1C,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY;YACpC,SAAS,EAAE,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC;YACpE,WAAW,EAAE,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YAC/C,gBAAgB;YAChB,YAAY;YACZ,SAAS,EAAE,QAAQ,CAAC,SAAS;SAC9B,EAAE;YACD,MAAM;SACP,CAAC,CAAA;QAEF,GAAG,CAAC,aAAa,CAAC,CAAA;QAClB,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC;YAC/B,MAAM;SACP,CAAC,CAAA;IACJ,CAAC;CACF"}
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { IdentifyComponents, IdentifyInit } from './index.js';
|
|
2
2
|
import type { Identify as IdentifyMessage } from './pb/message.js';
|
|
3
|
-
import type { Libp2pEvents, IdentifyResult, Logger, Connection, PeerStore, NodeInfo, Startable,
|
|
4
|
-
import type { AddressManager, Registrar } from '@libp2p/interface-internal';
|
|
3
|
+
import type { Libp2pEvents, IdentifyResult, Logger, Connection, PeerStore, NodeInfo, Startable, Stream } from '@libp2p/interface';
|
|
5
4
|
import type { Multiaddr } from '@multiformats/multiaddr';
|
|
6
5
|
import type { TypedEventTarget } from 'main-event';
|
|
7
6
|
export declare const defaultValues: {
|
|
@@ -31,25 +30,20 @@ export declare abstract class AbstractIdentify implements Startable {
|
|
|
31
30
|
protocolVersion: string;
|
|
32
31
|
agentVersion: string;
|
|
33
32
|
};
|
|
33
|
+
protected components: IdentifyComponents;
|
|
34
34
|
protected protocol: string;
|
|
35
35
|
protected started: boolean;
|
|
36
36
|
protected readonly timeout: number;
|
|
37
|
-
protected readonly peerId: PeerId;
|
|
38
|
-
protected readonly privateKey: PrivateKey;
|
|
39
|
-
protected readonly peerStore: PeerStore;
|
|
40
|
-
protected readonly registrar: Registrar;
|
|
41
|
-
protected readonly addressManager: AddressManager;
|
|
42
37
|
private readonly maxInboundStreams;
|
|
43
38
|
private readonly maxOutboundStreams;
|
|
44
39
|
protected readonly maxMessageSize: number;
|
|
45
40
|
protected readonly maxObservedAddresses: number;
|
|
46
|
-
protected readonly events: TypedEventTarget<Libp2pEvents>;
|
|
47
41
|
protected readonly runOnLimitedConnection: boolean;
|
|
48
42
|
protected readonly log: Logger;
|
|
49
43
|
constructor(components: IdentifyComponents, init: AbstractIdentifyInit);
|
|
50
44
|
isStarted(): boolean;
|
|
51
45
|
start(): Promise<void>;
|
|
52
46
|
stop(): Promise<void>;
|
|
53
|
-
protected abstract handleProtocol(
|
|
47
|
+
protected abstract handleProtocol(stream: Stream, connection: Connection): Promise<void>;
|
|
54
48
|
}
|
|
55
49
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/src/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAClE,OAAO,KAAK,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAoB,MAAM,EAAE,UAAU,EAAkB,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAClE,OAAO,KAAK,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAoB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AAc,EAAE,MAAM,CAAA;IACzC,SAAS,CAAC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAA;IAC/C,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAA;IAClD,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;gBAEjB,UAAU,EAAE,kBAAkB,EAAE,IAAI,EAAE,oBAAoB;IAsBvE,SAAS,IAAK,OAAO;IAIf,KAAK,IAAK,OAAO,CAAC,IAAI,CAAC;IAqBvB,IAAI,IAAK,OAAO,CAAC,IAAI,CAAC;IAM5B,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAC1F"}
|
package/dist/src/utils.js
CHANGED
|
@@ -144,30 +144,20 @@ export async function consumeIdentifyMessage(peerStore, events, log, connection,
|
|
|
144
144
|
}
|
|
145
145
|
export class AbstractIdentify {
|
|
146
146
|
host;
|
|
147
|
+
components;
|
|
147
148
|
protocol;
|
|
148
149
|
started;
|
|
149
150
|
timeout;
|
|
150
|
-
peerId;
|
|
151
|
-
privateKey;
|
|
152
|
-
peerStore;
|
|
153
|
-
registrar;
|
|
154
|
-
addressManager;
|
|
155
151
|
maxInboundStreams;
|
|
156
152
|
maxOutboundStreams;
|
|
157
153
|
maxMessageSize;
|
|
158
154
|
maxObservedAddresses;
|
|
159
|
-
events;
|
|
160
155
|
runOnLimitedConnection;
|
|
161
156
|
log;
|
|
162
157
|
constructor(components, init) {
|
|
163
158
|
this.protocol = init.protocol;
|
|
164
159
|
this.started = false;
|
|
165
|
-
this.
|
|
166
|
-
this.privateKey = components.privateKey;
|
|
167
|
-
this.peerStore = components.peerStore;
|
|
168
|
-
this.registrar = components.registrar;
|
|
169
|
-
this.addressManager = components.addressManager;
|
|
170
|
-
this.events = components.events;
|
|
160
|
+
this.components = components;
|
|
171
161
|
this.log = init.log;
|
|
172
162
|
this.timeout = init.timeout ?? defaultValues.timeout;
|
|
173
163
|
this.maxInboundStreams = init.maxInboundStreams ?? defaultValues.maxInboundStreams;
|
|
@@ -180,6 +170,7 @@ export class AbstractIdentify {
|
|
|
180
170
|
protocolVersion: `${init.protocolPrefix ?? defaultValues.protocolPrefix}/${IDENTIFY_PROTOCOL_VERSION}`,
|
|
181
171
|
agentVersion: getAgentVersion(components.nodeInfo, init.agentVersion)
|
|
182
172
|
};
|
|
173
|
+
this.handleProtocol = this.handleProtocol.bind(this);
|
|
183
174
|
}
|
|
184
175
|
isStarted() {
|
|
185
176
|
return this.started;
|
|
@@ -188,17 +179,13 @@ export class AbstractIdentify {
|
|
|
188
179
|
if (this.started) {
|
|
189
180
|
return;
|
|
190
181
|
}
|
|
191
|
-
await this.peerStore.merge(this.peerId, {
|
|
182
|
+
await this.components.peerStore.merge(this.components.peerId, {
|
|
192
183
|
metadata: {
|
|
193
184
|
AgentVersion: uint8ArrayFromString(this.host.agentVersion),
|
|
194
185
|
ProtocolVersion: uint8ArrayFromString(this.host.protocolVersion)
|
|
195
186
|
}
|
|
196
187
|
});
|
|
197
|
-
await this.registrar.handle(this.protocol,
|
|
198
|
-
void this.handleProtocol(data).catch(err => {
|
|
199
|
-
this.log.error(err);
|
|
200
|
-
});
|
|
201
|
-
}, {
|
|
188
|
+
await this.components.registrar.handle(this.protocol, this.handleProtocol, {
|
|
202
189
|
maxInboundStreams: this.maxInboundStreams,
|
|
203
190
|
maxOutboundStreams: this.maxOutboundStreams,
|
|
204
191
|
runOnLimitedConnection: this.runOnLimitedConnection
|
|
@@ -206,7 +193,7 @@ export class AbstractIdentify {
|
|
|
206
193
|
this.started = true;
|
|
207
194
|
}
|
|
208
195
|
async stop() {
|
|
209
|
-
await this.registrar.unhandle(this.protocol);
|
|
196
|
+
await this.components.registrar.unhandle(this.protocol);
|
|
210
197
|
this.started = false;
|
|
211
198
|
}
|
|
212
199
|
}
|
package/dist/src/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACpE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC5E,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACpE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC5E,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAOxG,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,cAAc,EAAE,MAAM;IACtB,OAAO,EAAE,IAAI;IACb,iBAAiB,EAAE,CAAC;IACpB,kBAAkB,EAAE,CAAC;IACrB,oBAAoB,EAAE,EAAE;IACxB,cAAc,EAAE,yBAAyB;IACzC,mBAAmB,EAAE,IAAI;IACzB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
1
|
{
|
|
2
2
|
"name": "@libp2p/identify",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.39-a02cb0461",
|
|
4
4
|
"description": "Implementation of the Identify Protocol",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/protocol-identify#readme",
|
|
@@ -45,30 +45,27 @@
|
|
|
45
45
|
"doc-check": "aegir doc-check"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@libp2p/crypto": "
|
|
49
|
-
"@libp2p/interface": "
|
|
50
|
-
"@libp2p/interface-internal": "
|
|
51
|
-
"@libp2p/peer-id": "
|
|
52
|
-
"@libp2p/peer-record": "
|
|
53
|
-
"@libp2p/utils": "
|
|
54
|
-
"@multiformats/multiaddr": "^12.
|
|
55
|
-
"@multiformats/multiaddr-matcher": "^2.0.
|
|
56
|
-
"it-drain": "^3.0.
|
|
57
|
-
"it-parallel": "^3.0.
|
|
58
|
-
"it-protobuf-stream": "^2.0.2",
|
|
48
|
+
"@libp2p/crypto": "5.1.8-a02cb0461",
|
|
49
|
+
"@libp2p/interface": "2.11.0-a02cb0461",
|
|
50
|
+
"@libp2p/interface-internal": "2.3.19-a02cb0461",
|
|
51
|
+
"@libp2p/peer-id": "5.1.9-a02cb0461",
|
|
52
|
+
"@libp2p/peer-record": "8.0.35-a02cb0461",
|
|
53
|
+
"@libp2p/utils": "6.7.2-a02cb0461",
|
|
54
|
+
"@multiformats/multiaddr": "^12.5.1",
|
|
55
|
+
"@multiformats/multiaddr-matcher": "^2.0.2",
|
|
56
|
+
"it-drain": "^3.0.10",
|
|
57
|
+
"it-parallel": "^3.0.13",
|
|
59
58
|
"main-event": "^1.0.1",
|
|
60
|
-
"protons-runtime": "^5.
|
|
59
|
+
"protons-runtime": "^5.6.0",
|
|
61
60
|
"uint8arraylist": "^2.4.8",
|
|
62
61
|
"uint8arrays": "^5.1.0"
|
|
63
62
|
},
|
|
64
63
|
"devDependencies": {
|
|
65
|
-
"@libp2p/logger": "
|
|
66
|
-
"aegir": "^47.0.
|
|
64
|
+
"@libp2p/logger": "5.2.0-a02cb0461",
|
|
65
|
+
"aegir": "^47.0.21",
|
|
67
66
|
"delay": "^6.0.0",
|
|
68
67
|
"it-length-prefixed": "^10.0.1",
|
|
69
|
-
"
|
|
70
|
-
"it-pushable": "^3.2.3",
|
|
71
|
-
"protons": "^7.6.1",
|
|
68
|
+
"protons": "^7.7.0",
|
|
72
69
|
"sinon-ts": "^2.0.0"
|
|
73
70
|
},
|
|
74
71
|
"sideEffects": false
|