mirror of
https://github.com/MercuryWorkshop/epoxy-tls.git
synced 2025-05-12 22:10:01 -04:00
bypatrol wisp detector bypass 9000 working 2024
This commit is contained in:
parent
7535ef8f48
commit
7c9605474d
2 changed files with 47 additions and 50 deletions
|
@ -78,10 +78,7 @@ pub enum EpoxyError {
|
|||
#[error("Webpki: {0:?} ({0})")]
|
||||
Webpki(#[from] webpki::Error),
|
||||
|
||||
#[error("Wisp WebSocket failed to connect")]
|
||||
WebSocketConnectFailed,
|
||||
|
||||
#[error("Custom wisp transport: {0}")]
|
||||
#[error("Wisp transport: {0}")]
|
||||
WispTransport(String),
|
||||
#[error("Invalid Wisp transport")]
|
||||
InvalidWispTransport,
|
||||
|
|
|
@ -373,52 +373,52 @@ pub fn is_null_body(code: u16) -> bool {
|
|||
|
||||
#[wasm_bindgen(inline_js = r#"
|
||||
class WebSocketStreamPonyfill {
|
||||
url;
|
||||
opened;
|
||||
closed;
|
||||
close;
|
||||
constructor(url, options = {}) {
|
||||
if (options.signal?.aborted) {
|
||||
throw new DOMException('This operation was aborted', 'AbortError');
|
||||
}
|
||||
this.url = url;
|
||||
const ws = new WebSocket(url, options.protocols ?? []);
|
||||
url;
|
||||
opened;
|
||||
closed;
|
||||
close;
|
||||
constructor(url, options = {}) {
|
||||
if (options.signal?.aborted) {
|
||||
throw new DOMException('This operation was aborted', 'AbortError');
|
||||
}
|
||||
this.url = url;
|
||||
const ws = new WebSocket(url, options.protocols ?? []);
|
||||
ws.binaryType = "arraybuffer";
|
||||
const closeWithInfo = ({ closeCode: code, reason } = {}) => ws.close(code, reason);
|
||||
this.opened = new Promise((resolve, reject) => {
|
||||
ws.onopen = () => {
|
||||
resolve({
|
||||
readable: new ReadableStream({
|
||||
start(controller) {
|
||||
ws.onmessage = ({ data }) => controller.enqueue(data);
|
||||
ws.onerror = e => controller.error(e);
|
||||
},
|
||||
cancel: closeWithInfo,
|
||||
}),
|
||||
writable: new WritableStream({
|
||||
write(chunk) { ws.send(chunk); },
|
||||
abort() { ws.close(); },
|
||||
close: closeWithInfo,
|
||||
}),
|
||||
protocol: ws.protocol,
|
||||
extensions: ws.extensions,
|
||||
});
|
||||
ws.removeEventListener('error', reject);
|
||||
};
|
||||
ws.addEventListener('error', reject);
|
||||
});
|
||||
this.closed = new Promise((resolve, reject) => {
|
||||
ws.onclose = ({ code, reason }) => {
|
||||
resolve({ closeCode: code, reason });
|
||||
ws.removeEventListener('error', reject);
|
||||
};
|
||||
ws.addEventListener('error', reject);
|
||||
});
|
||||
if (options.signal) {
|
||||
options.signal.onabort = () => ws.close();
|
||||
}
|
||||
this.close = closeWithInfo;
|
||||
}
|
||||
const closeWithInfo = ({ closeCode: code, reason } = {}) => ws.close(code, reason);
|
||||
this.opened = new Promise((resolve, reject) => {
|
||||
ws.onopen = () => {
|
||||
resolve({
|
||||
readable: new ReadableStream({
|
||||
start(controller) {
|
||||
ws.onmessage = ({ data }) => controller.enqueue(data);
|
||||
ws.onerror = e => controller.error(e);
|
||||
},
|
||||
cancel: closeWithInfo,
|
||||
}),
|
||||
writable: new WritableStream({
|
||||
write(chunk) { ws.send(chunk); },
|
||||
abort() { ws.close(); },
|
||||
close: closeWithInfo,
|
||||
}),
|
||||
protocol: ws.protocol,
|
||||
extensions: ws.extensions,
|
||||
});
|
||||
ws.removeEventListener('error', reject);
|
||||
};
|
||||
ws.addEventListener('error', reject);
|
||||
});
|
||||
this.closed = new Promise((resolve, reject) => {
|
||||
ws.onclose = ({ code, reason }) => {
|
||||
resolve({ closeCode: code, reason });
|
||||
ws.removeEventListener('error', reject);
|
||||
};
|
||||
ws.addEventListener('error', reject);
|
||||
});
|
||||
if (options.signal) {
|
||||
options.signal.onabort = () => ws.close();
|
||||
}
|
||||
this.close = closeWithInfo;
|
||||
}
|
||||
}
|
||||
|
||||
export function object_get(obj, k) {
|
||||
|
@ -459,7 +459,7 @@ export function from_entries(entries){
|
|||
}
|
||||
|
||||
async function websocket_connect(url, protocols) {
|
||||
let wss = new WebSocketStreamPonyfill(url, { protocols: protocols });
|
||||
let wss = new (WebSocketStream ? WebSocketStream : WebSocketStreamPonyfill)(url, { protocols: protocols });
|
||||
let {readable, writable} = await wss.opened;
|
||||
return {read: readable, write: writable};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue