@fails-components/webtransport 0.1.0-macarmbuild.5 → 0.1.0

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.
Files changed (78) hide show
  1. package/CMakeLists.txt +1 -0
  2. package/dist/lib/client.d.ts +74 -0
  3. package/dist/lib/client.d.ts.map +1 -0
  4. package/dist/lib/dom.d.ts +70 -0
  5. package/dist/lib/dom.d.ts.map +1 -0
  6. package/dist/lib/event-loop.d.ts +26 -0
  7. package/dist/lib/event-loop.d.ts.map +1 -0
  8. package/dist/lib/index.d.ts +79 -0
  9. package/dist/lib/index.d.ts.map +1 -0
  10. package/dist/lib/native.d.ts +2 -0
  11. package/dist/lib/native.d.ts.map +1 -0
  12. package/dist/lib/server.d.ts +88 -0
  13. package/dist/lib/server.d.ts.map +1 -0
  14. package/dist/lib/session.d.ts +225 -0
  15. package/dist/lib/session.d.ts.map +1 -0
  16. package/dist/lib/stream.d.ts +116 -0
  17. package/dist/lib/stream.d.ts.map +1 -0
  18. package/dist/lib/transport.d.ts +25 -0
  19. package/dist/lib/transport.d.ts.map +1 -0
  20. package/dist/lib/types.d.ts +164 -0
  21. package/dist/lib/types.d.ts.map +1 -0
  22. package/dist/lib/utils.d.ts +6 -0
  23. package/dist/lib/utils.d.ts.map +1 -0
  24. package/dist/lib/webtransport.d.ts +35 -0
  25. package/dist/lib/webtransport.d.ts.map +1 -0
  26. package/dist/test/bidirectional-streams.spec.d.ts +5 -0
  27. package/dist/test/bidirectional-streams.spec.d.ts.map +1 -0
  28. package/dist/test/datagrams.spec.d.ts +5 -0
  29. package/dist/test/datagrams.spec.d.ts.map +1 -0
  30. package/dist/test/echoclient.d.ts +2 -0
  31. package/dist/test/echoclient.d.ts.map +1 -0
  32. package/dist/test/echoserver.d.ts +2 -0
  33. package/dist/test/echoserver.d.ts.map +1 -0
  34. package/dist/test/event-loop.spec.d.ts +2 -0
  35. package/dist/test/event-loop.spec.d.ts.map +1 -0
  36. package/dist/test/fixtures/certificate.d.ts +21 -0
  37. package/dist/test/fixtures/certificate.d.ts.map +1 -0
  38. package/dist/test/fixtures/chai.d.ts +2 -0
  39. package/dist/test/fixtures/chai.d.ts.map +1 -0
  40. package/dist/test/fixtures/read-stream.d.ts +10 -0
  41. package/dist/test/fixtures/read-stream.d.ts.map +1 -0
  42. package/dist/test/fixtures/reader-value.d.ts +7 -0
  43. package/dist/test/fixtures/reader-value.d.ts.map +1 -0
  44. package/dist/test/fixtures/server.d.ts +10 -0
  45. package/dist/test/fixtures/server.d.ts.map +1 -0
  46. package/dist/test/fixtures/write-stream.d.ts +10 -0
  47. package/dist/test/fixtures/write-stream.d.ts.map +1 -0
  48. package/dist/test/test.d.ts +2 -0
  49. package/dist/test/test.d.ts.map +1 -0
  50. package/dist/test/testsuite.d.ts +25 -0
  51. package/dist/test/testsuite.d.ts.map +1 -0
  52. package/dist/test/unidirectional-streams.spec.d.ts +5 -0
  53. package/dist/test/unidirectional-streams.spec.d.ts.map +1 -0
  54. package/lib/index.js +1 -0
  55. package/lib/server.js +44 -4
  56. package/lib/session.js +3 -0
  57. package/lib/types.ts +16 -0
  58. package/lib/utils.js +1 -2
  59. package/package.json +5 -2
  60. package/src/http3eventloop.cc +124 -32
  61. package/src/http3eventloop.h +30 -17
  62. package/src/http3server.cc +111 -0
  63. package/src/http3server.h +14 -6
  64. package/src/http3serverbackend.cc +31 -18
  65. package/src/http3serverbackend.h +38 -3
  66. package/src/http3serverstream.cc +19 -6
  67. package/src/http3serverstream.h +2 -0
  68. package/src/http3wtstreamvisitor.cc +3 -0
  69. package/src/http3wtstreamvisitor.h +3 -1
  70. package/test/bidirectional-streams.spec.js +3 -2
  71. package/test/datagrams.spec.js +3 -2
  72. package/test/{event-loop.specoff.js → event-loop.spec.js} +7 -6
  73. package/test/fixtures/certificate.js +9 -9
  74. package/test/fixtures/chai.js +6 -0
  75. package/test/fixtures/reader-value.js +1 -2
  76. package/test/fixtures/write-stream.js +1 -2
  77. package/test/unidirectional-streams.spec.js +54 -1
  78. package/test/suite.specoff.js +0 -9
package/CMakeLists.txt CHANGED
@@ -34,6 +34,7 @@ IF( NOT WIN32)
34
34
  SET(ICU_ROOT "/opt/homebrew/icu4c")
35
35
  ENDIF()
36
36
  ENDIF()
37
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
37
38
  ENDIF(APPLE)
38
39
  find_package(ICU COMPONENTS uc i18n REQUIRED)
39
40
  ENDIF(NOT WIN32)
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @typedef {import('./session').Http3WTSession} Http3WTSession
3
+ *
4
+ * Http3Client events
5
+ * @typedef {import('./types').Http3ClientEventHandler} Http3ClientEventHandler
6
+ * @typedef {import('./types').ClientConnectedEvent} ClientConnectedEvent
7
+ * @typedef {import('./types').ClientWebtransportSupportEvent} ClientWebtransportSupportEvent
8
+ * @typedef {import('./types').Http3WTSessionVisitorEvent} Http3WTSessionVisitorEvent
9
+ */
10
+ /**
11
+ * @implements {Http3ClientEventHandler}
12
+ */
13
+ export class Http3Client extends Http3WebTransport implements Http3ClientEventHandler {
14
+ /**
15
+ * @param {*} args
16
+ */
17
+ constructor(args: any);
18
+ /** @type {{ resolve: (value?: any) => void, reject: (err?: Error) => void} | null | undefined} */
19
+ sessionProm: {
20
+ resolve: (value?: any) => void;
21
+ reject: (err?: Error) => void;
22
+ } | null | undefined;
23
+ /** @type {Promise<void> | undefined} */
24
+ sessionobj: Promise<void> | undefined;
25
+ /** @type {Http3WTSession | null | undefined} */
26
+ sessionobjint: Http3WTSession | null | undefined;
27
+ closeHookSession(): void;
28
+ /** @type {{ resolve: (value?: any) => void, reject: (err?: Error) => void} | null | undefined} */
29
+ webtransportProm: {
30
+ resolve: (value?: any) => void;
31
+ reject: (err?: Error) => void;
32
+ } | null | undefined;
33
+ /** @type {{ resolve: (value?: any) => void, reject: (err?: Error) => void} | null | undefined} */
34
+ quicconnectedProm: {
35
+ resolve: (value?: any) => void;
36
+ reject: (err?: Error) => void;
37
+ } | null | undefined;
38
+ handleConnection(): Promise<void>;
39
+ quicconnected: Promise<any> | undefined;
40
+ webtransport: Promise<any> | undefined;
41
+ /**
42
+ * @param {Http3WTSession} sessionobj
43
+ * @param {string} path
44
+ * @returns
45
+ */
46
+ createWTSession(sessionobj: Http3WTSession, path: string): Promise<void | undefined>;
47
+ stopped: boolean | undefined;
48
+ /**
49
+ * @param {ClientConnectedEvent} args
50
+ */
51
+ onClientConnected(args: ClientConnectedEvent): void;
52
+ /**
53
+ * @param {ClientWebtransportSupportEvent} args
54
+ */
55
+ onClientWebTransportSupport(args: ClientWebtransportSupportEvent): void;
56
+ /**
57
+ * @param {Http3WTSessionVisitorEvent} args
58
+ */
59
+ onHttp3WTSessionVisitor(args: Http3WTSessionVisitorEvent): void;
60
+ /**
61
+ * @param {ClientConnectedEvent | ClientWebtransportSupportEvent | Http3WTSessionVisitorEvent} args
62
+ */
63
+ customCallback(args: ClientConnectedEvent | ClientWebtransportSupportEvent | Http3WTSessionVisitorEvent): void;
64
+ }
65
+ /**
66
+ * Http3Client events
67
+ */
68
+ export type Http3WTSession = import('./session').Http3WTSession;
69
+ export type Http3ClientEventHandler = import('./types').Http3ClientEventHandler;
70
+ export type ClientConnectedEvent = import('./types').ClientConnectedEvent;
71
+ export type ClientWebtransportSupportEvent = import('./types').ClientWebtransportSupportEvent;
72
+ export type Http3WTSessionVisitorEvent = import('./types').Http3WTSessionVisitorEvent;
73
+ import { Http3WebTransport } from "./transport.js";
74
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../lib/client.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH;;GAEG;AACH;IACE;;OAEG;IACH,uBAkBC;IAfC,kGAAkG;IAClG;0BAD+B,GAAG,KAAK,IAAI;uBAAiB,KAAK,KAAK,IAAI;yBACnD;IAEvB,wCAAwC;IACxC,YADW,QAAQ,IAAI,CAAC,GAAG,SAAS,CAGlB;IAClB,gDAAgD;IAChD,eADW,cAAc,GAAG,IAAI,GAAG,SAAS,CACnB;IA+D3B,yBAGC;IA/DC,kGAAkG;IAClG;0BAD+B,GAAG,KAAK,IAAI;uBAAiB,KAAK,KAAK,IAAI;yBAC9C;IAC5B,kGAAkG;IAClG;0BAD+B,GAAG,KAAK,IAAI;uBAAiB,KAAK,KAAK,IAAI;yBAC7C;IAG/B,kCA4BC;IA3BC,wCAEE;IACF,uCAEE;IAwBJ;;;;OAIG;IACH,4BAJW,cAAc,QACd,MAAM,6BAoBhB;IAIC,6BAAmB;IAGrB;;OAEG;IACH,wBAFW,oBAAoB,QAW9B;IAED;;OAEG;IACH,kCAFW,8BAA8B,QAOxC;IAED;;OAEG;IACH,8BAFW,0BAA0B,QAepC;IAED;;OAEG;IACH,qBAFW,oBAAoB,GAAG,8BAA8B,GAAG,0BAA0B,QAoB5F;CACF;;;;6BA/JY,OAAO,WAAW,EAAE,cAAc;sCAGlC,OAAO,SAAS,EAAE,uBAAuB;mCACzC,OAAO,SAAS,EAAE,oBAAoB;6CACtC,OAAO,SAAS,EAAE,8BAA8B;yCAChD,OAAO,SAAS,EAAE,0BAA0B"}
@@ -0,0 +1,70 @@
1
+ export interface WebTransportDatagramStats {
2
+ timestamp: number;
3
+ expiredOutgoing: bigint;
4
+ droppedIncoming: bigint;
5
+ lostOutgoing: bigint;
6
+ }
7
+ export interface WebTransportStats {
8
+ timestamp: number;
9
+ bytesSent: bigint;
10
+ packetsSent: bigint;
11
+ packetsLost: bigint;
12
+ numOutgoingStreamsCreated: number;
13
+ numIncomingStreamsCreated: number;
14
+ bytesReceived: bigint;
15
+ packetsReceived: bigint;
16
+ smoothedRtt: number;
17
+ rttVariation: number;
18
+ minRtt: number;
19
+ datagrams: WebTransportDatagramStats;
20
+ }
21
+ export interface WebTransportCloseInfo {
22
+ closeCode: number;
23
+ reason: string;
24
+ }
25
+ export interface WebTransportDatagramDuplexStream {
26
+ readable: ReadableStream<Uint8Array>;
27
+ writable: WritableStream<Uint8Array>;
28
+ }
29
+ export interface WebTransportBidirectionalStream {
30
+ readonly readable: ReadableStream<Uint8Array>;
31
+ readonly writable: WritableStream<Uint8Array>;
32
+ }
33
+ export interface WebTransportSendStreamStats {
34
+ timestamp: number;
35
+ bytesWritten: bigint;
36
+ bytesSent: bigint;
37
+ bytesAcknowledged: bigint;
38
+ }
39
+ export interface WebTransportSendStream extends WritableStream<Uint8Array> {
40
+ getStats: () => Promise<WebTransportSendStreamStats>;
41
+ }
42
+ export interface WebTransportReceiveStreamStats {
43
+ timestamp: number;
44
+ bytesReceived: bigint;
45
+ bytesRead: bigint;
46
+ }
47
+ export interface WebTransportReceiveStream extends ReadableStream<Uint8Array> {
48
+ getStats: () => Promise<WebTransportReceiveStreamStats>;
49
+ }
50
+ export interface WebTransportHash {
51
+ algorithm: string;
52
+ value: BufferSource;
53
+ }
54
+ export interface WebTransportOptions {
55
+ allowPooling?: boolean;
56
+ requireUnreliable?: boolean;
57
+ serverCertificateHashes?: WebTransportHash[];
58
+ }
59
+ export interface WebTransport {
60
+ readonly ready: Promise<void>;
61
+ readonly closed: Promise<WebTransportCloseInfo>;
62
+ close: (closeInfo?: WebTransportCloseInfo) => void;
63
+ readonly datagrams: WebTransportDatagramDuplexStream;
64
+ createBidirectionalStream: () => Promise<WebTransportBidirectionalStream>;
65
+ readonly incomingBidirectionalStreams: ReadableStream<WebTransportBidirectionalStream>;
66
+ createUnidirectionalStream: () => Promise<WebTransportSendStream>;
67
+ readonly incomingUnidirectionalStreams: ReadableStream<WebTransportReceiveStream>;
68
+ }
69
+ export declare type WebTransportReliabilityMode = 'pending' | 'reliable-only' | 'supports-unreliable';
70
+ //# sourceMappingURL=dom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../lib/dom.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,MAAM,CA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MAAM,CAAA;CAClB;AAED,MAAM,WAAW,yBAA0B,SAAQ,cAAc,CAAC,UAAU,CAAC;IAC3E,QAAQ,EAAE,MAAM,OAAO,CAAC,8BAA8B,CAAC,CAAA;CACxD;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,YAAY,CAAA;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,uBAAuB,CAAC,EAAE,gBAAgB,EAAE,CAAA;CAC7C;AAED,MAAM,WAAW,YAAY;IAE3B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;IAE7B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAA;IAC/C,KAAK,EAAE,CAAC,SAAS,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAA;IAClD,QAAQ,CAAC,SAAS,EAAE,gCAAgC,CAAA;IAEpD,yBAAyB,EAAE,MAAM,OAAO,CAAC,+BAA+B,CAAC,CAAA;IAEzE,QAAQ,CAAC,4BAA4B,EAAE,cAAc,CAAC,+BAA+B,CAAC,CAAA;IAEtF,0BAA0B,EAAE,MAAM,OAAO,CAAC,sBAAsB,CAAC,CAAA;IAEjE,QAAQ,CAAC,6BAA6B,EAAE,cAAc,CAAC,yBAAyB,CAAC,CAAA;CAClF;AAED,oBAAY,2BAA2B,GAAG,SAAS,GAAG,eAAe,GAAG,qBAAqB,CAAA"}
@@ -0,0 +1,26 @@
1
+ export class Http3EventLoop {
2
+ /** @type {Http3EventLoop | null} */
3
+ static globalLoop: Http3EventLoop | null;
4
+ static callback(): void;
5
+ /**
6
+ * @returns {Http3EventLoop}
7
+ */
8
+ static createGlobalEventLoop(): Http3EventLoop;
9
+ /**
10
+ * @param {any} object
11
+ * @returns {Http3EventLoop}
12
+ */
13
+ static getGlobalEventLoop(object: any): Http3EventLoop;
14
+ /**
15
+ * @param {*} [args]
16
+ */
17
+ constructor(args?: any);
18
+ eventloopInt: any;
19
+ refObjects: Set<any>;
20
+ loopGuardian(): void;
21
+ startEventLoop(): void;
22
+ loopGuardianTimer: NodeJS.Timer | undefined;
23
+ shutdownEventLoop(): void;
24
+ refObjectsEmptyTime: number | undefined;
25
+ }
26
+ //# sourceMappingURL=event-loop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-loop.d.ts","sourceRoot":"","sources":["../../lib/event-loop.js"],"names":[],"mappings":"AAKA;IACE,oCAAoC;IACpC,mBADW,cAAc,GAAG,IAAI,CACR;IA4CxB,wBAEC;IAED;;OAEG;IACH,gCAFa,cAAc,CAS1B;IAED;;;OAGG;IACH,kCAHW,GAAG,GACD,cAAc,CAQ1B;IApED;;OAEG;IACH,wBAWC;IAVC,kBAKE;IAGF,qBAA2B;IAiB7B,qBAWC;IAxBD,uBAIC;IADC,4CAA6D;IAG/D,0BAKC;IASkC,wCAA8B;CAiClE"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * // Spec
3
+ * @typedef {import('./dom').WebTransportDatagramStats} WebTransportDatagramStats
4
+ * @typedef {import('./dom').WebTransportStats} WebTransportStats
5
+ * @typedef {import('./dom').WebTransportCloseInfo} WebTransportCloseInfo
6
+ * @typedef {import('./dom').WebTransportDatagramDuplexStream} WebTransportDatagramDuplexStream
7
+ * @typedef {import('./dom').WebTransportBidirectionalStream} WebTransportBidirectionalStream
8
+ * @typedef {import('./dom').WebTransportSendStreamStats} WebTransportSendStreamStats
9
+ * @typedef {import('./dom').WebTransportSendStream} WebTransportSendStream
10
+ * @typedef {import('./dom').WebTransportReceiveStreamStats} WebTransportReceiveStreamStats
11
+ * @typedef {import('./dom').WebTransportReceiveStream} WebTransportReceiveStream
12
+ * @typedef {import('./dom').WebTransportHash} WebTransportHash
13
+ * @typedef {import('./dom').WebTransportOptions} WebTransportOptions
14
+ * @typedef {import('./dom').WebTransportReliabilityMode} WebTransportReliabilityMode
15
+ *
16
+ * Public API
17
+ * @typedef {import('./types').WebTransportSession} WebTransportSession
18
+ * @typedef {import('./types').Http3ServerInit} Http3ServerInit
19
+ */
20
+ export function testcheck(): boolean;
21
+ export { Http3Server } from "./server.js";
22
+ export { WebTransport } from "./webtransport.js";
23
+ /**
24
+ * // Spec
25
+ */
26
+ export type WebTransportDatagramStats = import('./dom').WebTransportDatagramStats;
27
+ /**
28
+ * // Spec
29
+ */
30
+ export type WebTransportStats = import('./dom').WebTransportStats;
31
+ /**
32
+ * // Spec
33
+ */
34
+ export type WebTransportCloseInfo = import('./dom').WebTransportCloseInfo;
35
+ /**
36
+ * // Spec
37
+ */
38
+ export type WebTransportDatagramDuplexStream = import('./dom').WebTransportDatagramDuplexStream;
39
+ /**
40
+ * // Spec
41
+ */
42
+ export type WebTransportBidirectionalStream = import('./dom').WebTransportBidirectionalStream;
43
+ /**
44
+ * // Spec
45
+ */
46
+ export type WebTransportSendStreamStats = import('./dom').WebTransportSendStreamStats;
47
+ /**
48
+ * // Spec
49
+ */
50
+ export type WebTransportSendStream = import('./dom').WebTransportSendStream;
51
+ /**
52
+ * // Spec
53
+ */
54
+ export type WebTransportReceiveStreamStats = import('./dom').WebTransportReceiveStreamStats;
55
+ /**
56
+ * // Spec
57
+ */
58
+ export type WebTransportReceiveStream = import('./dom').WebTransportReceiveStream;
59
+ /**
60
+ * // Spec
61
+ */
62
+ export type WebTransportHash = import('./dom').WebTransportHash;
63
+ /**
64
+ * // Spec
65
+ */
66
+ export type WebTransportOptions = import('./dom').WebTransportOptions;
67
+ /**
68
+ * Public API
69
+ */
70
+ export type WebTransportReliabilityMode = import('./dom').WebTransportReliabilityMode;
71
+ /**
72
+ * // Spec
73
+ */
74
+ export type WebTransportSession = import('./types').WebTransportSession;
75
+ /**
76
+ * // Spec
77
+ */
78
+ export type Http3ServerInit = import('./types').Http3ServerInit;
79
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,qCAEC;;;;;;wCApBY,OAAO,OAAO,EAAE,yBAAyB;;;;gCACzC,OAAO,OAAO,EAAE,iBAAiB;;;;oCACjC,OAAO,OAAO,EAAE,qBAAqB;;;;+CACrC,OAAO,OAAO,EAAE,gCAAgC;;;;8CAChD,OAAO,OAAO,EAAE,+BAA+B;;;;0CAC/C,OAAO,OAAO,EAAE,2BAA2B;;;;qCAC3C,OAAO,OAAO,EAAE,sBAAsB;;;;6CACtC,OAAO,OAAO,EAAE,8BAA8B;;;;wCAC9C,OAAO,OAAO,EAAE,yBAAyB;;;;+BACzC,OAAO,OAAO,EAAE,gBAAgB;;;;kCAChC,OAAO,OAAO,EAAE,mBAAmB;;;;0CACnC,OAAO,OAAO,EAAE,2BAA2B;;;;kCAG3C,OAAO,SAAS,EAAE,mBAAmB;;;;8BACrC,OAAO,SAAS,EAAE,eAAe"}
@@ -0,0 +1,2 @@
1
+ export const wtrouter: any;
2
+ //# sourceMappingURL=native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../lib/native.js"],"names":[],"mappings":"AAwBA,2BAAuC"}
@@ -0,0 +1,88 @@
1
+ /// <reference types="node" />
2
+ /**
3
+ * @typedef {import('./types').WebTransportSession} WebTransportSession
4
+ * @typedef {import('./types').NativeHttp3WTSession} NativeHttp3WTSession
5
+ * @typedef {import('./types').Http3ServerEventHandler} Http3ServerEventHandler
6
+ * @typedef {import('./types').Http3WTServerSessionVisitorEvent} Http3WTServerSessionVisitorEvent
7
+ * @typedef {import('./types').ServerStatusEvent} ServerStatusEvent
8
+ * @typedef {import('./types').ServerSessionRequestEvent} ServerSessionRequestEvent
9
+ * @typedef {import('./types').Http3ServerInit} Http3ServerInit
10
+ */
11
+ /**
12
+ * @implements {Http3ServerEventHandler}
13
+ */
14
+ export class Http3Server extends Http3WebTransport implements Http3ServerEventHandler {
15
+ /**
16
+ *
17
+ * @param {Http3ServerInit} args
18
+ */
19
+ constructor(args: Http3ServerInit);
20
+ /** @type {Record<string, ReadableStream>} */
21
+ sessionStreams: Record<string, ReadableStream>;
22
+ /** @type {Record<string, ReadableStreamController<any>>} */
23
+ sessionController: Record<string, ReadableStreamController<any>>;
24
+ port: number | null;
25
+ host: string | null;
26
+ /** @type {any} */
27
+ requestHandler: any;
28
+ _ready: import("./types").Deferred<unknown>;
29
+ ready: Promise<unknown>;
30
+ _closed: import("./types").Deferred<unknown>;
31
+ closed: Promise<unknown>;
32
+ startServer(): void;
33
+ stopServer(): void;
34
+ stopped: boolean | undefined;
35
+ /**
36
+ * @returns {{ port: number, host: string, family: 'IPv4' | 'IPv6' } | null}
37
+ */
38
+ address(): {
39
+ port: number;
40
+ host: string;
41
+ family: 'IPv4' | 'IPv6';
42
+ } | null;
43
+ /**
44
+ * @param {any} callback
45
+ */
46
+ setRequestCallback(callback: any): void;
47
+ /**
48
+ * @param {string} path
49
+ * @param {any | undefined} [args=undefined]
50
+ * @returns {ReadableStream<WebTransportSession>}
51
+ */
52
+ sessionStream(path: string, args?: any | undefined): ReadableStream<WebTransportSession>;
53
+ /**
54
+ * @param {ServerSessionRequestEvent} args
55
+ */
56
+ onSessionRequest(args: ServerSessionRequestEvent): void;
57
+ /**
58
+ * @param {Http3WTServerSessionVisitorEvent} args
59
+ */
60
+ onHttp3WTSessionVisitor(args: Http3WTServerSessionVisitorEvent): void;
61
+ /**
62
+ */
63
+ onServerError(): void;
64
+ /**
65
+ */
66
+ onServerListening(): void;
67
+ /**
68
+ */
69
+ onServerClose(): void;
70
+ /**
71
+ * @param {ServerStatusEvent} evt
72
+ */
73
+ onServerStatus(evt: ServerStatusEvent): void;
74
+ /**
75
+ * @param {Http3WTServerSessionVisitorEvent | ServerStatusEvent | ServerSessionRequestEvent} args
76
+ */
77
+ customCallback(args: Http3WTServerSessionVisitorEvent | ServerStatusEvent | ServerSessionRequestEvent): void;
78
+ }
79
+ export type WebTransportSession = import('./types').WebTransportSession;
80
+ export type NativeHttp3WTSession = import('./types').NativeHttp3WTSession;
81
+ export type Http3ServerEventHandler = import('./types').Http3ServerEventHandler;
82
+ export type Http3WTServerSessionVisitorEvent = import('./types').Http3WTServerSessionVisitorEvent;
83
+ export type ServerStatusEvent = import('./types').ServerStatusEvent;
84
+ export type ServerSessionRequestEvent = import('./types').ServerSessionRequestEvent;
85
+ export type Http3ServerInit = import('./types').Http3ServerInit;
86
+ import { Http3WebTransport } from "./transport.js";
87
+ import { ReadableStream } from "stream/web";
88
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../lib/server.js"],"names":[],"mappings":";AAOA;;;;;;;;GAQG;AAEH;;GAEG;AACH;IACE;;;OAGG;IACH,kBAFW,eAAe,EAuBzB;IAlBC,6CAA6C;IAC7C,gBADW,OAAO,MAAM,EAAE,cAAc,CAAC,CACjB;IAExB,4DAA4D;IAC5D,mBADW,OAAO,MAAM,EAAE,yBAAyB,GAAG,CAAC,CAAC,CAC7B;IAE3B,oBAAgB;IAChB,oBAAgB;IAGhB,kBAAkB;IAClB,gBADW,GAAG,CACY;IAE1B,4CAAqB;IACrB,wBAAgC;IAEhC,6CAAsB;IACtB,yBAAkC;IAGpC,oBAEC;IAED,mBAOC;IADC,6BAAmB;IAGrB;;OAEG;IACH,WAFa;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,IAAI,CAa1E;IAED;;OAEG;IACH,6BAFW,GAAG,QAMb;IAED;;;;OAIG;IACH,oBAJW,MAAM,SACN,GAAG,GAAG,SAAS,GACb,eAAe,mBAAmB,CAAC,CAa/C;IAED;;OAEG;IACH,uBAFW,yBAAyB,QAiBnC;IAED;;OAEG;IACH,8BAFW,gCAAgC,QAa1C;IAED;OACG;IACH,sBAEC;IAED;OACG;IACH,0BAEC;IAED;OACG;IACH,sBAEC;IAED;;OAEG;IACH,oBAFW,iBAAiB,QAoB3B;IAED;;OAEG;IACH,qBAFW,gCAAgC,GAAG,iBAAiB,GAAG,yBAAyB,QAoB1F;CACF;kCAnMY,OAAO,SAAS,EAAE,mBAAmB;mCACrC,OAAO,SAAS,EAAE,oBAAoB;sCACtC,OAAO,SAAS,EAAE,uBAAuB;+CACzC,OAAO,SAAS,EAAE,gCAAgC;gCAClD,OAAO,SAAS,EAAE,iBAAiB;wCACnC,OAAO,SAAS,EAAE,yBAAyB;8BAC3C,OAAO,SAAS,EAAE,eAAe"}
@@ -0,0 +1,225 @@
1
+ /// <reference types="node" />
2
+ /**
3
+ * WebTransport session events
4
+ * @typedef {import('./types').WebTransportSessionEventHandler} WebTransportSessionEventHandler
5
+ * @typedef {import('./types').SessionReadyEvent} SessionReadyEvent
6
+ * @typedef {import('./types').SessionCloseEvent} SessionCloseEvent
7
+ * @typedef {import('./types').DatagramReceivedEvent} DatagramReceivedEvent
8
+ * @typedef {import('./types').DatagramSendEvent} DatagramSendEvent
9
+ * @typedef {import('./types').NewStreamEvent} NewStreamEvent
10
+ *
11
+ * @typedef {import('./dom').WebTransportCloseInfo} WebTransportCloseInfo
12
+ * @typedef {import('./dom').WebTransportBidirectionalStream} WebTransportBidirectionalStream
13
+ * @typedef {import('./dom').WebTransportSendStream} WebTransportSendStream
14
+ * @typedef {import('./dom').WebTransportDatagramDuplexStream} WebTransportDatagramDuplexStream
15
+ *
16
+ * @typedef {import('./types').NativeHttp3WTSession} NativeHttp3WTSession
17
+ *
18
+ * Public API
19
+ * @typedef {import('./types').WebTransportSession} WebTransportSession
20
+ *
21
+ * @typedef {import('./server').Http3Server} Http3Server
22
+ * @typedef {import('./client').Http3Client} Http3Client
23
+ *
24
+ * @typedef {import('stream/web').WritableStreamDefaultController} WritableStreamDefaultController
25
+ */
26
+ /**
27
+ * @implements {WebTransportSessionEventHandler}
28
+ * @implements {WebTransportSession}
29
+ */
30
+ export class Http3WTSession implements WebTransportSessionEventHandler, WebTransportSession {
31
+ /**
32
+ * @param {SessionReadyEvent | SessionCloseEvent | DatagramReceivedEvent | DatagramSendEvent | NewStreamEvent} args
33
+ */
34
+ static callback(args: SessionReadyEvent | SessionCloseEvent | DatagramReceivedEvent | DatagramSendEvent | NewStreamEvent): void;
35
+ /**
36
+ * @param {object} args
37
+ * @param {import('./types').NativeHttp3WTSession} [args.object]
38
+ * @param {Http3Server | Http3Client} args.parentobj
39
+ * @param {any | undefined} [args.header= undefined]
40
+ */
41
+ constructor(args: {
42
+ object?: import("./types").NativeHttp3WTSession | undefined;
43
+ parentobj: Http3Server | Http3Client;
44
+ header?: any | undefined;
45
+ });
46
+ objint: import("./types").NativeHttp3WTSession | undefined;
47
+ parentobj: import("./server").Http3Server | import("./client").Http3Client;
48
+ /** @type {import('./types').WebTransportSessionState} */
49
+ state: import('./types').WebTransportSessionState;
50
+ /** @type {((value?: any) => void) | null | undefined} */
51
+ readyResolve: ((value?: any) => void) | null | undefined;
52
+ /** @type {(() => void) | null | undefined} */
53
+ closeHook: (() => void) | null | undefined;
54
+ /** @type {(any | null | undefined)} */
55
+ header: (any | null | undefined);
56
+ /** @type {Promise<void>} */
57
+ ready: Promise<void>;
58
+ readyReject: (reason?: any) => void;
59
+ /** @type {Promise<WebTransportCloseInfo>} */
60
+ closed: Promise<WebTransportCloseInfo>;
61
+ closedResolve: (value: import("./dom").WebTransportCloseInfo | PromiseLike<import("./dom").WebTransportCloseInfo>) => void;
62
+ closedReject: (reason?: any) => void;
63
+ incomingBidirectionalStreams: ReadableStream<any>;
64
+ incomBiDiController: import("stream/web").ReadableStreamController<any>;
65
+ incomingUnidirectionalStreams: ReadableStream<any>;
66
+ incomUniDiController: import("stream/web").ReadableStreamController<any>;
67
+ /** @type {Array<() => void>} */
68
+ writeDatagramRes: (() => void)[];
69
+ /** @type {Array<() => void>} */
70
+ writeDatagramRej: (() => void)[];
71
+ /** @type {Array<Promise<void>>} */
72
+ writeDatagramProm: Array<Promise<void>>;
73
+ /** @type {WebTransportDatagramDuplexStream} */
74
+ datagrams: WebTransportDatagramDuplexStream;
75
+ incomDatagramController: import("stream/web").ReadableStreamController<Uint8Array>;
76
+ outgoDatagramController: import("stream/web").WritableStreamDefaultController;
77
+ /** @type {Array<(stream: WebTransportBidirectionalStream) => void>} */
78
+ resolveBiDi: ((stream: WebTransportBidirectionalStream) => void)[];
79
+ /** @type {Array<(stream: WebTransportSendStream) => void>} */
80
+ resolveUniDi: ((stream: WebTransportSendStream) => void)[];
81
+ /** @type {Array<(err?: Error) => void>} */
82
+ rejectBiDi: ((err?: Error) => void)[];
83
+ /** @type {Array<(err?: Error) => void>} */
84
+ rejectUniDi: ((err?: Error) => void)[];
85
+ sendStreams: Set<any>;
86
+ receiveStreams: Set<any>;
87
+ /** @type {Set<Http3WTStream>} */
88
+ streamObjs: Set<Http3WTStream>;
89
+ /** @type {Set<WritableStreamDefaultController>} */
90
+ sendStreamsController: Set<WritableStreamDefaultController>;
91
+ /** @type {Set<ReadableStreamDefaultController>} */
92
+ receiveStreamsController: Set<ReadableStreamDefaultController>;
93
+ /**
94
+ * @param {NativeHttp3WTSession} object
95
+ */
96
+ setSessionObj(object: NativeHttp3WTSession): void;
97
+ waitForDatagramsSend(): Promise<void>;
98
+ /**
99
+ * @param {Http3WTStream} stream
100
+ */
101
+ addStreamObj(stream: Http3WTStream): void;
102
+ /**
103
+ * @param {Http3WTStream} stream
104
+ */
105
+ removeStreamObj(stream: Http3WTStream): void;
106
+ /**
107
+ * @param {WritableStream} stream
108
+ * @param {WritableStreamDefaultController} controller
109
+ */
110
+ addSendStream(stream: WritableStream, controller: WritableStreamDefaultController): void;
111
+ /**
112
+ * @param {WritableStream} stream
113
+ * @param {WritableStreamDefaultController} controller
114
+ */
115
+ removeSendStream(stream: WritableStream, controller: WritableStreamDefaultController): void;
116
+ /**
117
+ * @param {ReadableStream} stream
118
+ * @param {ReadableStreamDefaultController} controller
119
+ */
120
+ addReceiveStream(stream: ReadableStream, controller: ReadableStreamDefaultController): void;
121
+ /**
122
+ * @param {ReadableStream} stream
123
+ * @param {ReadableStreamDefaultController} controller
124
+ */
125
+ removeReceiveStream(stream: ReadableStream, controller: ReadableStreamDefaultController): void;
126
+ /**
127
+ * @returns {Promise<WebTransportBidirectionalStream>}
128
+ */
129
+ createBidirectionalStream(): Promise<WebTransportBidirectionalStream>;
130
+ /**
131
+ *@returns {Promise<WebTransportSendStream>}
132
+ */
133
+ createUnidirectionalStream(): Promise<WebTransportSendStream>;
134
+ /**
135
+ * @param {object} [closeInfo]
136
+ * @param {number} closeInfo.closeCode
137
+ * @param {string} closeInfo.reason
138
+ * @returns {void}
139
+ */
140
+ close(closeInfo?: {
141
+ closeCode: number;
142
+ reason: string;
143
+ } | undefined): void;
144
+ onReady(): void;
145
+ /**
146
+ * @param {SessionCloseEvent} args
147
+ */
148
+ onClose(args: SessionCloseEvent): void;
149
+ /**
150
+ * @param {NewStreamEvent} args
151
+ */
152
+ onStream(args: NewStreamEvent): void;
153
+ /**
154
+ * @param {DatagramReceivedEvent} args
155
+ */
156
+ onDatagramReceived(args: DatagramReceivedEvent): void;
157
+ /**
158
+ * @param {DatagramSendEvent} args
159
+ */
160
+ onDatagramSend(args: DatagramSendEvent): void;
161
+ }
162
+ /**
163
+ * WebTransport session events
164
+ */
165
+ export type WebTransportSessionEventHandler = import('./types').WebTransportSessionEventHandler;
166
+ /**
167
+ * WebTransport session events
168
+ */
169
+ export type SessionReadyEvent = import('./types').SessionReadyEvent;
170
+ /**
171
+ * WebTransport session events
172
+ */
173
+ export type SessionCloseEvent = import('./types').SessionCloseEvent;
174
+ /**
175
+ * WebTransport session events
176
+ */
177
+ export type DatagramReceivedEvent = import('./types').DatagramReceivedEvent;
178
+ /**
179
+ * WebTransport session events
180
+ */
181
+ export type DatagramSendEvent = import('./types').DatagramSendEvent;
182
+ /**
183
+ * WebTransport session events
184
+ */
185
+ export type NewStreamEvent = import('./types').NewStreamEvent;
186
+ /**
187
+ * WebTransport session events
188
+ */
189
+ export type WebTransportCloseInfo = import('./dom').WebTransportCloseInfo;
190
+ /**
191
+ * WebTransport session events
192
+ */
193
+ export type WebTransportBidirectionalStream = import('./dom').WebTransportBidirectionalStream;
194
+ /**
195
+ * WebTransport session events
196
+ */
197
+ export type WebTransportSendStream = import('./dom').WebTransportSendStream;
198
+ /**
199
+ * WebTransport session events
200
+ */
201
+ export type WebTransportDatagramDuplexStream = import('./dom').WebTransportDatagramDuplexStream;
202
+ /**
203
+ * Public API
204
+ */
205
+ export type NativeHttp3WTSession = import('./types').NativeHttp3WTSession;
206
+ /**
207
+ * WebTransport session events
208
+ */
209
+ export type WebTransportSession = import('./types').WebTransportSession;
210
+ /**
211
+ * WebTransport session events
212
+ */
213
+ export type Http3Server = import('./server').Http3Server;
214
+ /**
215
+ * WebTransport session events
216
+ */
217
+ export type Http3Client = import('./client').Http3Client;
218
+ /**
219
+ * WebTransport session events
220
+ */
221
+ export type WritableStreamDefaultController = import('stream/web').WritableStreamDefaultController;
222
+ import { ReadableStream } from "stream/web";
223
+ import { Http3WTStream } from "./stream.js";
224
+ import { WritableStream } from "stream/web";
225
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../lib/session.js"],"names":[],"mappings":";AAGA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;GAGG;AACH;IAmWE;;OAEG;IACH,sBAFW,iBAAiB,GAAG,iBAAiB,GAAG,qBAAqB,GAAG,iBAAiB,GAAG,cAAc,QAmC5G;IAtYD;;;;;OAKG;IACH;QAJyD,MAAM;QACpB,SAAS,EAAzC,WAAW,GAAG,WAAW;QACF,MAAM,GAA7B,GAAG,GAAG,SAAS;OAoGzB;IAhGG,2DAAyB;IAG3B,2EAA+B;IAC/B,yDAAyD;IACzD,OADW,OAAO,SAAS,EA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