diff --git a/examples/libp2p-in-the-browser/package.json b/examples/libp2p-in-the-browser/package.json index f14fcff4b3..48f12e876d 100644 --- a/examples/libp2p-in-the-browser/package.json +++ b/examples/libp2p-in-the-browser/package.json @@ -21,7 +21,7 @@ "libp2p-mplex": "^0.10.0", "libp2p-noise": "^2.0.0", "libp2p-webrtc-star": "^0.20.0", - "libp2p-websockets": "^0.14.0" + "libp2p-websockets": "^0.15.0" }, "devDependencies": { "@babel/cli": "^7.13.10", diff --git a/package.json b/package.json index 31f20e49c6..8b1cbe1e69 100644 --- a/package.json +++ b/package.json @@ -20,15 +20,17 @@ "scripts": { "lint": "aegir lint", "build": "aegir build", - "build:proto": "npm run build:proto:circuit && npm run build:proto:plaintext && npm run build:proto:address-book && npm run build:proto:proto-book && npm run build:proto:peer-record && npm run build:proto:envelope", + "build:proto": "npm run build:proto:circuit && npm run build:proto:identify && npm run build:proto:plaintext && npm run build:proto:address-book && npm run build:proto:proto-book && npm run build:proto:peer-record && npm run build:proto:envelope", "build:proto:circuit": "pbjs -t static-module -w commonjs --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/circuit/protocol/index.js ./src/circuit/protocol/index.proto", + "build:proto:identify": "pbjs -t static-module -w commonjs --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/identify/message.js ./src/identify/message.proto", "build:proto:plaintext": "pbjs -t static-module -w commonjs --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/insecure/proto.js ./src/insecure/proto.proto", "build:proto:address-book": "pbjs -t static-module -w commonjs --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/peer-store/persistent/pb/address-book.js ./src/peer-store/persistent/pb/address-book.proto", "build:proto:proto-book": "pbjs -t static-module -w commonjs --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/peer-store/persistent/pb/proto-book.js ./src/peer-store/persistent/pb/proto-book.proto", "build:proto:peer-record": "pbjs -t static-module -w commonjs --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/record/peer-record/peer-record.js ./src/record/peer-record/peer-record.proto", "build:proto:envelope": "pbjs -t static-module -w commonjs --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/record/envelope/envelope.js ./src/record/envelope/envelope.proto", - "build:proto-types": "npm run build:proto-types:circuit && npm run build:proto-types:plaintext && npm run build:proto-types:address-book && npm run build:proto-types:proto-book && npm run build:proto-types:peer-record && npm run build:proto-types:envelope", + "build:proto-types": "npm run build:proto-types:circuit && npm run build:proto-types:identify && npm run build:proto-types:plaintext && npm run build:proto-types:address-book && npm run build:proto-types:proto-book && npm run build:proto-types:peer-record && npm run build:proto-types:envelope", "build:proto-types:circuit": "pbts -o src/circuit/protocol/index.d.ts src/circuit/protocol/index.js", + "build:proto-types:identify": "pbts -o src/identify/message.d.ts src/identify/message.js", "build:proto-types:plaintext": "pbts -o src/insecure/proto.d.ts src/insecure/proto.js", "build:proto-types:address-book": "pbts -o src/peer-store/persistent/pb/address-book.d.ts src/peer-store/persistent/pb/address-book.js", "build:proto-types:proto-book": "pbts -o src/peer-store/persistent/pb/proto-book.d.ts src/peer-store/persistent/pb/proto-book.js", @@ -100,7 +102,6 @@ "it-map": "^1.0.4", "it-merge": "1.0.0", "it-pipe": "^1.1.0", - "it-protocol-buffers": "^0.2.0", "it-take": "1.0.0", "libp2p-crypto": "^0.19.0", "libp2p-interfaces": "^0.10.0", @@ -121,7 +122,6 @@ "peer-id": "^0.14.2", "private-ip": "^2.1.0", "protobufjs": "^6.10.2", - "protons": "^2.0.0", "retimer": "^3.0.0", "sanitize-filename": "^1.6.3", "set-delayed-interval": "^1.0.0", @@ -147,13 +147,13 @@ "it-pair": "^1.0.0", "it-pushable": "^1.4.0", "libp2p": ".", - "libp2p-bootstrap": "^0.12.0", - "libp2p-delegated-content-routing": "^0.9.0", - "libp2p-delegated-peer-routing": "^0.8.0", - "libp2p-floodsub": "libp2p/js-libp2p-floodsub#chore/update-deps-and-remove-protons", + "libp2p-bootstrap": "^0.12.3", + "libp2p-delegated-content-routing": "^0.10.0", + "libp2p-delegated-peer-routing": "^0.9.0", + "libp2p-floodsub": "^0.25.0", "libp2p-gossipsub": "^0.8.0", "libp2p-kad-dht": "^0.21.0", - "libp2p-mdns": "^0.15.0", + "libp2p-mdns": "^0.16.0", "libp2p-mplex": "^0.10.1", "libp2p-noise": "^2.0.0", "libp2p-tcp": "^0.15.1", diff --git a/src/identify/index.js b/src/identify/index.js index 7cbd8a22b8..498ea0e1f3 100644 --- a/src/identify/index.js +++ b/src/identify/index.js @@ -5,8 +5,6 @@ const log = Object.assign(debug('libp2p:identify'), { error: debug('libp2p:identify:err') }) const errCode = require('err-code') -// @ts-ignore it-protocol-buffers does not have types -const pb = require('it-protocol-buffers') const lp = require('it-length-prefixed') const { pipe } = require('it-pipe') const { collect, take, consume } = require('streaming-iterables') @@ -99,12 +97,12 @@ class IdentifyService { const { stream } = await connection.newStream(MULTICODEC_IDENTIFY_PUSH) await pipe( - [{ + [Message.Identify.encode({ listenAddrs, signedPeerRecord, protocols - }], - pb.encode(Message), + }).finish()], + lp.encode(), stream, consume ) @@ -165,12 +163,12 @@ class IdentifyService { let message try { - message = Message.decode(data) + message = Message.Identify.decode(data) } catch (err) { throw errCode(err, codes.ERR_INVALID_MESSAGE) } - let { + const { publicKey, listenAddrs, protocols, @@ -185,7 +183,7 @@ class IdentifyService { } // Get the observedAddr if there is one - observedAddr = IdentifyService.getCleanMultiaddr(observedAddr) + const cleanObservedAddr = IdentifyService.getCleanMultiaddr(observedAddr) try { const envelope = await Envelope.openAndCertify(signedPeerRecord, PeerRecord.DOMAIN) @@ -199,7 +197,7 @@ class IdentifyService { // LEGACY: Update peers data in PeerStore try { - this.peerStore.addressBook.set(id, listenAddrs.map((/** @type {string} */ addr) => new Multiaddr(addr))) + this.peerStore.addressBook.set(id, listenAddrs.map((addr) => new Multiaddr(addr))) } catch (err) { log.error('received invalid addrs', err) } @@ -208,7 +206,7 @@ class IdentifyService { this.peerStore.metadataBook.set(id, 'AgentVersion', uint8ArrayFromString(message.agentVersion)) // TODO: Add and score our observed addr - log('received observed address of %s', observedAddr) + log('received observed address of %s', cleanObservedAddr) // this.addressManager.addObservedAddr(observedAddr) } @@ -251,7 +249,7 @@ class IdentifyService { const signedPeerRecord = await this.peerStore.addressBook.getRawEnvelope(this.peerId) const protocols = this.peerStore.protoBook.get(this.peerId) || [] - const message = Message.encode({ + const message = Message.Identify.encode({ protocolVersion: this._host.protocolVersion, agentVersion: this._host.agentVersion, publicKey, @@ -259,7 +257,7 @@ class IdentifyService { signedPeerRecord, observedAddr: connection.remoteAddr.bytes, protocols - }) + }).finish() try { await pipe( @@ -293,7 +291,7 @@ class IdentifyService { toBuffer, collect ) - message = Message.decode(data) + message = Message.Identify.decode(data) } catch (err) { return log.error('received invalid message', err) } @@ -313,7 +311,7 @@ class IdentifyService { // LEGACY: Update peers data in PeerStore try { this.peerStore.addressBook.set(id, - message.listenAddrs.map((/** @type {string} */ addr) => new Multiaddr(addr))) + message.listenAddrs.map((addr) => new Multiaddr(addr))) } catch (err) { log.error('received invalid addrs', err) } diff --git a/src/identify/message.d.ts b/src/identify/message.d.ts new file mode 100644 index 0000000000..ba49c586aa --- /dev/null +++ b/src/identify/message.d.ts @@ -0,0 +1,95 @@ +import * as $protobuf from "protobufjs"; +/** Properties of an Identify. */ +export interface IIdentify { + + /** Identify protocolVersion */ + protocolVersion?: (string|null); + + /** Identify agentVersion */ + agentVersion?: (string|null); + + /** Identify publicKey */ + publicKey?: (Uint8Array|null); + + /** Identify listenAddrs */ + listenAddrs?: (Uint8Array[]|null); + + /** Identify observedAddr */ + observedAddr?: (Uint8Array|null); + + /** Identify protocols */ + protocols?: (string[]|null); + + /** Identify signedPeerRecord */ + signedPeerRecord?: (Uint8Array|null); +} + +/** Represents an Identify. */ +export class Identify implements IIdentify { + + /** + * Constructs a new Identify. + * @param [p] Properties to set + */ + constructor(p?: IIdentify); + + /** Identify protocolVersion. */ + public protocolVersion: string; + + /** Identify agentVersion. */ + public agentVersion: string; + + /** Identify publicKey. */ + public publicKey: Uint8Array; + + /** Identify listenAddrs. */ + public listenAddrs: Uint8Array[]; + + /** Identify observedAddr. */ + public observedAddr: Uint8Array; + + /** Identify protocols. */ + public protocols: string[]; + + /** Identify signedPeerRecord. */ + public signedPeerRecord: Uint8Array; + + /** + * Encodes the specified Identify message. Does not implicitly {@link Identify.verify|verify} messages. + * @param m Identify message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: IIdentify, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Identify message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Identify + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): Identify; + + /** + * Creates an Identify message from a plain object. Also converts values to their respective internal types. + * @param d Plain object + * @returns Identify + */ + public static fromObject(d: { [k: string]: any }): Identify; + + /** + * Creates a plain object from an Identify message. Also converts values to other types if specified. + * @param m Identify + * @param [o] Conversion options + * @returns Plain object + */ + public static toObject(m: Identify, o?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Identify to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; +} diff --git a/src/identify/message.js b/src/identify/message.js index 0c01ae97d6..9f4d6e4ec2 100644 --- a/src/identify/message.js +++ b/src/identify/message.js @@ -1,37 +1,328 @@ -'use strict' - -// TODO: IDENTIFY PROTONS -// @ts-ignore protons does not have types -const protons = require('protons') -const schema = ` -message Identify { - // protocolVersion determines compatibility between peers - optional string protocolVersion = 5; // e.g. ipfs/1.0.0 - - // agentVersion is like a UserAgent string in browsers, or client version in bittorrent - // includes the client name and client. - optional string agentVersion = 6; // e.g. go-ipfs/0.1.0 - - // publicKey is this node's public key (which also gives its node.ID) - // - may not need to be sent, as secure channel implies it has been sent. - // - then again, if we change / disable secure channel, may still want it. - optional bytes publicKey = 1; - - // listenAddrs are the multiaddrs the sender node listens for open connections on - repeated bytes listenAddrs = 2; - - // oservedAddr is the multiaddr of the remote endpoint that the sender node perceives - // this is useful information to convey to the other side, as it helps the remote endpoint - // determine whether its connection to the local peer goes through NAT. - optional bytes observedAddr = 4; - - repeated string protocols = 3; - - // signedPeerRecord contains a serialized SignedEnvelope containing a PeerRecord, - // signed by the sending node. It contains the same addresses as the listenAddrs field, but - // in a form that lets us share authenticated addrs with other peers. - optional bytes signedPeerRecord = 8; -} -` - -module.exports = protons(schema).Identify +/*eslint-disable*/ +"use strict"; + +var $protobuf = require("protobufjs/minimal"); + +// Common aliases +var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; + +// Exported root namespace +var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); + +$root.Identify = (function() { + + /** + * Properties of an Identify. + * @exports IIdentify + * @interface IIdentify + * @property {string|null} [protocolVersion] Identify protocolVersion + * @property {string|null} [agentVersion] Identify agentVersion + * @property {Uint8Array|null} [publicKey] Identify publicKey + * @property {Array.|null} [listenAddrs] Identify listenAddrs + * @property {Uint8Array|null} [observedAddr] Identify observedAddr + * @property {Array.|null} [protocols] Identify protocols + * @property {Uint8Array|null} [signedPeerRecord] Identify signedPeerRecord + */ + + /** + * Constructs a new Identify. + * @exports Identify + * @classdesc Represents an Identify. + * @implements IIdentify + * @constructor + * @param {IIdentify=} [p] Properties to set + */ + function Identify(p) { + this.listenAddrs = []; + this.protocols = []; + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) + this[ks[i]] = p[ks[i]]; + } + + /** + * Identify protocolVersion. + * @member {string} protocolVersion + * @memberof Identify + * @instance + */ + Identify.prototype.protocolVersion = ""; + + /** + * Identify agentVersion. + * @member {string} agentVersion + * @memberof Identify + * @instance + */ + Identify.prototype.agentVersion = ""; + + /** + * Identify publicKey. + * @member {Uint8Array} publicKey + * @memberof Identify + * @instance + */ + Identify.prototype.publicKey = $util.newBuffer([]); + + /** + * Identify listenAddrs. + * @member {Array.} listenAddrs + * @memberof Identify + * @instance + */ + Identify.prototype.listenAddrs = $util.emptyArray; + + /** + * Identify observedAddr. + * @member {Uint8Array} observedAddr + * @memberof Identify + * @instance + */ + Identify.prototype.observedAddr = $util.newBuffer([]); + + /** + * Identify protocols. + * @member {Array.} protocols + * @memberof Identify + * @instance + */ + Identify.prototype.protocols = $util.emptyArray; + + /** + * Identify signedPeerRecord. + * @member {Uint8Array} signedPeerRecord + * @memberof Identify + * @instance + */ + Identify.prototype.signedPeerRecord = $util.newBuffer([]); + + /** + * Encodes the specified Identify message. Does not implicitly {@link Identify.verify|verify} messages. + * @function encode + * @memberof Identify + * @static + * @param {IIdentify} m Identify message or plain object to encode + * @param {$protobuf.Writer} [w] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Identify.encode = function encode(m, w) { + if (!w) + w = $Writer.create(); + if (m.publicKey != null && Object.hasOwnProperty.call(m, "publicKey")) + w.uint32(10).bytes(m.publicKey); + if (m.listenAddrs != null && m.listenAddrs.length) { + for (var i = 0; i < m.listenAddrs.length; ++i) + w.uint32(18).bytes(m.listenAddrs[i]); + } + if (m.protocols != null && m.protocols.length) { + for (var i = 0; i < m.protocols.length; ++i) + w.uint32(26).string(m.protocols[i]); + } + if (m.observedAddr != null && Object.hasOwnProperty.call(m, "observedAddr")) + w.uint32(34).bytes(m.observedAddr); + if (m.protocolVersion != null && Object.hasOwnProperty.call(m, "protocolVersion")) + w.uint32(42).string(m.protocolVersion); + if (m.agentVersion != null && Object.hasOwnProperty.call(m, "agentVersion")) + w.uint32(50).string(m.agentVersion); + if (m.signedPeerRecord != null && Object.hasOwnProperty.call(m, "signedPeerRecord")) + w.uint32(66).bytes(m.signedPeerRecord); + return w; + }; + + /** + * Decodes an Identify message from the specified reader or buffer. + * @function decode + * @memberof Identify + * @static + * @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from + * @param {number} [l] Message length if known beforehand + * @returns {Identify} Identify + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Identify.decode = function decode(r, l) { + if (!(r instanceof $Reader)) + r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, m = new $root.Identify(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 5: + m.protocolVersion = r.string(); + break; + case 6: + m.agentVersion = r.string(); + break; + case 1: + m.publicKey = r.bytes(); + break; + case 2: + if (!(m.listenAddrs && m.listenAddrs.length)) + m.listenAddrs = []; + m.listenAddrs.push(r.bytes()); + break; + case 4: + m.observedAddr = r.bytes(); + break; + case 3: + if (!(m.protocols && m.protocols.length)) + m.protocols = []; + m.protocols.push(r.string()); + break; + case 8: + m.signedPeerRecord = r.bytes(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + + /** + * Creates an Identify message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof Identify + * @static + * @param {Object.} d Plain object + * @returns {Identify} Identify + */ + Identify.fromObject = function fromObject(d) { + if (d instanceof $root.Identify) + return d; + var m = new $root.Identify(); + if (d.protocolVersion != null) { + m.protocolVersion = String(d.protocolVersion); + } + if (d.agentVersion != null) { + m.agentVersion = String(d.agentVersion); + } + if (d.publicKey != null) { + if (typeof d.publicKey === "string") + $util.base64.decode(d.publicKey, m.publicKey = $util.newBuffer($util.base64.length(d.publicKey)), 0); + else if (d.publicKey.length) + m.publicKey = d.publicKey; + } + if (d.listenAddrs) { + if (!Array.isArray(d.listenAddrs)) + throw TypeError(".Identify.listenAddrs: array expected"); + m.listenAddrs = []; + for (var i = 0; i < d.listenAddrs.length; ++i) { + if (typeof d.listenAddrs[i] === "string") + $util.base64.decode(d.listenAddrs[i], m.listenAddrs[i] = $util.newBuffer($util.base64.length(d.listenAddrs[i])), 0); + else if (d.listenAddrs[i].length) + m.listenAddrs[i] = d.listenAddrs[i]; + } + } + if (d.observedAddr != null) { + if (typeof d.observedAddr === "string") + $util.base64.decode(d.observedAddr, m.observedAddr = $util.newBuffer($util.base64.length(d.observedAddr)), 0); + else if (d.observedAddr.length) + m.observedAddr = d.observedAddr; + } + if (d.protocols) { + if (!Array.isArray(d.protocols)) + throw TypeError(".Identify.protocols: array expected"); + m.protocols = []; + for (var i = 0; i < d.protocols.length; ++i) { + m.protocols[i] = String(d.protocols[i]); + } + } + if (d.signedPeerRecord != null) { + if (typeof d.signedPeerRecord === "string") + $util.base64.decode(d.signedPeerRecord, m.signedPeerRecord = $util.newBuffer($util.base64.length(d.signedPeerRecord)), 0); + else if (d.signedPeerRecord.length) + m.signedPeerRecord = d.signedPeerRecord; + } + return m; + }; + + /** + * Creates a plain object from an Identify message. Also converts values to other types if specified. + * @function toObject + * @memberof Identify + * @static + * @param {Identify} m Identify + * @param {$protobuf.IConversionOptions} [o] Conversion options + * @returns {Object.} Plain object + */ + Identify.toObject = function toObject(m, o) { + if (!o) + o = {}; + var d = {}; + if (o.arrays || o.defaults) { + d.listenAddrs = []; + d.protocols = []; + } + if (o.defaults) { + if (o.bytes === String) + d.publicKey = ""; + else { + d.publicKey = []; + if (o.bytes !== Array) + d.publicKey = $util.newBuffer(d.publicKey); + } + if (o.bytes === String) + d.observedAddr = ""; + else { + d.observedAddr = []; + if (o.bytes !== Array) + d.observedAddr = $util.newBuffer(d.observedAddr); + } + d.protocolVersion = ""; + d.agentVersion = ""; + if (o.bytes === String) + d.signedPeerRecord = ""; + else { + d.signedPeerRecord = []; + if (o.bytes !== Array) + d.signedPeerRecord = $util.newBuffer(d.signedPeerRecord); + } + } + if (m.publicKey != null && m.hasOwnProperty("publicKey")) { + d.publicKey = o.bytes === String ? $util.base64.encode(m.publicKey, 0, m.publicKey.length) : o.bytes === Array ? Array.prototype.slice.call(m.publicKey) : m.publicKey; + } + if (m.listenAddrs && m.listenAddrs.length) { + d.listenAddrs = []; + for (var j = 0; j < m.listenAddrs.length; ++j) { + d.listenAddrs[j] = o.bytes === String ? $util.base64.encode(m.listenAddrs[j], 0, m.listenAddrs[j].length) : o.bytes === Array ? Array.prototype.slice.call(m.listenAddrs[j]) : m.listenAddrs[j]; + } + } + if (m.protocols && m.protocols.length) { + d.protocols = []; + for (var j = 0; j < m.protocols.length; ++j) { + d.protocols[j] = m.protocols[j]; + } + } + if (m.observedAddr != null && m.hasOwnProperty("observedAddr")) { + d.observedAddr = o.bytes === String ? $util.base64.encode(m.observedAddr, 0, m.observedAddr.length) : o.bytes === Array ? Array.prototype.slice.call(m.observedAddr) : m.observedAddr; + } + if (m.protocolVersion != null && m.hasOwnProperty("protocolVersion")) { + d.protocolVersion = m.protocolVersion; + } + if (m.agentVersion != null && m.hasOwnProperty("agentVersion")) { + d.agentVersion = m.agentVersion; + } + if (m.signedPeerRecord != null && m.hasOwnProperty("signedPeerRecord")) { + d.signedPeerRecord = o.bytes === String ? $util.base64.encode(m.signedPeerRecord, 0, m.signedPeerRecord.length) : o.bytes === Array ? Array.prototype.slice.call(m.signedPeerRecord) : m.signedPeerRecord; + } + return d; + }; + + /** + * Converts this Identify to JSON. + * @function toJSON + * @memberof Identify + * @instance + * @returns {Object.} JSON object + */ + Identify.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Identify; +})(); + +module.exports = $root; diff --git a/src/identify/message.proto b/src/identify/message.proto new file mode 100644 index 0000000000..63f25561cc --- /dev/null +++ b/src/identify/message.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; + +message Identify { + // protocolVersion determines compatibility between peers + optional string protocolVersion = 5; // e.g. ipfs/1.0.0 + + // agentVersion is like a UserAgent string in browsers, or client version in bittorrent + // includes the client name and client. + optional string agentVersion = 6; // e.g. go-ipfs/0.1.0 + + // publicKey is this node's public key (which also gives its node.ID) + // - may not need to be sent, as secure channel implies it has been sent. + // - then again, if we change / disable secure channel, may still want it. + optional bytes publicKey = 1; + + // listenAddrs are the multiaddrs the sender node listens for open connections on + repeated bytes listenAddrs = 2; + + // oservedAddr is the multiaddr of the remote endpoint that the sender node perceives + // this is useful information to convey to the other side, as it helps the remote endpoint + // determine whether its connection to the local peer goes through NAT. + optional bytes observedAddr = 4; + + repeated string protocols = 3; + + // signedPeerRecord contains a serialized SignedEnvelope containing a PeerRecord, + // signed by the sending node. It contains the same addresses as the listenAddrs field, but + // in a form that lets us share authenticated addrs with other peers. + optional bytes signedPeerRecord = 8; +} diff --git a/tsconfig.json b/tsconfig.json index e8281f6ad4..d9083a6a34 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,6 +8,7 @@ ], "exclude": [ "src/circuit/protocol/index.js", // exclude generated file + "src/identify/message.js", // exclude generated file "src/insecure/proto.js", // exclude generated file "src/peer-store/persistent/pb/address-book.js", // exclude generated file "src/peer-store/persistent/pb/proto-book.js", // exclude generated file