@libp2p/interface-internal 2.1.1-f8da60e73 → 2.2.0-127abe24b
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/src/address-manager/index.d.ts +50 -1
- package/dist/src/address-manager/index.d.ts.map +1 -1
- package/dist/src/connection-manager/index.d.ts +5 -0
- package/dist/src/connection-manager/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/address-manager/index.ts +58 -1
- package/src/connection-manager/index.ts +6 -0
|
@@ -1,4 +1,49 @@
|
|
|
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
|
+
* The timestamp at which the address was last verified
|
|
30
|
+
*/
|
|
31
|
+
lastVerified?: number;
|
|
32
|
+
/**
|
|
33
|
+
* A millisecond timestamp after which this address should be reverified
|
|
34
|
+
*/
|
|
35
|
+
expires: number;
|
|
36
|
+
/**
|
|
37
|
+
* The source of this address
|
|
38
|
+
*/
|
|
39
|
+
type: AddressType;
|
|
40
|
+
}
|
|
41
|
+
export interface ConfirmAddressOptions {
|
|
42
|
+
/**
|
|
43
|
+
* Override the TTL of the observed address verification
|
|
44
|
+
*/
|
|
45
|
+
ttl?: number;
|
|
46
|
+
}
|
|
2
47
|
export interface AddressManager {
|
|
3
48
|
/**
|
|
4
49
|
* Get peer listen multiaddrs
|
|
@@ -17,7 +62,7 @@ export interface AddressManager {
|
|
|
17
62
|
* Signal that we have confidence an observed multiaddr is publicly dialable -
|
|
18
63
|
* this will make it appear in the output of getAddresses()
|
|
19
64
|
*/
|
|
20
|
-
confirmObservedAddr(addr: Multiaddr): void;
|
|
65
|
+
confirmObservedAddr(addr: Multiaddr, options?: ConfirmAddressOptions): void;
|
|
21
66
|
/**
|
|
22
67
|
* Signal that we do not have confidence an observed multiaddr is publicly dialable -
|
|
23
68
|
* this will remove it from the output of getObservedAddrs()
|
|
@@ -33,6 +78,10 @@ export interface AddressManager {
|
|
|
33
78
|
* Get the current node's addresses
|
|
34
79
|
*/
|
|
35
80
|
getAddresses(): Multiaddr[];
|
|
81
|
+
/**
|
|
82
|
+
* Return all known addresses with metadata
|
|
83
|
+
*/
|
|
84
|
+
getAddressesWithMetadata(): NodeAddress[];
|
|
36
85
|
/**
|
|
37
86
|
* Adds a mapping between one or more IP addresses and a domain name - when
|
|
38
87
|
* `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,MAAM,yBAAyB,CAAA;AAExD,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,cAAc,IAAI,SAAS,EAAE,CAAA;IAE7B;;OAEG;IACH,gBAAgB,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,wBAAwB,IAAI,WAAW,EAAE,CAAA;IAEzC;;;;;OAKG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAE1D;;OAEG;IACH,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAEtC;;;;;;;;;OASG;IACH,uBAAuB,CAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,IAAI,CAAA;IAE7I;;OAEG;IACH,0BAA0B,CAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,IAAI,CAAA;CACjJ"}
|
|
@@ -41,6 +41,11 @@ export interface ConnectionManager {
|
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
43
|
getConnectionsMap(): PeerMap<Connection[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Returns the configured maximum number of connections this connection
|
|
46
|
+
* manager will accept
|
|
47
|
+
*/
|
|
48
|
+
getMaxConnections(): number;
|
|
44
49
|
/**
|
|
45
50
|
* Open a connection to a remote peer
|
|
46
51
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/connection-manager/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAA;AAC5J,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAA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OAAO,CAAC,CAAA;CAC9F"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/interface-internal",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0-127abe24b",
|
|
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,8 +48,8 @@
|
|
|
48
48
|
"build": "aegir build"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@libp2p/interface": "2.
|
|
52
|
-
"@libp2p/peer-collections": "6.0.
|
|
51
|
+
"@libp2p/interface": "2.3.0-127abe24b",
|
|
52
|
+
"@libp2p/peer-collections": "6.0.13-127abe24b",
|
|
53
53
|
"@multiformats/multiaddr": "^12.3.3",
|
|
54
54
|
"progress-events": "^1.0.1",
|
|
55
55
|
"uint8arraylist": "^2.4.8"
|
|
@@ -1,5 +1,57 @@
|
|
|
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
|
+
* The timestamp at which the address was last verified
|
|
34
|
+
*/
|
|
35
|
+
lastVerified?: number
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A millisecond timestamp after which this address should be reverified
|
|
39
|
+
*/
|
|
40
|
+
expires: number
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The source of this address
|
|
44
|
+
*/
|
|
45
|
+
type: AddressType
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface ConfirmAddressOptions {
|
|
49
|
+
/**
|
|
50
|
+
* Override the TTL of the observed address verification
|
|
51
|
+
*/
|
|
52
|
+
ttl?: number
|
|
53
|
+
}
|
|
54
|
+
|
|
3
55
|
export interface AddressManager {
|
|
4
56
|
/**
|
|
5
57
|
* Get peer listen multiaddrs
|
|
@@ -21,7 +73,7 @@ export interface AddressManager {
|
|
|
21
73
|
* Signal that we have confidence an observed multiaddr is publicly dialable -
|
|
22
74
|
* this will make it appear in the output of getAddresses()
|
|
23
75
|
*/
|
|
24
|
-
confirmObservedAddr(addr: Multiaddr): void
|
|
76
|
+
confirmObservedAddr(addr: Multiaddr, options?: ConfirmAddressOptions): void
|
|
25
77
|
|
|
26
78
|
/**
|
|
27
79
|
* Signal that we do not have confidence an observed multiaddr is publicly dialable -
|
|
@@ -41,6 +93,11 @@ export interface AddressManager {
|
|
|
41
93
|
*/
|
|
42
94
|
getAddresses(): Multiaddr[]
|
|
43
95
|
|
|
96
|
+
/**
|
|
97
|
+
* Return all known addresses with metadata
|
|
98
|
+
*/
|
|
99
|
+
getAddressesWithMetadata(): NodeAddress[]
|
|
100
|
+
|
|
44
101
|
/**
|
|
45
102
|
* Adds a mapping between one or more IP addresses and a domain name - when
|
|
46
103
|
* `getAddresses` is invoked, where the IP addresses are present in a
|
|
@@ -46,6 +46,12 @@ export interface ConnectionManager {
|
|
|
46
46
|
*/
|
|
47
47
|
getConnectionsMap(): PeerMap<Connection[]>
|
|
48
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Returns the configured maximum number of connections this connection
|
|
51
|
+
* manager will accept
|
|
52
|
+
*/
|
|
53
|
+
getMaxConnections(): number
|
|
54
|
+
|
|
49
55
|
/**
|
|
50
56
|
* Open a connection to a remote peer
|
|
51
57
|
*
|