@libp2p/circuit-relay-v2 0.0.0-97ab31c0c
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/LICENSE +4 -0
- package/README.md +69 -0
- package/dist/index.min.js +45 -0
- package/dist/src/constants.d.ts +55 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +61 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/index.d.ts +56 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +39 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/pb/index.d.ts +93 -0
- package/dist/src/pb/index.d.ts.map +1 -0
- package/dist/src/pb/index.js +425 -0
- package/dist/src/pb/index.js.map +1 -0
- package/dist/src/server/advert-service.d.ts +46 -0
- package/dist/src/server/advert-service.d.ts.map +1 -0
- package/dist/src/server/advert-service.js +72 -0
- package/dist/src/server/advert-service.js.map +1 -0
- package/dist/src/server/index.d.ts +67 -0
- package/dist/src/server/index.d.ts.map +1 -0
- package/dist/src/server/index.js +313 -0
- package/dist/src/server/index.js.map +1 -0
- package/dist/src/server/reservation-store.d.ts +49 -0
- package/dist/src/server/reservation-store.d.ts.map +1 -0
- package/dist/src/server/reservation-store.js +65 -0
- package/dist/src/server/reservation-store.js.map +1 -0
- package/dist/src/server/reservation-voucher.d.ts +18 -0
- package/dist/src/server/reservation-voucher.d.ts.map +1 -0
- package/dist/src/server/reservation-voucher.js +36 -0
- package/dist/src/server/reservation-voucher.js.map +1 -0
- package/dist/src/transport/discovery.d.ts +48 -0
- package/dist/src/transport/discovery.d.ts.map +1 -0
- package/dist/src/transport/discovery.js +97 -0
- package/dist/src/transport/discovery.js.map +1 -0
- package/dist/src/transport/index.d.ts +58 -0
- package/dist/src/transport/index.d.ts.map +1 -0
- package/dist/src/transport/index.js +279 -0
- package/dist/src/transport/index.js.map +1 -0
- package/dist/src/transport/listener.d.ts +11 -0
- package/dist/src/transport/listener.d.ts.map +1 -0
- package/dist/src/transport/listener.js +66 -0
- package/dist/src/transport/listener.js.map +1 -0
- package/dist/src/transport/reservation-store.d.ts +74 -0
- package/dist/src/transport/reservation-store.d.ts.map +1 -0
- package/dist/src/transport/reservation-store.js +209 -0
- package/dist/src/transport/reservation-store.js.map +1 -0
- package/dist/src/utils.d.ts +14 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/utils.js +106 -0
- package/dist/src/utils.js.map +1 -0
- package/package.json +83 -0
- package/src/constants.ts +79 -0
- package/src/index.ts +64 -0
- package/src/pb/index.proto +67 -0
- package/src/pb/index.ts +539 -0
- package/src/server/advert-service.ts +109 -0
- package/src/server/index.ts +446 -0
- package/src/server/reservation-store.ts +116 -0
- package/src/server/reservation-voucher.ts +51 -0
- package/src/transport/discovery.ts +138 -0
- package/src/transport/index.ts +399 -0
- package/src/transport/listener.ts +98 -0
- package/src/transport/reservation-store.ts +312 -0
- package/src/utils.ts +134 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
/**
|
2
|
+
* Delay before HOP relay service is advertised on the network
|
3
|
+
*/
|
4
|
+
export declare const ADVERTISE_BOOT_DELAY: number;
|
5
|
+
/**
|
6
|
+
* Delay Between HOP relay service advertisements on the network
|
7
|
+
*/
|
8
|
+
export declare const ADVERTISE_TTL: number;
|
9
|
+
/**
|
10
|
+
* Multicodec code
|
11
|
+
*/
|
12
|
+
export declare const CIRCUIT_PROTO_CODE = 290;
|
13
|
+
/**
|
14
|
+
* Relay HOP relay service namespace for discovery
|
15
|
+
*/
|
16
|
+
export declare const RELAY_RENDEZVOUS_NS = "/libp2p/relay";
|
17
|
+
/**
|
18
|
+
* The maximum number of relay reservations the relay server will accept
|
19
|
+
*/
|
20
|
+
export declare const DEFAULT_MAX_RESERVATION_STORE_SIZE = 15;
|
21
|
+
/**
|
22
|
+
* How often to check for reservation expiry
|
23
|
+
*/
|
24
|
+
export declare const DEFAULT_MAX_RESERVATION_CLEAR_INTERVAL: number;
|
25
|
+
/**
|
26
|
+
* How often to check for reservation expiry
|
27
|
+
*/
|
28
|
+
export declare const DEFAULT_MAX_RESERVATION_TTL: number;
|
29
|
+
export declare const DEFAULT_RESERVATION_CONCURRENCY = 1;
|
30
|
+
export declare const RELAY_SOURCE_TAG = "circuit-relay-source";
|
31
|
+
export declare const RELAY_TAG = "circuit-relay-relay";
|
32
|
+
export declare const DEFAULT_DURATION_LIMIT: number;
|
33
|
+
export declare const DEFAULT_DATA_LIMIT: bigint;
|
34
|
+
/**
|
35
|
+
* The hop protocol
|
36
|
+
*/
|
37
|
+
export declare const RELAY_V2_HOP_CODEC = "/libp2p/circuit/relay/0.2.0/hop";
|
38
|
+
/**
|
39
|
+
* the stop protocol
|
40
|
+
*/
|
41
|
+
export declare const RELAY_V2_STOP_CODEC = "/libp2p/circuit/relay/0.2.0/stop";
|
42
|
+
/**
|
43
|
+
* Hop messages must be exchanged inside this timeout
|
44
|
+
*/
|
45
|
+
export declare const DEFAULT_HOP_TIMEOUT: number;
|
46
|
+
/**
|
47
|
+
* How long to wait before starting to advertise the relay service
|
48
|
+
*/
|
49
|
+
export declare const DEFAULT_ADVERT_BOOT_DELAY: number;
|
50
|
+
export declare const MAX_CONNECTIONS = 300;
|
51
|
+
export declare const ERR_NO_ROUTERS_AVAILABLE = "ERR_NO_ROUTERS_AVAILABLE";
|
52
|
+
export declare const ERR_RELAYED_DIAL = "ERR_RELAYED_DIAL";
|
53
|
+
export declare const ERR_HOP_REQUEST_FAILED = "ERR_HOP_REQUEST_FAILED";
|
54
|
+
export declare const ERR_TRANSFER_LIMIT_EXCEEDED = "ERR_TRANSFER_LIMIT_EXCEEDED";
|
55
|
+
//# sourceMappingURL=constants.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,oBAAoB,QAAc,CAAA;AAE/C;;GAEG;AACH,eAAO,MAAM,aAAa,QAAc,CAAA;AAExC;;GAEG;AACH,eAAO,MAAM,kBAAkB,MAAM,CAAA;AAErC;;GAEG;AACH,eAAO,MAAM,mBAAmB,kBAAkB,CAAA;AAElD;;GAEG;AACH,eAAO,MAAM,kCAAkC,KAAK,CAAA;AAEpD;;GAEG;AACH,eAAO,MAAM,sCAAsC,QAAe,CAAA;AAElE;;GAEG;AACH,eAAO,MAAM,2BAA2B,QAAkB,CAAA;AAE1D,eAAO,MAAM,+BAA+B,IAAI,CAAA;AAEhD,eAAO,MAAM,gBAAgB,yBAAyB,CAAA;AAEtD,eAAO,MAAM,SAAS,wBAAwB,CAAA;AAM9C,eAAO,MAAM,sBAAsB,QAAa,CAAA;AAGhD,eAAO,MAAM,kBAAkB,QAAkB,CAAA;AAEjD;;GAEG;AACH,eAAO,MAAM,kBAAkB,oCAAoC,CAAA;AAEnE;;GAEG;AACH,eAAO,MAAM,mBAAmB,qCAAqC,CAAA;AAErE;;GAEG;AACH,eAAO,MAAM,mBAAmB,QAAc,CAAA;AAE9C;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAc,CAAA;AAEpD,eAAO,MAAM,eAAe,MAAM,CAAA;AAElC,eAAO,MAAM,wBAAwB,6BAA6B,CAAA;AAClE,eAAO,MAAM,gBAAgB,qBAAqB,CAAA;AAClD,eAAO,MAAM,sBAAsB,2BAA2B,CAAA;AAC9D,eAAO,MAAM,2BAA2B,gCAAgC,CAAA"}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
const second = 1000;
|
2
|
+
const minute = 60 * second;
|
3
|
+
/**
|
4
|
+
* Delay before HOP relay service is advertised on the network
|
5
|
+
*/
|
6
|
+
export const ADVERTISE_BOOT_DELAY = 15 * minute;
|
7
|
+
/**
|
8
|
+
* Delay Between HOP relay service advertisements on the network
|
9
|
+
*/
|
10
|
+
export const ADVERTISE_TTL = 30 * minute;
|
11
|
+
/**
|
12
|
+
* Multicodec code
|
13
|
+
*/
|
14
|
+
export const CIRCUIT_PROTO_CODE = 290;
|
15
|
+
/**
|
16
|
+
* Relay HOP relay service namespace for discovery
|
17
|
+
*/
|
18
|
+
export const RELAY_RENDEZVOUS_NS = '/libp2p/relay';
|
19
|
+
/**
|
20
|
+
* The maximum number of relay reservations the relay server will accept
|
21
|
+
*/
|
22
|
+
export const DEFAULT_MAX_RESERVATION_STORE_SIZE = 15;
|
23
|
+
/**
|
24
|
+
* How often to check for reservation expiry
|
25
|
+
*/
|
26
|
+
export const DEFAULT_MAX_RESERVATION_CLEAR_INTERVAL = 300 * second;
|
27
|
+
/**
|
28
|
+
* How often to check for reservation expiry
|
29
|
+
*/
|
30
|
+
export const DEFAULT_MAX_RESERVATION_TTL = 2 * 60 * minute;
|
31
|
+
export const DEFAULT_RESERVATION_CONCURRENCY = 1;
|
32
|
+
export const RELAY_SOURCE_TAG = 'circuit-relay-source';
|
33
|
+
export const RELAY_TAG = 'circuit-relay-relay';
|
34
|
+
// circuit v2 connection limits
|
35
|
+
// https://github.com/libp2p/go-libp2p/blob/master/p2p/protocol/circuitv2/relay/resources.go#L61-L66
|
36
|
+
// 2 min is the default connection duration
|
37
|
+
export const DEFAULT_DURATION_LIMIT = 2 * minute;
|
38
|
+
// 128k is the default data limit
|
39
|
+
export const DEFAULT_DATA_LIMIT = BigInt(1 << 17);
|
40
|
+
/**
|
41
|
+
* The hop protocol
|
42
|
+
*/
|
43
|
+
export const RELAY_V2_HOP_CODEC = '/libp2p/circuit/relay/0.2.0/hop';
|
44
|
+
/**
|
45
|
+
* the stop protocol
|
46
|
+
*/
|
47
|
+
export const RELAY_V2_STOP_CODEC = '/libp2p/circuit/relay/0.2.0/stop';
|
48
|
+
/**
|
49
|
+
* Hop messages must be exchanged inside this timeout
|
50
|
+
*/
|
51
|
+
export const DEFAULT_HOP_TIMEOUT = 30 * second;
|
52
|
+
/**
|
53
|
+
* How long to wait before starting to advertise the relay service
|
54
|
+
*/
|
55
|
+
export const DEFAULT_ADVERT_BOOT_DELAY = 30 * second;
|
56
|
+
export const MAX_CONNECTIONS = 300;
|
57
|
+
export const ERR_NO_ROUTERS_AVAILABLE = 'ERR_NO_ROUTERS_AVAILABLE';
|
58
|
+
export const ERR_RELAYED_DIAL = 'ERR_RELAYED_DIAL';
|
59
|
+
export const ERR_HOP_REQUEST_FAILED = 'ERR_HOP_REQUEST_FAILED';
|
60
|
+
export const ERR_TRANSFER_LIMIT_EXCEEDED = 'ERR_TRANSFER_LIMIT_EXCEEDED';
|
61
|
+
//# sourceMappingURL=constants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,IAAI,CAAA;AACnB,MAAM,MAAM,GAAG,EAAE,GAAG,MAAM,CAAA;AAE1B;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,GAAG,MAAM,CAAA;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,GAAG,MAAM,CAAA;AAExC;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAA;AAErC;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAA;AAElD;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,EAAE,CAAA;AAEpD;;GAEG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,GAAG,GAAG,MAAM,CAAA;AAElE;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,GAAG,EAAE,GAAG,MAAM,CAAA;AAE1D,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAA;AAEhD,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAA;AAEtD,MAAM,CAAC,MAAM,SAAS,GAAG,qBAAqB,CAAA;AAE9C,+BAA+B;AAC/B,oGAAoG;AAEpG,2CAA2C;AAC3C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,GAAG,MAAM,CAAA;AAEhD,iCAAiC;AACjC,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,iCAAiC,CAAA;AAEnE;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,kCAAkC,CAAA;AAErE;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,GAAG,MAAM,CAAA;AAE9C;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,GAAG,MAAM,CAAA;AAEpD,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAA;AAElC,MAAM,CAAC,MAAM,wBAAwB,GAAG,0BAA0B,CAAA;AAClE,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAA;AAClD,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAwB,CAAA;AAC9D,MAAM,CAAC,MAAM,2BAA2B,GAAG,6BAA6B,CAAA"}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/**
|
2
|
+
* @packageDocumentation
|
3
|
+
*
|
4
|
+
* The `circuitRelayTransport` allows libp2p to dial and listen on [Circuit Relay](https://docs.libp2p.io/concepts/nat/circuit-relay/)
|
5
|
+
* addresses.
|
6
|
+
*
|
7
|
+
* @example
|
8
|
+
*
|
9
|
+
* ```typescript
|
10
|
+
* import { createLibp2p } from 'libp2p'
|
11
|
+
* import { circuitRelayTransport } from '@libp2p/circuit-relay-v2'
|
12
|
+
*
|
13
|
+
* const node = await createLibp2p({
|
14
|
+
* transports: [
|
15
|
+
* circuitRelayTransport()
|
16
|
+
* ]
|
17
|
+
* })
|
18
|
+
* ```
|
19
|
+
*
|
20
|
+
* The `circuitRelayServer` function allows libp2p to function as a [Circuit Relay](https://docs.libp2p.io/concepts/nat/circuit-relay/)
|
21
|
+
* server. This will not work in browsers.
|
22
|
+
*
|
23
|
+
* @example
|
24
|
+
*
|
25
|
+
* ```typescript
|
26
|
+
* import { createLibp2p } from 'libp2p'
|
27
|
+
* import { circuitRelayServer } from '@libp2p/circuit-relay-v2'
|
28
|
+
*
|
29
|
+
* const node = await createLibp2p({
|
30
|
+
* services: [
|
31
|
+
* circuitRelay: circuitRelayServer()
|
32
|
+
* ]
|
33
|
+
* })
|
34
|
+
* ```
|
35
|
+
*/
|
36
|
+
import type { Limit } from './pb/index.js';
|
37
|
+
import type { TypedEventEmitter } from '@libp2p/interface/events';
|
38
|
+
import type { PeerMap } from '@libp2p/peer-collections';
|
39
|
+
import type { Multiaddr } from '@multiformats/multiaddr';
|
40
|
+
export interface RelayReservation {
|
41
|
+
expire: Date;
|
42
|
+
addr: Multiaddr;
|
43
|
+
limit?: Limit;
|
44
|
+
}
|
45
|
+
export interface CircuitRelayServiceEvents {
|
46
|
+
'relay:reservation': CustomEvent<RelayReservation>;
|
47
|
+
'relay:advert:success': CustomEvent<unknown>;
|
48
|
+
'relay:advert:error': CustomEvent<Error>;
|
49
|
+
}
|
50
|
+
export interface CircuitRelayService extends TypedEventEmitter<CircuitRelayServiceEvents> {
|
51
|
+
reservations: PeerMap<RelayReservation>;
|
52
|
+
}
|
53
|
+
export { circuitRelayServer } from './server/index.js';
|
54
|
+
export { circuitRelayTransport } from './transport/index.js';
|
55
|
+
export { RELAY_V2_HOP_CODEC, RELAY_V2_STOP_CODEC } from './constants.js';
|
56
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,IAAI,CAAA;IACZ,IAAI,EAAE,SAAS,CAAA;IACf,KAAK,CAAC,EAAE,KAAK,CAAA;CACd;AAED,MAAM,WAAW,yBAAyB;IACxC,mBAAmB,EAAE,WAAW,CAAC,gBAAgB,CAAC,CAAA;IAClD,sBAAsB,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;IAC5C,oBAAoB,EAAE,WAAW,CAAC,KAAK,CAAC,CAAA;CACzC;AAED,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB,CAAC,yBAAyB,CAAC;IACvF,YAAY,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAA;CACxC;AAED,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAE5D,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,gBAAgB,CAAA"}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/**
|
2
|
+
* @packageDocumentation
|
3
|
+
*
|
4
|
+
* The `circuitRelayTransport` allows libp2p to dial and listen on [Circuit Relay](https://docs.libp2p.io/concepts/nat/circuit-relay/)
|
5
|
+
* addresses.
|
6
|
+
*
|
7
|
+
* @example
|
8
|
+
*
|
9
|
+
* ```typescript
|
10
|
+
* import { createLibp2p } from 'libp2p'
|
11
|
+
* import { circuitRelayTransport } from '@libp2p/circuit-relay-v2'
|
12
|
+
*
|
13
|
+
* const node = await createLibp2p({
|
14
|
+
* transports: [
|
15
|
+
* circuitRelayTransport()
|
16
|
+
* ]
|
17
|
+
* })
|
18
|
+
* ```
|
19
|
+
*
|
20
|
+
* The `circuitRelayServer` function allows libp2p to function as a [Circuit Relay](https://docs.libp2p.io/concepts/nat/circuit-relay/)
|
21
|
+
* server. This will not work in browsers.
|
22
|
+
*
|
23
|
+
* @example
|
24
|
+
*
|
25
|
+
* ```typescript
|
26
|
+
* import { createLibp2p } from 'libp2p'
|
27
|
+
* import { circuitRelayServer } from '@libp2p/circuit-relay-v2'
|
28
|
+
*
|
29
|
+
* const node = await createLibp2p({
|
30
|
+
* services: [
|
31
|
+
* circuitRelay: circuitRelayServer()
|
32
|
+
* ]
|
33
|
+
* })
|
34
|
+
* ```
|
35
|
+
*/
|
36
|
+
export { circuitRelayServer } from './server/index.js';
|
37
|
+
export { circuitRelayTransport } from './transport/index.js';
|
38
|
+
export { RELAY_V2_HOP_CODEC, RELAY_V2_STOP_CODEC } from './constants.js';
|
39
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAuBH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAE5D,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,gBAAgB,CAAA"}
|
@@ -0,0 +1,93 @@
|
|
1
|
+
import type { Codec } from 'protons-runtime';
|
2
|
+
import type { Uint8ArrayList } from 'uint8arraylist';
|
3
|
+
export interface HopMessage {
|
4
|
+
type?: HopMessage.Type;
|
5
|
+
peer?: Peer;
|
6
|
+
reservation?: Reservation;
|
7
|
+
limit?: Limit;
|
8
|
+
status?: Status;
|
9
|
+
}
|
10
|
+
export declare namespace HopMessage {
|
11
|
+
enum Type {
|
12
|
+
RESERVE = "RESERVE",
|
13
|
+
CONNECT = "CONNECT",
|
14
|
+
STATUS = "STATUS"
|
15
|
+
}
|
16
|
+
namespace Type {
|
17
|
+
const codec: () => Codec<Type>;
|
18
|
+
}
|
19
|
+
const codec: () => Codec<HopMessage>;
|
20
|
+
const encode: (obj: Partial<HopMessage>) => Uint8Array;
|
21
|
+
const decode: (buf: Uint8Array | Uint8ArrayList) => HopMessage;
|
22
|
+
}
|
23
|
+
export interface StopMessage {
|
24
|
+
type?: StopMessage.Type;
|
25
|
+
peer?: Peer;
|
26
|
+
limit?: Limit;
|
27
|
+
status?: Status;
|
28
|
+
}
|
29
|
+
export declare namespace StopMessage {
|
30
|
+
enum Type {
|
31
|
+
CONNECT = "CONNECT",
|
32
|
+
STATUS = "STATUS"
|
33
|
+
}
|
34
|
+
namespace Type {
|
35
|
+
const codec: () => Codec<Type>;
|
36
|
+
}
|
37
|
+
const codec: () => Codec<StopMessage>;
|
38
|
+
const encode: (obj: Partial<StopMessage>) => Uint8Array;
|
39
|
+
const decode: (buf: Uint8Array | Uint8ArrayList) => StopMessage;
|
40
|
+
}
|
41
|
+
export interface Peer {
|
42
|
+
id: Uint8Array;
|
43
|
+
addrs: Uint8Array[];
|
44
|
+
}
|
45
|
+
export declare namespace Peer {
|
46
|
+
const codec: () => Codec<Peer>;
|
47
|
+
const encode: (obj: Partial<Peer>) => Uint8Array;
|
48
|
+
const decode: (buf: Uint8Array | Uint8ArrayList) => Peer;
|
49
|
+
}
|
50
|
+
export interface Reservation {
|
51
|
+
expire: bigint;
|
52
|
+
addrs: Uint8Array[];
|
53
|
+
voucher?: Uint8Array;
|
54
|
+
}
|
55
|
+
export declare namespace Reservation {
|
56
|
+
const codec: () => Codec<Reservation>;
|
57
|
+
const encode: (obj: Partial<Reservation>) => Uint8Array;
|
58
|
+
const decode: (buf: Uint8Array | Uint8ArrayList) => Reservation;
|
59
|
+
}
|
60
|
+
export interface Limit {
|
61
|
+
duration?: number;
|
62
|
+
data?: bigint;
|
63
|
+
}
|
64
|
+
export declare namespace Limit {
|
65
|
+
const codec: () => Codec<Limit>;
|
66
|
+
const encode: (obj: Partial<Limit>) => Uint8Array;
|
67
|
+
const decode: (buf: Uint8Array | Uint8ArrayList) => Limit;
|
68
|
+
}
|
69
|
+
export declare enum Status {
|
70
|
+
UNUSED = "UNUSED",
|
71
|
+
OK = "OK",
|
72
|
+
RESERVATION_REFUSED = "RESERVATION_REFUSED",
|
73
|
+
RESOURCE_LIMIT_EXCEEDED = "RESOURCE_LIMIT_EXCEEDED",
|
74
|
+
PERMISSION_DENIED = "PERMISSION_DENIED",
|
75
|
+
CONNECTION_FAILED = "CONNECTION_FAILED",
|
76
|
+
NO_RESERVATION = "NO_RESERVATION",
|
77
|
+
MALFORMED_MESSAGE = "MALFORMED_MESSAGE",
|
78
|
+
UNEXPECTED_MESSAGE = "UNEXPECTED_MESSAGE"
|
79
|
+
}
|
80
|
+
export declare namespace Status {
|
81
|
+
const codec: () => Codec<Status>;
|
82
|
+
}
|
83
|
+
export interface ReservationVoucher {
|
84
|
+
relay: Uint8Array;
|
85
|
+
peer: Uint8Array;
|
86
|
+
expiration: bigint;
|
87
|
+
}
|
88
|
+
export declare namespace ReservationVoucher {
|
89
|
+
const codec: () => Codec<ReservationVoucher>;
|
90
|
+
const encode: (obj: Partial<ReservationVoucher>) => Uint8Array;
|
91
|
+
const decode: (buf: Uint8Array | Uint8ArrayList) => ReservationVoucher;
|
92
|
+
}
|
93
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pb/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,UAAU,CAAC,IAAI,CAAA;IACtB,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,yBAAiB,UAAU,CAAC;IAC1B,KAAY,IAAI;QACd,OAAO,YAAY;QACnB,O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