@mercuryworkshop/epoxy-transport 2.1.6 → 2.1.7
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/index.js +363 -4
- package/dist/index.mjs +363 -4
- package/package.json +1 -1
- package/src/main.ts +5 -5
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
// src/main.ts
|
|
22
22
|
var main_exports = {};
|
|
23
23
|
__export(main_exports, {
|
|
24
|
-
default: () =>
|
|
24
|
+
default: () => EpoxyTransport
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(main_exports);
|
|
27
27
|
|
|
@@ -203,6 +203,22 @@ function passArrayJsValueToWasm0(array, malloc) {
|
|
|
203
203
|
WASM_VECTOR_LEN = array.length;
|
|
204
204
|
return ptr;
|
|
205
205
|
}
|
|
206
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
207
|
+
ptr = ptr >>> 0;
|
|
208
|
+
const mem = getUint32Memory0();
|
|
209
|
+
const slice = mem.subarray(ptr / 4, ptr / 4 + len);
|
|
210
|
+
const result = [];
|
|
211
|
+
for (let i = 0; i < slice.length; i++) {
|
|
212
|
+
result.push(takeObject(slice[i]));
|
|
213
|
+
}
|
|
214
|
+
return result;
|
|
215
|
+
}
|
|
216
|
+
function _assertClass(instance, klass) {
|
|
217
|
+
if (!(instance instanceof klass)) {
|
|
218
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
219
|
+
}
|
|
220
|
+
return instance.ptr;
|
|
221
|
+
}
|
|
206
222
|
function __wbg_adapter_162(arg0, arg1, arg2, arg3) {
|
|
207
223
|
wasm.wasm_bindgen__convert__closures__invoke2_mut__h3b11eef3b4066485(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
208
224
|
}
|
|
@@ -213,12 +229,355 @@ function getArrayU8FromWasm0(ptr, len) {
|
|
|
213
229
|
var EpoxyClientFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
214
230
|
}, unregister: () => {
|
|
215
231
|
} } : new FinalizationRegistry((ptr) => wasm.__wbg_epoxyclient_free(ptr >>> 0));
|
|
232
|
+
var EpoxyClient = class {
|
|
233
|
+
toJSON() {
|
|
234
|
+
return {
|
|
235
|
+
redirect_limit: this.redirect_limit,
|
|
236
|
+
user_agent: this.user_agent
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
toString() {
|
|
240
|
+
return JSON.stringify(this);
|
|
241
|
+
}
|
|
242
|
+
__destroy_into_raw() {
|
|
243
|
+
const ptr = this.__wbg_ptr;
|
|
244
|
+
this.__wbg_ptr = 0;
|
|
245
|
+
EpoxyClientFinalization.unregister(this);
|
|
246
|
+
return ptr;
|
|
247
|
+
}
|
|
248
|
+
free() {
|
|
249
|
+
const ptr = this.__destroy_into_raw();
|
|
250
|
+
wasm.__wbg_epoxyclient_free(ptr);
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* @returns {number}
|
|
254
|
+
*/
|
|
255
|
+
get redirect_limit() {
|
|
256
|
+
const ret = wasm.__wbg_get_epoxyclient_redirect_limit(this.__wbg_ptr);
|
|
257
|
+
return ret >>> 0;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* @param {number} arg0
|
|
261
|
+
*/
|
|
262
|
+
set redirect_limit(arg0) {
|
|
263
|
+
wasm.__wbg_set_epoxyclient_redirect_limit(this.__wbg_ptr, arg0);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* @returns {string}
|
|
267
|
+
*/
|
|
268
|
+
get user_agent() {
|
|
269
|
+
let deferred1_0;
|
|
270
|
+
let deferred1_1;
|
|
271
|
+
try {
|
|
272
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
273
|
+
wasm.__wbg_get_epoxyclient_user_agent(retptr, this.__wbg_ptr);
|
|
274
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
275
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
276
|
+
deferred1_0 = r0;
|
|
277
|
+
deferred1_1 = r1;
|
|
278
|
+
return getStringFromWasm0(r0, r1);
|
|
279
|
+
} finally {
|
|
280
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
281
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* @param {string} arg0
|
|
286
|
+
*/
|
|
287
|
+
set user_agent(arg0) {
|
|
288
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
289
|
+
const len0 = WASM_VECTOR_LEN;
|
|
290
|
+
wasm.__wbg_set_epoxyclient_user_agent(this.__wbg_ptr, ptr0, len0);
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* @param {string} wisp_url
|
|
294
|
+
* @param {EpoxyClientOptions} options
|
|
295
|
+
*/
|
|
296
|
+
constructor(wisp_url, options) {
|
|
297
|
+
try {
|
|
298
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
299
|
+
const ptr0 = passStringToWasm0(wisp_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
300
|
+
const len0 = WASM_VECTOR_LEN;
|
|
301
|
+
_assertClass(options, EpoxyClientOptions);
|
|
302
|
+
var ptr1 = options.__destroy_into_raw();
|
|
303
|
+
wasm.epoxyclient_new(retptr, ptr0, len0, ptr1);
|
|
304
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
305
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
306
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
307
|
+
if (r2) {
|
|
308
|
+
throw takeObject(r1);
|
|
309
|
+
}
|
|
310
|
+
this.__wbg_ptr = r0 >>> 0;
|
|
311
|
+
return this;
|
|
312
|
+
} finally {
|
|
313
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* @returns {Promise<void>}
|
|
318
|
+
*/
|
|
319
|
+
replace_stream_provider() {
|
|
320
|
+
const ret = wasm.epoxyclient_replace_stream_provider(this.__wbg_ptr);
|
|
321
|
+
return takeObject(ret);
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* @param {EpoxyHandlers} handlers
|
|
325
|
+
* @param {string} url
|
|
326
|
+
* @param {(string)[]} protocols
|
|
327
|
+
* @param {any} headers
|
|
328
|
+
* @returns {Promise<EpoxyWebSocket>}
|
|
329
|
+
*/
|
|
330
|
+
connect_websocket(handlers, url, protocols, headers) {
|
|
331
|
+
_assertClass(handlers, EpoxyHandlers);
|
|
332
|
+
var ptr0 = handlers.__destroy_into_raw();
|
|
333
|
+
const ptr1 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
334
|
+
const len1 = WASM_VECTOR_LEN;
|
|
335
|
+
const ptr2 = passArrayJsValueToWasm0(protocols, wasm.__wbindgen_malloc);
|
|
336
|
+
const len2 = WASM_VECTOR_LEN;
|
|
337
|
+
const ret = wasm.epoxyclient_connect_websocket(this.__wbg_ptr, ptr0, ptr1, len1, ptr2, len2, addHeapObject(headers));
|
|
338
|
+
return takeObject(ret);
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* @param {EpoxyHandlers} handlers
|
|
342
|
+
* @param {string} url
|
|
343
|
+
* @returns {Promise<EpoxyIoStream>}
|
|
344
|
+
*/
|
|
345
|
+
connect_tcp(handlers, url) {
|
|
346
|
+
_assertClass(handlers, EpoxyHandlers);
|
|
347
|
+
var ptr0 = handlers.__destroy_into_raw();
|
|
348
|
+
const ptr1 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
349
|
+
const len1 = WASM_VECTOR_LEN;
|
|
350
|
+
const ret = wasm.epoxyclient_connect_tcp(this.__wbg_ptr, ptr0, ptr1, len1);
|
|
351
|
+
return takeObject(ret);
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* @param {EpoxyHandlers} handlers
|
|
355
|
+
* @param {string} url
|
|
356
|
+
* @returns {Promise<EpoxyIoStream>}
|
|
357
|
+
*/
|
|
358
|
+
connect_tls(handlers, url) {
|
|
359
|
+
_assertClass(handlers, EpoxyHandlers);
|
|
360
|
+
var ptr0 = handlers.__destroy_into_raw();
|
|
361
|
+
const ptr1 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
362
|
+
const len1 = WASM_VECTOR_LEN;
|
|
363
|
+
const ret = wasm.epoxyclient_connect_tls(this.__wbg_ptr, ptr0, ptr1, len1);
|
|
364
|
+
return takeObject(ret);
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* @param {EpoxyHandlers} handlers
|
|
368
|
+
* @param {string} url
|
|
369
|
+
* @returns {Promise<EpoxyUdpStream>}
|
|
370
|
+
*/
|
|
371
|
+
connect_udp(handlers, url) {
|
|
372
|
+
_assertClass(handlers, EpoxyHandlers);
|
|
373
|
+
var ptr0 = handlers.__destroy_into_raw();
|
|
374
|
+
const ptr1 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
375
|
+
const len1 = WASM_VECTOR_LEN;
|
|
376
|
+
const ret = wasm.epoxyclient_connect_udp(this.__wbg_ptr, ptr0, ptr1, len1);
|
|
377
|
+
return takeObject(ret);
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* @param {string} url
|
|
381
|
+
* @param {object} options
|
|
382
|
+
* @returns {Promise<Response>}
|
|
383
|
+
*/
|
|
384
|
+
fetch(url, options) {
|
|
385
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
386
|
+
const len0 = WASM_VECTOR_LEN;
|
|
387
|
+
const ret = wasm.epoxyclient_fetch(this.__wbg_ptr, ptr0, len0, addHeapObject(options));
|
|
388
|
+
return takeObject(ret);
|
|
389
|
+
}
|
|
390
|
+
};
|
|
216
391
|
var EpoxyClientOptionsFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
217
392
|
}, unregister: () => {
|
|
218
393
|
} } : new FinalizationRegistry((ptr) => wasm.__wbg_epoxyclientoptions_free(ptr >>> 0));
|
|
394
|
+
var EpoxyClientOptions = class {
|
|
395
|
+
__destroy_into_raw() {
|
|
396
|
+
const ptr = this.__wbg_ptr;
|
|
397
|
+
this.__wbg_ptr = 0;
|
|
398
|
+
EpoxyClientOptionsFinalization.unregister(this);
|
|
399
|
+
return ptr;
|
|
400
|
+
}
|
|
401
|
+
free() {
|
|
402
|
+
const ptr = this.__destroy_into_raw();
|
|
403
|
+
wasm.__wbg_epoxyclientoptions_free(ptr);
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* @returns {boolean}
|
|
407
|
+
*/
|
|
408
|
+
get wisp_v2() {
|
|
409
|
+
const ret = wasm.__wbg_get_epoxyclientoptions_wisp_v2(this.__wbg_ptr);
|
|
410
|
+
return ret !== 0;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* @param {boolean} arg0
|
|
414
|
+
*/
|
|
415
|
+
set wisp_v2(arg0) {
|
|
416
|
+
wasm.__wbg_set_epoxyclientoptions_wisp_v2(this.__wbg_ptr, arg0);
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* @returns {boolean}
|
|
420
|
+
*/
|
|
421
|
+
get udp_extension_required() {
|
|
422
|
+
const ret = wasm.__wbg_get_epoxyclientoptions_udp_extension_required(this.__wbg_ptr);
|
|
423
|
+
return ret !== 0;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* @param {boolean} arg0
|
|
427
|
+
*/
|
|
428
|
+
set udp_extension_required(arg0) {
|
|
429
|
+
wasm.__wbg_set_epoxyclientoptions_udp_extension_required(this.__wbg_ptr, arg0);
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* @returns {(string)[]}
|
|
433
|
+
*/
|
|
434
|
+
get websocket_protocols() {
|
|
435
|
+
try {
|
|
436
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
437
|
+
wasm.__wbg_get_epoxyclientoptions_websocket_protocols(retptr, this.__wbg_ptr);
|
|
438
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
439
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
440
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
441
|
+
wasm.__wbindgen_free(r0, r1 * 4, 4);
|
|
442
|
+
return v1;
|
|
443
|
+
} finally {
|
|
444
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* @param {(string)[]} arg0
|
|
449
|
+
*/
|
|
450
|
+
set websocket_protocols(arg0) {
|
|
451
|
+
const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
452
|
+
const len0 = WASM_VECTOR_LEN;
|
|
453
|
+
wasm.__wbg_set_epoxyclientoptions_websocket_protocols(this.__wbg_ptr, ptr0, len0);
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* @returns {number}
|
|
457
|
+
*/
|
|
458
|
+
get redirect_limit() {
|
|
459
|
+
const ret = wasm.__wbg_get_epoxyclientoptions_redirect_limit(this.__wbg_ptr);
|
|
460
|
+
return ret >>> 0;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* @param {number} arg0
|
|
464
|
+
*/
|
|
465
|
+
set redirect_limit(arg0) {
|
|
466
|
+
wasm.__wbg_set_epoxyclientoptions_redirect_limit(this.__wbg_ptr, arg0);
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* @returns {string}
|
|
470
|
+
*/
|
|
471
|
+
get user_agent() {
|
|
472
|
+
let deferred1_0;
|
|
473
|
+
let deferred1_1;
|
|
474
|
+
try {
|
|
475
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
476
|
+
wasm.__wbg_get_epoxyclientoptions_user_agent(retptr, this.__wbg_ptr);
|
|
477
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
478
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
479
|
+
deferred1_0 = r0;
|
|
480
|
+
deferred1_1 = r1;
|
|
481
|
+
return getStringFromWasm0(r0, r1);
|
|
482
|
+
} finally {
|
|
483
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
484
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* @param {string} arg0
|
|
489
|
+
*/
|
|
490
|
+
set user_agent(arg0) {
|
|
491
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
492
|
+
const len0 = WASM_VECTOR_LEN;
|
|
493
|
+
wasm.__wbg_set_epoxyclientoptions_user_agent(this.__wbg_ptr, ptr0, len0);
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
*/
|
|
497
|
+
constructor() {
|
|
498
|
+
const ret = wasm.epoxyclientoptions_new_default();
|
|
499
|
+
this.__wbg_ptr = ret >>> 0;
|
|
500
|
+
return this;
|
|
501
|
+
}
|
|
502
|
+
};
|
|
219
503
|
var EpoxyHandlersFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
220
504
|
}, unregister: () => {
|
|
221
505
|
} } : new FinalizationRegistry((ptr) => wasm.__wbg_epoxyhandlers_free(ptr >>> 0));
|
|
506
|
+
var EpoxyHandlers = class {
|
|
507
|
+
__destroy_into_raw() {
|
|
508
|
+
const ptr = this.__wbg_ptr;
|
|
509
|
+
this.__wbg_ptr = 0;
|
|
510
|
+
EpoxyHandlersFinalization.unregister(this);
|
|
511
|
+
return ptr;
|
|
512
|
+
}
|
|
513
|
+
free() {
|
|
514
|
+
const ptr = this.__destroy_into_raw();
|
|
515
|
+
wasm.__wbg_epoxyhandlers_free(ptr);
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* @returns {Function}
|
|
519
|
+
*/
|
|
520
|
+
get onopen() {
|
|
521
|
+
const ret = wasm.__wbg_get_epoxyhandlers_onopen(this.__wbg_ptr);
|
|
522
|
+
return takeObject(ret);
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* @param {Function} arg0
|
|
526
|
+
*/
|
|
527
|
+
set onopen(arg0) {
|
|
528
|
+
wasm.__wbg_set_epoxyhandlers_onopen(this.__wbg_ptr, addHeapObject(arg0));
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* @returns {Function}
|
|
532
|
+
*/
|
|
533
|
+
get onclose() {
|
|
534
|
+
const ret = wasm.__wbg_get_epoxyhandlers_onclose(this.__wbg_ptr);
|
|
535
|
+
return takeObject(ret);
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* @param {Function} arg0
|
|
539
|
+
*/
|
|
540
|
+
set onclose(arg0) {
|
|
541
|
+
wasm.__wbg_set_epoxyhandlers_onclose(this.__wbg_ptr, addHeapObject(arg0));
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* @returns {Function}
|
|
545
|
+
*/
|
|
546
|
+
get onerror() {
|
|
547
|
+
const ret = wasm.__wbg_get_epoxyhandlers_onerror(this.__wbg_ptr);
|
|
548
|
+
return takeObject(ret);
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* @param {Function} arg0
|
|
552
|
+
*/
|
|
553
|
+
set onerror(arg0) {
|
|
554
|
+
wasm.__wbg_set_epoxyhandlers_onerror(this.__wbg_ptr, addHeapObject(arg0));
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* @returns {Function}
|
|
558
|
+
*/
|
|
559
|
+
get onmessage() {
|
|
560
|
+
const ret = wasm.__wbg_get_epoxyhandlers_onmessage(this.__wbg_ptr);
|
|
561
|
+
return takeObject(ret);
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* @param {Function} arg0
|
|
565
|
+
*/
|
|
566
|
+
set onmessage(arg0) {
|
|
567
|
+
wasm.__wbg_set_epoxyhandlers_onmessage(this.__wbg_ptr, addHeapObject(arg0));
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* @param {Function} onopen
|
|
571
|
+
* @param {Function} onclose
|
|
572
|
+
* @param {Function} onerror
|
|
573
|
+
* @param {Function} onmessage
|
|
574
|
+
*/
|
|
575
|
+
constructor(onopen, onclose, onerror, onmessage) {
|
|
576
|
+
const ret = wasm.epoxyhandlers_new(addHeapObject(onopen), addHeapObject(onclose), addHeapObject(onerror), addHeapObject(onmessage));
|
|
577
|
+
this.__wbg_ptr = ret >>> 0;
|
|
578
|
+
return this;
|
|
579
|
+
}
|
|
580
|
+
};
|
|
222
581
|
var EpoxyIoStreamFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
223
582
|
}, unregister: () => {
|
|
224
583
|
} } : new FinalizationRegistry((ptr) => wasm.__wbg_epoxyiostream_free(ptr >>> 0));
|
|
@@ -956,7 +1315,7 @@ async function __wbg_init(maybe_memory) {
|
|
|
956
1315
|
var epoxy_bundled_default = __wbg_init;
|
|
957
1316
|
|
|
958
1317
|
// src/main.ts
|
|
959
|
-
var
|
|
1318
|
+
var EpoxyTransport = class {
|
|
960
1319
|
canstart = true;
|
|
961
1320
|
epxclient = null;
|
|
962
1321
|
wisp;
|
|
@@ -969,12 +1328,12 @@ var EpoxyClient = class {
|
|
|
969
1328
|
this.udp_extension_required = udp_extension_required || false;
|
|
970
1329
|
}
|
|
971
1330
|
async init() {
|
|
972
|
-
|
|
1331
|
+
await epoxy_bundled_default();
|
|
973
1332
|
let options = new EpoxyClientOptions();
|
|
974
1333
|
options.user_agent = navigator.userAgent;
|
|
975
1334
|
options.udp_extension_required = this.udp_extension_required;
|
|
976
1335
|
options.wisp_v2 = this.wisp_v2;
|
|
977
|
-
this.epxclient = new
|
|
1336
|
+
this.epxclient = new EpoxyClient(this.wisp, options);
|
|
978
1337
|
this.EpoxyHandlers = EpoxyHandlers;
|
|
979
1338
|
this.ready = true;
|
|
980
1339
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -175,6 +175,22 @@ function passArrayJsValueToWasm0(array, malloc) {
|
|
|
175
175
|
WASM_VECTOR_LEN = array.length;
|
|
176
176
|
return ptr;
|
|
177
177
|
}
|
|
178
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
179
|
+
ptr = ptr >>> 0;
|
|
180
|
+
const mem = getUint32Memory0();
|
|
181
|
+
const slice = mem.subarray(ptr / 4, ptr / 4 + len);
|
|
182
|
+
const result = [];
|
|
183
|
+
for (let i = 0; i < slice.length; i++) {
|
|
184
|
+
result.push(takeObject(slice[i]));
|
|
185
|
+
}
|
|
186
|
+
return result;
|
|
187
|
+
}
|
|
188
|
+
function _assertClass(instance, klass) {
|
|
189
|
+
if (!(instance instanceof klass)) {
|
|
190
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
191
|
+
}
|
|
192
|
+
return instance.ptr;
|
|
193
|
+
}
|
|
178
194
|
function __wbg_adapter_162(arg0, arg1, arg2, arg3) {
|
|
179
195
|
wasm.wasm_bindgen__convert__closures__invoke2_mut__h3b11eef3b4066485(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
180
196
|
}
|
|
@@ -185,12 +201,355 @@ function getArrayU8FromWasm0(ptr, len) {
|
|
|
185
201
|
var EpoxyClientFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
186
202
|
}, unregister: () => {
|
|
187
203
|
} } : new FinalizationRegistry((ptr) => wasm.__wbg_epoxyclient_free(ptr >>> 0));
|
|
204
|
+
var EpoxyClient = class {
|
|
205
|
+
toJSON() {
|
|
206
|
+
return {
|
|
207
|
+
redirect_limit: this.redirect_limit,
|
|
208
|
+
user_agent: this.user_agent
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
toString() {
|
|
212
|
+
return JSON.stringify(this);
|
|
213
|
+
}
|
|
214
|
+
__destroy_into_raw() {
|
|
215
|
+
const ptr = this.__wbg_ptr;
|
|
216
|
+
this.__wbg_ptr = 0;
|
|
217
|
+
EpoxyClientFinalization.unregister(this);
|
|
218
|
+
return ptr;
|
|
219
|
+
}
|
|
220
|
+
free() {
|
|
221
|
+
const ptr = this.__destroy_into_raw();
|
|
222
|
+
wasm.__wbg_epoxyclient_free(ptr);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* @returns {number}
|
|
226
|
+
*/
|
|
227
|
+
get redirect_limit() {
|
|
228
|
+
const ret = wasm.__wbg_get_epoxyclient_redirect_limit(this.__wbg_ptr);
|
|
229
|
+
return ret >>> 0;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* @param {number} arg0
|
|
233
|
+
*/
|
|
234
|
+
set redirect_limit(arg0) {
|
|
235
|
+
wasm.__wbg_set_epoxyclient_redirect_limit(this.__wbg_ptr, arg0);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* @returns {string}
|
|
239
|
+
*/
|
|
240
|
+
get user_agent() {
|
|
241
|
+
let deferred1_0;
|
|
242
|
+
let deferred1_1;
|
|
243
|
+
try {
|
|
244
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
245
|
+
wasm.__wbg_get_epoxyclient_user_agent(retptr, this.__wbg_ptr);
|
|
246
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
247
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
248
|
+
deferred1_0 = r0;
|
|
249
|
+
deferred1_1 = r1;
|
|
250
|
+
return getStringFromWasm0(r0, r1);
|
|
251
|
+
} finally {
|
|
252
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
253
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* @param {string} arg0
|
|
258
|
+
*/
|
|
259
|
+
set user_agent(arg0) {
|
|
260
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
261
|
+
const len0 = WASM_VECTOR_LEN;
|
|
262
|
+
wasm.__wbg_set_epoxyclient_user_agent(this.__wbg_ptr, ptr0, len0);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* @param {string} wisp_url
|
|
266
|
+
* @param {EpoxyClientOptions} options
|
|
267
|
+
*/
|
|
268
|
+
constructor(wisp_url, options) {
|
|
269
|
+
try {
|
|
270
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
271
|
+
const ptr0 = passStringToWasm0(wisp_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
272
|
+
const len0 = WASM_VECTOR_LEN;
|
|
273
|
+
_assertClass(options, EpoxyClientOptions);
|
|
274
|
+
var ptr1 = options.__destroy_into_raw();
|
|
275
|
+
wasm.epoxyclient_new(retptr, ptr0, len0, ptr1);
|
|
276
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
277
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
278
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
279
|
+
if (r2) {
|
|
280
|
+
throw takeObject(r1);
|
|
281
|
+
}
|
|
282
|
+
this.__wbg_ptr = r0 >>> 0;
|
|
283
|
+
return this;
|
|
284
|
+
} finally {
|
|
285
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* @returns {Promise<void>}
|
|
290
|
+
*/
|
|
291
|
+
replace_stream_provider() {
|
|
292
|
+
const ret = wasm.epoxyclient_replace_stream_provider(this.__wbg_ptr);
|
|
293
|
+
return takeObject(ret);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* @param {EpoxyHandlers} handlers
|
|
297
|
+
* @param {string} url
|
|
298
|
+
* @param {(string)[]} protocols
|
|
299
|
+
* @param {any} headers
|
|
300
|
+
* @returns {Promise<EpoxyWebSocket>}
|
|
301
|
+
*/
|
|
302
|
+
connect_websocket(handlers, url, protocols, headers) {
|
|
303
|
+
_assertClass(handlers, EpoxyHandlers);
|
|
304
|
+
var ptr0 = handlers.__destroy_into_raw();
|
|
305
|
+
const ptr1 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
306
|
+
const len1 = WASM_VECTOR_LEN;
|
|
307
|
+
const ptr2 = passArrayJsValueToWasm0(protocols, wasm.__wbindgen_malloc);
|
|
308
|
+
const len2 = WASM_VECTOR_LEN;
|
|
309
|
+
const ret = wasm.epoxyclient_connect_websocket(this.__wbg_ptr, ptr0, ptr1, len1, ptr2, len2, addHeapObject(headers));
|
|
310
|
+
return takeObject(ret);
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* @param {EpoxyHandlers} handlers
|
|
314
|
+
* @param {string} url
|
|
315
|
+
* @returns {Promise<EpoxyIoStream>}
|
|
316
|
+
*/
|
|
317
|
+
connect_tcp(handlers, url) {
|
|
318
|
+
_assertClass(handlers, EpoxyHandlers);
|
|
319
|
+
var ptr0 = handlers.__destroy_into_raw();
|
|
320
|
+
const ptr1 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
321
|
+
const len1 = WASM_VECTOR_LEN;
|
|
322
|
+
const ret = wasm.epoxyclient_connect_tcp(this.__wbg_ptr, ptr0, ptr1, len1);
|
|
323
|
+
return takeObject(ret);
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* @param {EpoxyHandlers} handlers
|
|
327
|
+
* @param {string} url
|
|
328
|
+
* @returns {Promise<EpoxyIoStream>}
|
|
329
|
+
*/
|
|
330
|
+
connect_tls(handlers, url) {
|
|
331
|
+
_assertClass(handlers, EpoxyHandlers);
|
|
332
|
+
var ptr0 = handlers.__destroy_into_raw();
|
|
333
|
+
const ptr1 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
334
|
+
const len1 = WASM_VECTOR_LEN;
|
|
335
|
+
const ret = wasm.epoxyclient_connect_tls(this.__wbg_ptr, ptr0, ptr1, len1);
|
|
336
|
+
return takeObject(ret);
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* @param {EpoxyHandlers} handlers
|
|
340
|
+
* @param {string} url
|
|
341
|
+
* @returns {Promise<EpoxyUdpStream>}
|
|
342
|
+
*/
|
|
343
|
+
connect_udp(handlers, url) {
|
|
344
|
+
_assertClass(handlers, EpoxyHandlers);
|
|
345
|
+
var ptr0 = handlers.__destroy_into_raw();
|
|
346
|
+
const ptr1 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
347
|
+
const len1 = WASM_VECTOR_LEN;
|
|
348
|
+
const ret = wasm.epoxyclient_connect_udp(this.__wbg_ptr, ptr0, ptr1, len1);
|
|
349
|
+
return takeObject(ret);
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* @param {string} url
|
|
353
|
+
* @param {object} options
|
|
354
|
+
* @returns {Promise<Response>}
|
|
355
|
+
*/
|
|
356
|
+
fetch(url, options) {
|
|
357
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
358
|
+
const len0 = WASM_VECTOR_LEN;
|
|
359
|
+
const ret = wasm.epoxyclient_fetch(this.__wbg_ptr, ptr0, len0, addHeapObject(options));
|
|
360
|
+
return takeObject(ret);
|
|
361
|
+
}
|
|
362
|
+
};
|
|
188
363
|
var EpoxyClientOptionsFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
189
364
|
}, unregister: () => {
|
|
190
365
|
} } : new FinalizationRegistry((ptr) => wasm.__wbg_epoxyclientoptions_free(ptr >>> 0));
|
|
366
|
+
var EpoxyClientOptions = class {
|
|
367
|
+
__destroy_into_raw() {
|
|
368
|
+
const ptr = this.__wbg_ptr;
|
|
369
|
+
this.__wbg_ptr = 0;
|
|
370
|
+
EpoxyClientOptionsFinalization.unregister(this);
|
|
371
|
+
return ptr;
|
|
372
|
+
}
|
|
373
|
+
free() {
|
|
374
|
+
const ptr = this.__destroy_into_raw();
|
|
375
|
+
wasm.__wbg_epoxyclientoptions_free(ptr);
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* @returns {boolean}
|
|
379
|
+
*/
|
|
380
|
+
get wisp_v2() {
|
|
381
|
+
const ret = wasm.__wbg_get_epoxyclientoptions_wisp_v2(this.__wbg_ptr);
|
|
382
|
+
return ret !== 0;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* @param {boolean} arg0
|
|
386
|
+
*/
|
|
387
|
+
set wisp_v2(arg0) {
|
|
388
|
+
wasm.__wbg_set_epoxyclientoptions_wisp_v2(this.__wbg_ptr, arg0);
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* @returns {boolean}
|
|
392
|
+
*/
|
|
393
|
+
get udp_extension_required() {
|
|
394
|
+
const ret = wasm.__wbg_get_epoxyclientoptions_udp_extension_required(this.__wbg_ptr);
|
|
395
|
+
return ret !== 0;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* @param {boolean} arg0
|
|
399
|
+
*/
|
|
400
|
+
set udp_extension_required(arg0) {
|
|
401
|
+
wasm.__wbg_set_epoxyclientoptions_udp_extension_required(this.__wbg_ptr, arg0);
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* @returns {(string)[]}
|
|
405
|
+
*/
|
|
406
|
+
get websocket_protocols() {
|
|
407
|
+
try {
|
|
408
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
409
|
+
wasm.__wbg_get_epoxyclientoptions_websocket_protocols(retptr, this.__wbg_ptr);
|
|
410
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
411
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
412
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
413
|
+
wasm.__wbindgen_free(r0, r1 * 4, 4);
|
|
414
|
+
return v1;
|
|
415
|
+
} finally {
|
|
416
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* @param {(string)[]} arg0
|
|
421
|
+
*/
|
|
422
|
+
set websocket_protocols(arg0) {
|
|
423
|
+
const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
424
|
+
const len0 = WASM_VECTOR_LEN;
|
|
425
|
+
wasm.__wbg_set_epoxyclientoptions_websocket_protocols(this.__wbg_ptr, ptr0, len0);
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* @returns {number}
|
|
429
|
+
*/
|
|
430
|
+
get redirect_limit() {
|
|
431
|
+
const ret = wasm.__wbg_get_epoxyclientoptions_redirect_limit(this.__wbg_ptr);
|
|
432
|
+
return ret >>> 0;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* @param {number} arg0
|
|
436
|
+
*/
|
|
437
|
+
set redirect_limit(arg0) {
|
|
438
|
+
wasm.__wbg_set_epoxyclientoptions_redirect_limit(this.__wbg_ptr, arg0);
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* @returns {string}
|
|
442
|
+
*/
|
|
443
|
+
get user_agent() {
|
|
444
|
+
let deferred1_0;
|
|
445
|
+
let deferred1_1;
|
|
446
|
+
try {
|
|
447
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
448
|
+
wasm.__wbg_get_epoxyclientoptions_user_agent(retptr, this.__wbg_ptr);
|
|
449
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
450
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
451
|
+
deferred1_0 = r0;
|
|
452
|
+
deferred1_1 = r1;
|
|
453
|
+
return getStringFromWasm0(r0, r1);
|
|
454
|
+
} finally {
|
|
455
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
456
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* @param {string} arg0
|
|
461
|
+
*/
|
|
462
|
+
set user_agent(arg0) {
|
|
463
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
464
|
+
const len0 = WASM_VECTOR_LEN;
|
|
465
|
+
wasm.__wbg_set_epoxyclientoptions_user_agent(this.__wbg_ptr, ptr0, len0);
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
*/
|
|
469
|
+
constructor() {
|
|
470
|
+
const ret = wasm.epoxyclientoptions_new_default();
|
|
471
|
+
this.__wbg_ptr = ret >>> 0;
|
|
472
|
+
return this;
|
|
473
|
+
}
|
|
474
|
+
};
|
|
191
475
|
var EpoxyHandlersFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
192
476
|
}, unregister: () => {
|
|
193
477
|
} } : new FinalizationRegistry((ptr) => wasm.__wbg_epoxyhandlers_free(ptr >>> 0));
|
|
478
|
+
var EpoxyHandlers = class {
|
|
479
|
+
__destroy_into_raw() {
|
|
480
|
+
const ptr = this.__wbg_ptr;
|
|
481
|
+
this.__wbg_ptr = 0;
|
|
482
|
+
EpoxyHandlersFinalization.unregister(this);
|
|
483
|
+
return ptr;
|
|
484
|
+
}
|
|
485
|
+
free() {
|
|
486
|
+
const ptr = this.__destroy_into_raw();
|
|
487
|
+
wasm.__wbg_epoxyhandlers_free(ptr);
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* @returns {Function}
|
|
491
|
+
*/
|
|
492
|
+
get onopen() {
|
|
493
|
+
const ret = wasm.__wbg_get_epoxyhandlers_onopen(this.__wbg_ptr);
|
|
494
|
+
return takeObject(ret);
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* @param {Function} arg0
|
|
498
|
+
*/
|
|
499
|
+
set onopen(arg0) {
|
|
500
|
+
wasm.__wbg_set_epoxyhandlers_onopen(this.__wbg_ptr, addHeapObject(arg0));
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* @returns {Function}
|
|
504
|
+
*/
|
|
505
|
+
get onclose() {
|
|
506
|
+
const ret = wasm.__wbg_get_epoxyhandlers_onclose(this.__wbg_ptr);
|
|
507
|
+
return takeObject(ret);
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* @param {Function} arg0
|
|
511
|
+
*/
|
|
512
|
+
set onclose(arg0) {
|
|
513
|
+
wasm.__wbg_set_epoxyhandlers_onclose(this.__wbg_ptr, addHeapObject(arg0));
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* @returns {Function}
|
|
517
|
+
*/
|
|
518
|
+
get onerror() {
|
|
519
|
+
const ret = wasm.__wbg_get_epoxyhandlers_onerror(this.__wbg_ptr);
|
|
520
|
+
return takeObject(ret);
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* @param {Function} arg0
|
|
524
|
+
*/
|
|
525
|
+
set onerror(arg0) {
|
|
526
|
+
wasm.__wbg_set_epoxyhandlers_onerror(this.__wbg_ptr, addHeapObject(arg0));
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* @returns {Function}
|
|
530
|
+
*/
|
|
531
|
+
get onmessage() {
|
|
532
|
+
const ret = wasm.__wbg_get_epoxyhandlers_onmessage(this.__wbg_ptr);
|
|
533
|
+
return takeObject(ret);
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* @param {Function} arg0
|
|
537
|
+
*/
|
|
538
|
+
set onmessage(arg0) {
|
|
539
|
+
wasm.__wbg_set_epoxyhandlers_onmessage(this.__wbg_ptr, addHeapObject(arg0));
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* @param {Function} onopen
|
|
543
|
+
* @param {Function} onclose
|
|
544
|
+
* @param {Function} onerror
|
|
545
|
+
* @param {Function} onmessage
|
|
546
|
+
*/
|
|
547
|
+
constructor(onopen, onclose, onerror, onmessage) {
|
|
548
|
+
const ret = wasm.epoxyhandlers_new(addHeapObject(onopen), addHeapObject(onclose), addHeapObject(onerror), addHeapObject(onmessage));
|
|
549
|
+
this.__wbg_ptr = ret >>> 0;
|
|
550
|
+
return this;
|
|
551
|
+
}
|
|
552
|
+
};
|
|
194
553
|
var EpoxyIoStreamFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
195
554
|
}, unregister: () => {
|
|
196
555
|
} } : new FinalizationRegistry((ptr) => wasm.__wbg_epoxyiostream_free(ptr >>> 0));
|
|
@@ -928,7 +1287,7 @@ async function __wbg_init(maybe_memory) {
|
|
|
928
1287
|
var epoxy_bundled_default = __wbg_init;
|
|
929
1288
|
|
|
930
1289
|
// src/main.ts
|
|
931
|
-
var
|
|
1290
|
+
var EpoxyTransport = class {
|
|
932
1291
|
canstart = true;
|
|
933
1292
|
epxclient = null;
|
|
934
1293
|
wisp;
|
|
@@ -941,12 +1300,12 @@ var EpoxyClient = class {
|
|
|
941
1300
|
this.udp_extension_required = udp_extension_required || false;
|
|
942
1301
|
}
|
|
943
1302
|
async init() {
|
|
944
|
-
|
|
1303
|
+
await epoxy_bundled_default();
|
|
945
1304
|
let options = new EpoxyClientOptions();
|
|
946
1305
|
options.user_agent = navigator.userAgent;
|
|
947
1306
|
options.udp_extension_required = this.udp_extension_required;
|
|
948
1307
|
options.wisp_v2 = this.wisp_v2;
|
|
949
|
-
this.epxclient = new
|
|
1308
|
+
this.epxclient = new EpoxyClient(this.wisp, options);
|
|
950
1309
|
this.EpoxyHandlers = EpoxyHandlers;
|
|
951
1310
|
this.ready = true;
|
|
952
1311
|
}
|
|
@@ -993,5 +1352,5 @@ var EpoxyClient = class {
|
|
|
993
1352
|
}
|
|
994
1353
|
};
|
|
995
1354
|
export {
|
|
996
|
-
|
|
1355
|
+
EpoxyTransport as default
|
|
997
1356
|
};
|
package/package.json
CHANGED
package/src/main.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BareHeaders, TransferrableResponse, BareTransport } from "@mercuryworkshop/bare-mux";
|
|
2
|
-
import
|
|
3
|
-
export default class
|
|
2
|
+
import initEpoxy, { EpoxyClient, EpoxyClientOptions, EpoxyHandlers } from "@mercuryworkshop/epoxy-tls";
|
|
3
|
+
export default class EpoxyTransport implements BareTransport {
|
|
4
4
|
canstart = true;
|
|
5
5
|
epxclient: Awaited<ReturnType<any>>["EpoxyClient"]["prototype"] = null!;
|
|
6
6
|
wisp: string;
|
|
@@ -14,7 +14,7 @@ export default class EpoxyClient implements BareTransport {
|
|
|
14
14
|
this.udp_extension_required = udp_extension_required || false;
|
|
15
15
|
}
|
|
16
16
|
async init() {
|
|
17
|
-
|
|
17
|
+
await initEpoxy();
|
|
18
18
|
|
|
19
19
|
let options = new EpoxyClientOptions();
|
|
20
20
|
options.user_agent = navigator.userAgent;
|
|
@@ -61,7 +61,7 @@ export default class EpoxyClient implements BareTransport {
|
|
|
61
61
|
onmessage: (data: Blob | ArrayBuffer | string) => void,
|
|
62
62
|
onclose: (code: number, reason: string) => void,
|
|
63
63
|
onerror: (error: string) => void,
|
|
64
|
-
): [
|
|
64
|
+
): [(data: Blob | ArrayBuffer | string) => void, (code: number, reason: string) => void] {
|
|
65
65
|
let handlers = new this.EpoxyHandlers(
|
|
66
66
|
onopen,
|
|
67
67
|
onclose,
|
|
@@ -75,7 +75,7 @@ export default class EpoxyClient implements BareTransport {
|
|
|
75
75
|
{ "Origin": origin }
|
|
76
76
|
);
|
|
77
77
|
|
|
78
|
-
return [
|
|
78
|
+
return [
|
|
79
79
|
async (data) => {
|
|
80
80
|
(await epsocket).send(data);
|
|
81
81
|
},
|