@fails-components/webtransport-transport-http3-quiche 1.5.3 → 1.6.1

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/CMakeLists.txt CHANGED
@@ -158,6 +158,8 @@ third_party/quiche/quiche/common/http/http_header_block.cc
158
158
  third_party/quiche/quiche/common/http/http_header_block.h
159
159
  third_party/quiche/quiche/common/http/http_header_storage.cc
160
160
  third_party/quiche/quiche/common/http/http_header_storage.h
161
+ third_party/quiche/quiche/common/moq_varint.h
162
+ third_party/quiche/quiche/common/moq_varint.cc
161
163
  third_party/quiche/quiche/common/platform/api/quiche_bug_tracker.h
162
164
  third_party/quiche/quiche/common/platform/api/quiche_export.h
163
165
  third_party/quiche/quiche/common/platform/api/quiche_flag_utils.h
@@ -437,8 +439,6 @@ third_party/quiche/quiche/quic/core/crypto/chacha_base_decrypter.cc
437
439
  third_party/quiche/quiche/quic/core/crypto/chacha_base_decrypter.h
438
440
  third_party/quiche/quiche/quic/core/crypto/chacha_base_encrypter.cc
439
441
  third_party/quiche/quiche/quic/core/crypto/chacha_base_encrypter.h
440
- third_party/quiche/quiche/quic/core/crypto/channel_id.cc
441
- third_party/quiche/quiche/quic/core/crypto/channel_id.h
442
442
  third_party/quiche/quiche/quic/core/crypto/client_proof_source.cc
443
443
  third_party/quiche/quiche/quic/core/crypto/client_proof_source.h
444
444
  third_party/quiche/quiche/quic/core/crypto/crypto_framer.cc
@@ -831,6 +831,7 @@ third_party/quiche/quiche/quic/platform/api/quic_stack_trace.h
831
831
  third_party/quiche/quiche/quic/platform/api/quic_thread.h
832
832
  third_party/quiche/quiche/quic/tools/quic_simple_crypto_server_stream_helper.cc
833
833
  third_party/quiche/quiche/quic/tools/quic_simple_crypto_server_stream_helper.h
834
+ third_party/quiche/quiche/web_transport/stream_helpers.h
834
835
  third_party/quiche/quiche/web_transport/web_transport_headers.cc
835
836
  third_party/quiche/quiche/web_transport/web_transport_headers.h
836
837
  third_party/quiche/quiche/web_transport/web_transport_priority_scheduler.cc
@@ -1,10 +1,15 @@
1
1
  export class Http3WebTransportServerSocket extends Http3WebTransportSocket {
2
+ /**
3
+ * @param {import('../../../main/lib/types.js').Http3QuicheServerWebTransportInit|undefined} args
4
+ */
5
+ constructor(args: import('../../../main/lib/types.js').Http3QuicheServerWebTransportInit | undefined);
2
6
  port: number;
3
7
  host: string;
4
8
  /** @type {import('../../../main/lib/session.js').HttpServer} */
5
9
  jsobj: import('../../../main/lib/session.js').HttpServer;
6
10
  /** @type {import('node:dns').LookupAddress|undefined} */
7
11
  address: import('node:dns').LookupAddress | undefined;
12
+ socketOptions: {};
8
13
  init(): void;
9
14
  stopServer(): void;
10
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"serversocket.d.ts","sourceRoot":"","sources":["../../lib/serversocket.js"],"names":[],"mappings":"AAQA;IAQI,aAAwB;IACxB,aAAqC;IACrC,gEAAgE;IAEhE,OAFW,OAAO,8BAA8B,EAAE,UAAU,CAEtC;IAEtB,yDAAyD;IACzD,SADW,OAAO,UAAU,EAAE,aAAa,GAAC,SAAS,CAC7B;IAG1B,aA6CC;IAED,mBAKC;CACF"}
1
+ {"version":3,"file":"serversocket.d.ts","sourceRoot":"","sources":["../../lib/serversocket.js"],"names":[],"mappings":"AAQA;IACE;;OAEG;IACH,kBAFW,OAAO,4BAA4B,EAAE,iCAAiC,GAAC,SAAS,EAgB1F;IAVC,aAAwB;IACxB,aAAqC;IACrC,gEAAgE;IAEhE,OAFW,OAAO,8BAA8B,EAAE,UAAU,CAEtC;IAEtB,yDAAyD;IACzD,SADW,OAAO,UAAU,EAAE,aAAa,GAAC,SAAS,CAC7B;IAExB,kBAAwD;IAG1D,aAiDC;IAED,mBAKC;CACF"}
@@ -8,7 +8,7 @@ const log = logger(`webtransport:Http3WebTransportServerSocket(${process.pid})`)
8
8
 
9
9
  export class Http3WebTransportServerSocket extends Http3WebTransportSocket {
10
10
  /**
11
- * @param {import('../../../main/lib/types.js').HttpWebTransportInit|undefined} args
11
+ * @param {import('../../../main/lib/types.js').Http3QuicheServerWebTransportInit|undefined} args
12
12
  */
13
13
  constructor(args) {
14
14
  super(args)
@@ -22,6 +22,8 @@ export class Http3WebTransportServerSocket extends Http3WebTransportSocket {
22
22
 
23
23
  /** @type {import('node:dns').LookupAddress|undefined} */
24
24
  this.address = undefined
25
+
26
+ this.socketOptions = args?.quicheNodeSocketOptions ?? {}
25
27
  }
26
28
 
27
29
  init() {
@@ -29,7 +31,11 @@ export class Http3WebTransportServerSocket extends Http3WebTransportSocket {
29
31
  .then((result) => {
30
32
  this.address = result
31
33
  this.socketInt = createSocket({
32
- type: result.family === 4 ? 'udp4' : 'udp6'
34
+ ...{
35
+ type: result.family === 4 ? 'udp4' : 'udp6',
36
+ reuseAddr: true
37
+ },
38
+ ...this.socketOptions
33
39
  })
34
40
 
35
41
  this.socketInt.on('listening', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fails-components/webtransport-transport-http3-quiche",
3
- "version": "1.5.3",
3
+ "version": "1.6.1",
4
4
  "description": "A component to add webtransport support (server and client) to node.js, transport using libquiche",
5
5
  "exports": {
6
6
  ".": {
@@ -4,6 +4,7 @@
4
4
 
5
5
  #include "src/http3wtstreamvisitor.h"
6
6
  #include "src/http3server.h"
7
+ #include "quiche/web_transport/stream_helpers.h"
7
8
 
8
9
  namespace quic
9
10
  {
@@ -140,7 +141,7 @@ namespace quic
140
141
  {
141
142
  auto cur = chunks_.front();
142
143
  absl::Status status =
143
- WriteIntoStream(*stream_, absl::string_view(cur.buffer, cur.len));
144
+ webtransport::WriteIntoStream(*stream_, absl::string_view(cur.buffer, cur.len));
144
145
  QUIC_DVLOG(1) << "Attempted writing on WebTransport bidirectional stream "
145
146
  << ", success: " << status;
146
147
  if (!status.ok())
@@ -155,7 +156,7 @@ namespace quic
155
156
 
156
157
  if (send_fin_)
157
158
  {
158
- absl::Status status = SendFinOnStream(*stream_);
159
+ absl::Status status = webtransport::SendFinOnStream(*stream_);
159
160
  if (status.ok()) {
160
161
  fin_was_sent_ = true;
161
162
  getJS()->processStreamNetworkFinish(NetworkTask::streamFinal);
@@ -37,7 +37,7 @@ namespace quic
37
37
  {
38
38
  }
39
39
 
40
- ~Http3WTStream(){/*printf("stream destruct %x\n", this);*/};
40
+ ~Http3WTStream() { /*printf("stream destruct %x\n", this);*/ };
41
41
 
42
42
  class Visitor : public WebTransportStreamVisitor
43
43
  {
@@ -184,23 +184,20 @@ namespace quic
184
184
  {
185
185
  public:
186
186
  StreamReadBuffer(Http3WTStreamJS *jsobj) : fin(false), jsobj_(jsobj),
187
- buffer_(nullptr), buffersize_(0)
187
+ buffer_(nullptr), buffersize_(0)
188
188
  {
189
189
  }
190
190
 
191
191
  void getBuffer(size_t reqsize);
192
192
 
193
+ unsigned char *bufferData() { return buffer_; };
194
+ size_t bufferSize() { return buffersize_; };
193
195
 
194
-
195
- unsigned char * bufferData() { return buffer_;};
196
- size_t bufferSize() { return buffersize_;};
197
-
198
- bool hasBuffer() {return buffer_ != nullptr;}
196
+ bool hasBuffer() { return buffer_ != nullptr; }
199
197
 
200
198
  void commitBuffer(uint32_t readbytes, bool drained);
201
199
 
202
- void setFin() { fin = true;}
203
-
200
+ void setFin() { fin = true; }
204
201
 
205
202
  protected:
206
203
  Napi::ObjectReference bufferObj;
@@ -212,8 +209,7 @@ namespace quic
212
209
  Http3WTStreamJS *jsobj_; // unowned
213
210
  };
214
211
 
215
- public:
216
-
212
+ public:
217
213
  Http3WTStreamJS(const Napi::CallbackInfo &info) : Napi::ObjectWrap<Http3WTStreamJS>(info)
218
214
  {
219
215
  }
@@ -310,21 +306,22 @@ namespace quic
310
306
  {
311
307
  Napi::Function tplwtsv =
312
308
  DefineClass(env, "Http3WTStreamVisitor",
313
- {InstanceMethod<&Http3WTStreamJS::writeChunk>("writeChunk",
314
- static_cast<napi_property_attributes>(napi_writable | napi_configurable)),
315
- InstanceMethod<&Http3WTStreamJS::resetStream>("resetStream",
316
- static_cast<napi_property_attributes>(napi_writable | napi_configurable)),
317
- InstanceMethod<&Http3WTStreamJS::stopSending>("stopSending", static_cast<napi_property_attributes>(napi_writable | napi_configurable)),
318
- InstanceMethod<&Http3WTStreamJS::streamFinal>("streamFinal", static_cast<napi_property_attributes>(napi_writable | napi_configurable)),
319
- InstanceMethod<&Http3WTStreamJS::startReading>("startReading",
320
- static_cast<napi_property_attributes>(napi_writable | napi_configurable)),
321
- InstanceMethod<&Http3WTStreamJS::startReading>("drainReads",
322
- static_cast<napi_property_attributes>(napi_writable | napi_configurable)),
323
- InstanceMethod<&Http3WTStreamJS::stopReading>("stopReading",
324
- static_cast<napi_property_attributes>(napi_writable | napi_configurable)),
325
- InstanceMethod<&Http3WTStreamJS::updateSendOrderAndGroup>("updateSendOrderAndGroup",
326
- static_cast<napi_property_attributes>(napi_writable | napi_configurable)),
327
- });
309
+ {
310
+ InstanceMethod<&Http3WTStreamJS::writeChunk>("writeChunk",
311
+ static_cast<napi_property_attributes>(napi_writable | napi_configurable)),
312
+ InstanceMethod<&Http3WTStreamJS::resetStream>("resetStream",
313
+ static_cast<napi_property_attributes>(napi_writable | napi_configurable)),
314
+ InstanceMethod<&Http3WTStreamJS::stopSending>("stopSending", static_cast<napi_property_attributes>(napi_writable | napi_configurable)),
315
+ InstanceMethod<&Http3WTStreamJS::streamFinal>("streamFinal", static_cast<napi_property_attributes>(napi_writable | napi_configurable)),
316
+ InstanceMethod<&Http3WTStreamJS::startReading>("startReading",
317
+ static_cast<napi_property_attributes>(napi_writable | napi_configurable)),
318
+ InstanceMethod<&Http3WTStreamJS::drainReads>("drainReads",
319
+ static_cast<napi_property_attributes>(napi_writable | napi_configurable)),
320
+ InstanceMethod<&Http3WTStreamJS::stopReading>("stopReading",
321
+ static_cast<napi_property_attributes>(napi_writable | napi_configurable)),
322
+ InstanceMethod<&Http3WTStreamJS::updateSendOrderAndGroup>("updateSendOrderAndGroup",
323
+ static_cast<napi_property_attributes>(napi_writable | napi_configurable)),
324
+ });
328
325
  constr->stream = Napi::Persistent(tplwtsv);
329
326
  exports.Set("Http3WTStreamVisitor", tplwtsv);
330
327
  }