@mercuryworkshop/epoxy-transport 2.1.6 → 2.1.8
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 +404 -45
- package/dist/index.mjs +398 -39
- package/package.json +2 -2
- package/src/main.ts +5 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mercuryworkshop/epoxy-transport",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.8",
|
|
4
4
|
"description": "a bare transport that implements end-to-end encryption with epoxy-tls and wisp",
|
|
5
5
|
"main": "./dist/index.mjs",
|
|
6
6
|
"keywords": [],
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"prepare": "npm run build"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@mercuryworkshop/epoxy-tls": "2.1.
|
|
15
|
+
"@mercuryworkshop/epoxy-tls": "2.1.2-1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@mercuryworkshop/bare-mux": "^2.0.4",
|
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
|
},
|