@libp2p/interface-internal 2.1.1-bc90b4fd5 → 2.1.1-d19974d93

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.
@@ -1,4 +1,39 @@
1
1
  import type { Multiaddr } from '@multiformats/multiaddr';
2
+ /**
3
+ * The type of address:
4
+ *
5
+ * - 'transport' a listen address supplied by a transport
6
+ * - 'announce' a pre-configured announce address
7
+ * - 'observed' a peer reported this as a public address
8
+ * - 'dns-mapping' a DNS address dynamically mapped to one or more public addresses
9
+ * - 'ip-mapping' an external IP address dynamically mapped to a LAN address
10
+ */
11
+ export type AddressType = 'transport' | 'announce' | 'observed' | 'dns-mapping' | 'ip-mapping';
12
+ /**
13
+ * An address that has been configured or detected
14
+ */
15
+ export interface NodeAddress {
16
+ /**
17
+ * The multiaddr that represents the address
18
+ */
19
+ multiaddr: Multiaddr;
20
+ /**
21
+ * Dynamically configured addresses such as observed or IP/DNS mapped ones
22
+ * must be verified as valid by AutoNAT or some other means before the current
23
+ * node will add them to it's peer record and share them with peers.
24
+ *
25
+ * When this value is true, it's safe to share the address.
26
+ */
27
+ verified: boolean;
28
+ /**
29
+ * A millisecond timestamp after which this address should be reverified
30
+ */
31
+ expires: number;
32
+ /**
33
+ * The source of this address
34
+ */
35
+ type: AddressType;
36
+ }
2
37
  export interface AddressManager {
3
38
  /**
4
39
  * Get peer listen multiaddrs
@@ -33,6 +68,10 @@ export interface AddressManager {
33
68
  * Get the current node's addresses
34
69
  */
35
70
  getAddresses(): Multiaddr[];
71
+ /**
72
+ * Return all known addresses with metadata
73
+ */
74
+ getAddressesWithMetadata(): NodeAddress[];
36
75
  /**
37
76
  * Adds a mapping between one or more IP addresses and a domain name - when
38
77
  * `getAddresses` is invoked, where the IP addresses are present in a
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/address-manager/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,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AC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,IAAI,CAAA;CACjJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/interface-internal",
3
- "version": "2.1.1-bc90b4fd5",
3
+ "version": "2.1.1-d19974d93",
4
4
  "description": "Interfaces implemented by internal libp2p components",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/interface-internal#readme",
@@ -48,14 +48,14 @@
48
48
  "build": "aegir build"
49
49
  },
50
50
  "dependencies": {
51
- "@libp2p/interface": "2.2.1-bc90b4fd5",
52
- "@libp2p/peer-collections": "6.0.12-bc90b4fd5",
53
- "@multiformats/multiaddr": "^12.2.3",
54
- "progress-events": "^1.0.0",
51
+ "@libp2p/interface": "2.2.1-d19974d93",
52
+ "@libp2p/peer-collections": "6.0.12-d19974d93",
53
+ "@multiformats/multiaddr": "^12.3.3",
54
+ "progress-events": "^1.0.1",
55
55
  "uint8arraylist": "^2.4.8"
56
56
  },
57
57
  "devDependencies": {
58
- "aegir": "^44.0.1"
58
+ "aegir": "^45.0.5"
59
59
  },
60
60
  "sideEffects": false
61
61
  }
@@ -1,5 +1,45 @@
1
1
  import type { Multiaddr } from '@multiformats/multiaddr'
2
2
 
3
+ /**
4
+ * The type of address:
5
+ *
6
+ * - 'transport' a listen address supplied by a transport
7
+ * - 'announce' a pre-configured announce address
8
+ * - 'observed' a peer reported this as a public address
9
+ * - 'dns-mapping' a DNS address dynamically mapped to one or more public addresses
10
+ * - 'ip-mapping' an external IP address dynamically mapped to a LAN address
11
+ */
12
+ export type AddressType = 'transport' | 'announce' | 'observed' | 'dns-mapping' | 'ip-mapping'
13
+
14
+ /**
15
+ * An address that has been configured or detected
16
+ */
17
+ export interface NodeAddress {
18
+ /**
19
+ * The multiaddr that represents the address
20
+ */
21
+ multiaddr: Multiaddr
22
+
23
+ /**
24
+ * Dynamically configured addresses such as observed or IP/DNS mapped ones
25
+ * must be verified as valid by AutoNAT or some other means before the current
26
+ * node will add them to it's peer record and share them with peers.
27
+ *
28
+ * When this value is true, it's safe to share the address.
29
+ */
30
+ verified: boolean
31
+
32
+ /**
33
+ * A millisecond timestamp after which this address should be reverified
34
+ */
35
+ expires: number
36
+
37
+ /**
38
+ * The source of this address
39
+ */
40
+ type: AddressType
41
+ }
42
+
3
43
  export interface AddressManager {
4
44
  /**
5
45
  * Get peer listen multiaddrs
@@ -41,6 +81,11 @@ export interface AddressManager {
41
81
  */
42
82
  getAddresses(): Multiaddr[]
43
83
 
84
+ /**
85
+ * Return all known addresses with metadata
86
+ */
87
+ getAddressesWithMetadata(): NodeAddress[]
88
+
44
89
  /**
45
90
  * Adds a mapping between one or more IP addresses and a domain name - when
46
91
  * `getAddresses` is invoked, where the IP addresses are present in a
package/LICENSE DELETED
@@ -1,4 +0,0 @@
1
- This project is dual licensed under MIT and Apache-2.0.
2
-
3
- MIT: https://www.opensource.org/licenses/mit
4
- Apache-2.0: https://www.apache.org/licenses/license-2.0