add epoxy info function

This commit is contained in:
Toshit Chawda 2024-08-08 13:01:39 -07:00
parent 569789c2a0
commit 72d43508d0
No known key found for this signature in database
GPG key ID: 91480ED99E2B3D9D
5 changed files with 19 additions and 4 deletions

2
Cargo.lock generated
View file

@ -513,7 +513,7 @@ dependencies = [
[[package]]
name = "epoxy-client"
version = "2.1.0"
version = "2.1.1"
dependencies = [
"async-compression",
"async-trait",

View file

@ -1,6 +1,6 @@
[package]
name = "epoxy-client"
version = "2.1.0"
version = "2.1.1"
edition = "2021"
[lib]

View file

@ -1,4 +1,4 @@
import initEpoxy, { EpoxyClient, EpoxyClientOptions, EpoxyHandlers } from "./pkg/epoxy-bundled.js";
import initEpoxy, { EpoxyClient, EpoxyClientOptions, EpoxyHandlers, info as epoxyInfo } from "./pkg/epoxy-bundled.js";
(async () => {
const params = (new URL(location.href)).searchParams;
@ -40,6 +40,7 @@ import initEpoxy, { EpoxyClient, EpoxyClientOptions, EpoxyHandlers } from "./pkg
console.log(epoxy_client);
// you can change the user agent and redirect limit in JS
epoxy_client.redirect_limit = 15;
console.log(epoxyInfo());
const test_mux = async (url) => {
const t0 = performance.now();

View file

@ -1,6 +1,6 @@
{
"name": "@mercuryworkshop/epoxy-tls",
"version": "2.1.0-1",
"version": "2.1.1-1",
"description": "A wasm library for using raw encrypted tls/ssl/tcp/udp/https/websocket streams on the browser",
"scripts": {
"build": "./build.sh"

View file

@ -43,6 +43,20 @@ mod utils;
mod websocket;
mod ws_wrapper;
#[wasm_bindgen]
pub fn info() -> Object {
let obj = Object::new();
object_set(&obj, "version", env!("CARGO_PKG_VERSION").into());
cfg_if! {
if #[cfg(feature = "full")] {
object_set(&obj, "minimal", false.into());
} else {
object_set(&obj, "minimal", true.into());
}
};
obj
}
type HttpBody = http_body_util::Full<Bytes>;
#[derive(Debug, Error)]