@libp2p/identify 3.0.38 → 3.0.39-6059227cb
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 +25 -32
- 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/index.d.ts +0 -6
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/utils.d.ts +3 -10
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +7 -26
- package/dist/src/utils.js.map +1 -1
- package/package.json +15 -18
- package/src/identify-push.ts +27 -33
- package/src/identify.ts +57 -62
- package/src/index.ts +0 -7
- package/src/utils.ts +10 -31
- 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
|
|
4
|
-
import {
|
|
3
|
+
import { debounce, pbStream } from '@libp2p/utils';
|
|
4
|
+
import { CODE_P2P } 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(
|
|
50
|
+
const listenAddresses = this.components.addressManager.getAddresses().map(ma => ma.decapsulateCode(CODE_P2P));
|
|
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,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAClD,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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AAC,sBAAsB,EAAE,UAAU,CAAC,UAAU,CAAC,CAAA;IAC1D,CAAC;CACF"}
|
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,mBAAm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,CAAA;QACpB,MAAM,EAAE,CAAC,KAAK,CAAC;YACb,eAAe,EAAE,IAAI,CAAC,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/index.d.ts
CHANGED
|
@@ -50,12 +50,6 @@ export interface IdentifyInit {
|
|
|
50
50
|
* @default 'ipfs'
|
|
51
51
|
*/
|
|
52
52
|
protocolPrefix?: string;
|
|
53
|
-
/**
|
|
54
|
-
* What details we should send as part of an identify message
|
|
55
|
-
*
|
|
56
|
-
* @deprecated Use `nodeInfo.userAgent` in the main libp2p config instead
|
|
57
|
-
*/
|
|
58
|
-
agentVersion?: string;
|
|
59
53
|
/**
|
|
60
54
|
* How long we should wait for a remote peer to send their identify response
|
|
61
55
|
*
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,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AQ,IAAI,aAAa,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EAAE,YAAY,IAAI,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,eAAe,CAAA;AA8HzD,MAAM,UAAU,QAAQ,CAAE,OAAqB,EAAE;IAC/C,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;AAC5D,CAAC;AAED,MAAM,UAAU,YAAY,CAAE,OAAyB,EAAE;IACvD,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,iBAAiB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;AAChE,CAAC"}
|
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,
|
|
4
|
-
import type { AddressManager, Registrar } from '@libp2p/interface-internal';
|
|
3
|
+
import type { Libp2pEvents, IdentifyResult, Logger, Connection, PeerStore, 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: {
|
|
@@ -20,7 +19,6 @@ export declare const defaultValues: {
|
|
|
20
19
|
* Takes the `addr` and converts it to a Multiaddr if possible
|
|
21
20
|
*/
|
|
22
21
|
export declare function getCleanMultiaddr(addr: Uint8Array | string | null | undefined): Multiaddr | undefined;
|
|
23
|
-
export declare function getAgentVersion(nodeInfo: NodeInfo, agentVersion?: string): string;
|
|
24
22
|
export declare function consumeIdentifyMessage(peerStore: PeerStore, events: TypedEventTarget<Libp2pEvents>, log: Logger, connection: Connection, message: IdentifyMessage): Promise<IdentifyResult>;
|
|
25
23
|
export interface AbstractIdentifyInit extends IdentifyInit {
|
|
26
24
|
protocol: string;
|
|
@@ -31,25 +29,20 @@ export declare abstract class AbstractIdentify implements Startable {
|
|
|
31
29
|
protocolVersion: string;
|
|
32
30
|
agentVersion: string;
|
|
33
31
|
};
|
|
32
|
+
protected components: IdentifyComponents;
|
|
34
33
|
protected protocol: string;
|
|
35
34
|
protected started: boolean;
|
|
36
35
|
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
36
|
private readonly maxInboundStreams;
|
|
43
37
|
private readonly maxOutboundStreams;
|
|
44
38
|
protected readonly maxMessageSize: number;
|
|
45
39
|
protected readonly maxObservedAddresses: number;
|
|
46
|
-
protected readonly events: TypedEventTarget<Libp2pEvents>;
|
|
47
40
|
protected readonly runOnLimitedConnection: boolean;
|
|
48
41
|
protected readonly log: Logger;
|
|
49
42
|
constructor(components: IdentifyComponents, init: AbstractIdentifyInit);
|
|
50
43
|
isStarted(): boolean;
|
|
51
44
|
start(): Promise<void>;
|
|
52
45
|
stop(): Promise<void>;
|
|
53
|
-
protected abstract handleProtocol(
|
|
46
|
+
protected abstract handleProtocol(stream: Stream, connection: Connection): Promise<void>;
|
|
54
47
|
}
|
|
55
48
|
//# 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,M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A;KACrB,CAAA;IAED,SAAS,CAAC,UAAU,EAAE,kBAAkB,CAAA;IACxC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAA;IAC1B,SAAS,CAAC,OAAO,EAAE,OAAO,CAAA;IAC1B,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IAClC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAQ;IAC1C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAQ;IAC3C,SAAS,CAAC,QAAQ,CAAC,cAAc,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
|
@@ -29,12 +29,6 @@ export function getCleanMultiaddr(addr) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
export function getAgentVersion(nodeInfo, agentVersion) {
|
|
33
|
-
if (agentVersion != null) {
|
|
34
|
-
return agentVersion;
|
|
35
|
-
}
|
|
36
|
-
return nodeInfo.userAgent;
|
|
37
|
-
}
|
|
38
32
|
export async function consumeIdentifyMessage(peerStore, events, log, connection, message) {
|
|
39
33
|
log('received identify from %p', connection.remotePeer);
|
|
40
34
|
if (message == null) {
|
|
@@ -144,30 +138,20 @@ export async function consumeIdentifyMessage(peerStore, events, log, connection,
|
|
|
144
138
|
}
|
|
145
139
|
export class AbstractIdentify {
|
|
146
140
|
host;
|
|
141
|
+
components;
|
|
147
142
|
protocol;
|
|
148
143
|
started;
|
|
149
144
|
timeout;
|
|
150
|
-
peerId;
|
|
151
|
-
privateKey;
|
|
152
|
-
peerStore;
|
|
153
|
-
registrar;
|
|
154
|
-
addressManager;
|
|
155
145
|
maxInboundStreams;
|
|
156
146
|
maxOutboundStreams;
|
|
157
147
|
maxMessageSize;
|
|
158
148
|
maxObservedAddresses;
|
|
159
|
-
events;
|
|
160
149
|
runOnLimitedConnection;
|
|
161
150
|
log;
|
|
162
151
|
constructor(components, init) {
|
|
163
152
|
this.protocol = init.protocol;
|
|
164
153
|
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;
|
|
154
|
+
this.components = components;
|
|
171
155
|
this.log = init.log;
|
|
172
156
|
this.timeout = init.timeout ?? defaultValues.timeout;
|
|
173
157
|
this.maxInboundStreams = init.maxInboundStreams ?? defaultValues.maxInboundStreams;
|
|
@@ -178,8 +162,9 @@ export class AbstractIdentify {
|
|
|
178
162
|
// Store self host metadata
|
|
179
163
|
this.host = {
|
|
180
164
|
protocolVersion: `${init.protocolPrefix ?? defaultValues.protocolPrefix}/${IDENTIFY_PROTOCOL_VERSION}`,
|
|
181
|
-
agentVersion:
|
|
165
|
+
agentVersion: components.nodeInfo.userAgent
|
|
182
166
|
};
|
|
167
|
+
this.handleProtocol = this.handleProtocol.bind(this);
|
|
183
168
|
}
|
|
184
169
|
isStarted() {
|
|
185
170
|
return this.started;
|
|
@@ -188,17 +173,13 @@ export class AbstractIdentify {
|
|
|
188
173
|
if (this.started) {
|
|
189
174
|
return;
|
|
190
175
|
}
|
|
191
|
-
await this.peerStore.merge(this.peerId, {
|
|
176
|
+
await this.components.peerStore.merge(this.components.peerId, {
|
|
192
177
|
metadata: {
|
|
193
178
|
AgentVersion: uint8ArrayFromString(this.host.agentVersion),
|
|
194
179
|
ProtocolVersion: uint8ArrayFromString(this.host.protocolVersion)
|
|
195
180
|
}
|
|
196
181
|
});
|
|
197
|
-
await this.registrar.handle(this.protocol,
|
|
198
|
-
void this.handleProtocol(data).catch(err => {
|
|
199
|
-
this.log.error(err);
|
|
200
|
-
});
|
|
201
|
-
}, {
|
|
182
|
+
await this.components.registrar.handle(this.protocol, this.handleProtocol, {
|
|
202
183
|
maxInboundStreams: this.maxInboundStreams,
|
|
203
184
|
maxOutboundStreams: this.maxOutboundStreams,
|
|
204
185
|
runOnLimitedConnection: this.runOnLimitedConnection
|
|
@@ -206,7 +187,7 @@ export class AbstractIdentify {
|
|
|
206
187
|
this.started = true;
|
|
207
188
|
}
|
|
208
189
|
async stop() {
|
|
209
|
-
await this.registrar.unhandle(this.protocol);
|
|
190
|
+
await this.components.registrar.unhandle(this.protocol);
|
|
210
191
|
this.started = false;
|
|
211
192
|
}
|
|
212
193
|
}
|
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;
|
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