@mercuryworkshop/epoxy-transport
Advanced tools
Comparing version 2.1.19 to 2.1.20
{ | ||
"name": "@mercuryworkshop/epoxy-transport", | ||
"version": "2.1.19", | ||
"version": "2.1.20", | ||
"description": "a bare transport that implements end-to-end encryption with epoxy-tls and wisp", | ||
@@ -15,3 +15,3 @@ "main": "./dist/index.mjs", | ||
"dependencies": { | ||
"@mercuryworkshop/epoxy-tls": "2.1.10-1" | ||
"@mercuryworkshop/epoxy-tls": "2.1.11-1" | ||
}, | ||
@@ -18,0 +18,0 @@ "devDependencies": { |
import type { BareHeaders, TransferrableResponse, BareTransport } from "@mercuryworkshop/bare-mux"; | ||
import initEpoxy, { EpoxyClient, EpoxyClientOptions, EpoxyHandlers, info } from "@mercuryworkshop/epoxy-tls"; | ||
import initEpoxy, { EpoxyClient, EpoxyClientOptions, EpoxyHandlers, info as epoxyInfo } from "@mercuryworkshop/epoxy-tls"; | ||
export { info as epoxyInfo }; | ||
export { epoxyInfo }; | ||
export type EpoxyOptions = { | ||
wisp_v2?: boolean, | ||
udp_extension_required?: boolean, | ||
title_case_headers?: boolean, | ||
ws_title_case_headers?: boolean, | ||
wisp_ws_protocols?: string[], | ||
redirect_limit?: number, | ||
header_limit?: number, | ||
buffer_size?: number, | ||
} | ||
const opts = [ | ||
"wisp_v2", | ||
"udp_extension_required", | ||
"title_case_headers", | ||
"ws_title_case_headers", | ||
"wisp_ws_protocols", | ||
"redirect_limit", | ||
"header_limit", | ||
"buffer_size" | ||
]; | ||
export default class EpoxyTransport implements BareTransport { | ||
@@ -10,15 +34,19 @@ canstart = true; | ||
client_version: typeof epoxyInfo; | ||
client: EpoxyClient = null!; | ||
wisp: string; | ||
wisp_v2: boolean; | ||
udp_extension_required: boolean; | ||
title_case_headers: boolean; | ||
opts: EpoxyOptions; | ||
constructor({ wisp, wisp_v2, udp_extension_required, title_case_headers }) { | ||
this.wisp = wisp; | ||
this.wisp_v2 = wisp_v2 || false; | ||
this.udp_extension_required = udp_extension_required || false; | ||
this.title_case_headers = title_case_headers || true; | ||
constructor(opts: EpoxyOptions & { wisp: string }) { | ||
this.wisp = opts.wisp; | ||
this.opts = opts; | ||
this.client_version = epoxyInfo; | ||
} | ||
setopt(opts: EpoxyClientOptions, opt: string) { | ||
// == allows both null and undefined | ||
if (this.opts[opt] != null) opts[opt] = this.opts[opt]; | ||
} | ||
async init() { | ||
@@ -29,5 +57,3 @@ await initEpoxy(); | ||
options.user_agent = navigator.userAgent; | ||
options.udp_extension_required = this.udp_extension_required; | ||
options.wisp_v2 = this.wisp_v2; | ||
options.title_case_headers = this.title_case_headers; | ||
opts.forEach(x => this.setopt(options, x)) | ||
this.client = new EpoxyClient(this.wisp, options); | ||
@@ -37,2 +63,3 @@ | ||
} | ||
async meta() { } | ||
@@ -80,2 +107,3 @@ | ||
); | ||
let ws = this.client.connect_websocket( | ||
@@ -82,0 +110,0 @@ handlers, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
3263166
15565
+ Added@mercuryworkshop/epoxy-tls@2.1.11-1(transitive)
- Removed@mercuryworkshop/epoxy-tls@2.1.10-1(transitive)