Files
mfahampshire 43a1bd38e8 Max/smolmix wasm (#6784)
* Mod gitignore + license trimming + comment trimming

* Big rewrite

* SURB inputs + DNS button in internal-dev

* Make ipr addr optional

* Accidentatly omitted files from rewrite commit

* Makefile + readme

* Comment rewrite

* Optimisation comment

* Replace manual waker map with
      smoltcp built-ins + adaptive poll

* Comments

* Extract socket creation helpers into stream.rs

* Cleanup comments

* Comment

* Comment notes and restrict ciphersuites wrt rustls-rustcrypto

* Dep. hack fix for demo + add clearnet fetch() for contrast

* Stripped down devtester

* Fix Clippy arg (fatfingered deletion)

* CodeRabbit catches

* Cargofmt

* Review nits: bridge logs, fetch early-return, static port counter, copyright years, README + Cargo + headless.js tidying

* PHONY + taskset override, switch internal-dev/tests to pnpm, fix wasm-pack out-dir

* Gate codec tests behind the codec feature for no-default-features builds

* IPv6 addr/route on smoltcp iface + configurable DNS resolvers via TunnelOpts

* DNS GUI inputs, close stale WS on reconnect, worker init guards + ws-send warning, Playwright listener cleanup, pnpm-lock in internal-dev

* Fix lp -> lp-data after rebase

* Revert nym-lp/nym-lp-data feature-gating left over from rebase

* Lift getrandom wasm_js cfg to workspace .cargo/config.toml so cargo check -p smolmix-wasm works from any CWD

* temp will amend git message

* Auto-discover IPR when none specified + 'Use random IPR' checkbox in internal-dev

* smolmix_tracker + State machine + ready_tunnel gate + getTunnelState JS surface

* Mirror red display() entries to console.error

* Add left out package-lock

* Reactor clock + yield_now + atomic seq + gateway-storage errors

* setupMixTunnel gate + MTU 1980 + http::Uri cleanup

* Review pass + fix test + clippy

* restore axum 0.8 bump from borked earlier merge

* Feature gating (dns/fetch/socket) + TunnelOptsBuilder + pnpm bypass

* Cont. with review comments

* tokio Nofity reactor wakes + cancellation + setup polishing

* Notify wakes + inner pattern + close_notify + util

* Tunable tunnelopts

* Fix tired commit

* CI prep

* Lint + Clippy

* coderabbit u32 fix

* nits + runtime debugging + expose in internal-dev

* remove redudant default-features

* Remove more redundant default-features
2026-05-28 15:57:10 +00:00

240 lines
10 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>smolmix-wasm dev</title>
<style>
body {
font-family: system-ui, sans-serif;
max-width: 1000px;
margin: 16px auto;
padding: 0 12px;
}
fieldset { margin-bottom: 12px; }
legend { font-weight: bold; }
.row {
display: flex;
gap: 6px;
align-items: center;
flex-wrap: wrap;
}
.status { font-size: 0.85em; color: gray; }
.local-log {
background: #f5f5f5;
border: 1px solid #ddd;
padding: 6px;
margin: 8px 0 0;
max-height: 140px;
overflow-y: auto;
font-size: 0.82em;
white-space: pre-wrap;
font-family: ui-monospace, monospace;
}
</style>
<script src="bundle.js" defer></script>
</head>
<body>
<h1>smolmix-wasm dev</h1>
<!-- Connection -->
<fieldset id="startup-controls">
<legend>Connection</legend>
<div>
<label>IPR address: </label>
<input type="text" size="80" id="ipr-address" disabled
value="6B6iuWX4bQP4GVA4Yq7XmZencaaGw6BaPY6xJWYSwsbF.6g6LRx1fgU2Q2A4ZPKonYHtfBARh1GPMe1LtXk6vpRR8@q2A2cbooyC16YJzvdYaSMH9X3cSiieZNtfBr8cE8Fi1"
placeholder="<nym-address of IPR exit node>" />
<label style="margin-left: 8px">
<input type="checkbox" id="opt-random-ipr" checked /> Use random IPR
</label>
</div>
<details style="margin-top: 8px" open>
<summary style="cursor: pointer; font-size: 0.9em; color: #555">Advanced Options</summary>
<div style="margin-top: 6px; padding: 8px; background: #f9f9f9; font-size: 0.9em">
<div>
<label><input type="checkbox" id="opt-force-tls" checked /> Force TLS</label>
</div>
<div style="margin-top: 4px">
<label>Client ID: <input type="text" id="opt-client-id" size="20" /></label>
<span style="font-size: 0.85em; color: #888">(randomised on load for clean state)</span>
</div>
<div style="margin-top: 4px">
<label><input type="checkbox" id="opt-disable-poisson" /> Disable Poisson traffic</label>
</div>
<div style="margin-top: 4px">
<label><input type="checkbox" id="opt-disable-cover" /> Disable cover traffic</label>
</div>
<div style="margin-top: 4px">
<label>Open reply SURBs:
<input type="number" id="opt-open-surbs" value="10" min="1" max="50" style="width: 60px" />
</label>
<label style="margin-left: 8px">Data reply SURBs:
<input type="number" id="opt-data-surbs" value="0" min="0" max="50" style="width: 60px" />
</label>
<div style="font-size: 0.85em; color: #888; margin-top: 2px">
Optional. Larger pools raise inbound throughput; each outgoing Sphinx packet then carries more reply blocks.
</div>
</div>
<div style="margin-top: 4px">
<label>Primary DNS:
<input type="text" id="opt-primary-dns" placeholder="8.8.8.8:53" size="18" />
</label>
<label style="margin-left: 8px">Fallback DNS:
<input type="text" id="opt-fallback-dns" placeholder="1.1.1.1:53" size="18" />
</label>
<div style="font-size: 0.85em; color: #888; margin-top: 2px">
Optional. `host:port`. Leave blank to use the defaults shown.
</div>
</div>
</div>
</details>
<div style="margin-top: 8px">
<button id="btn-setup">setupMixTunnel</button>
<button id="btn-disconnect" disabled>disconnectMixTunnel</button>
<label style="margin-left: 16px">
<input type="checkbox" id="opt-debug-logging" checked /> Debug logging
</label>
<span id="tunnel-status" style="margin-left: 10px; color: gray">Not started</span>
</div>
</fieldset>
<!-- DNS Resolve: tunnel (smoltcp UDP to 8.8.8.8) vs clearnet (DoH JSON) -->
<fieldset id="dns-controls">
<legend>DNS Resolve</legend>
<div class="row">
<input type="text" size="40" id="dns-host" value="example.com" />
<button id="btn-dns-tunnel" disabled>via tunnel</button>
<button id="btn-dns-clearnet">via DoH (clearnet)</button>
</div>
<pre class="local-log" id="dns-log"></pre>
</fieldset>
<!-- GET: clearnet vs tunnel, same URL -->
<fieldset id="get-controls">
<legend>GET</legend>
<div class="row">
<input type="text" size="60" id="get-url" value="https://httpbin.org/get" />
<button id="btn-get-tunnel" disabled>via tunnel</button>
<button id="btn-get-clearnet">via window.fetch (clearnet)</button>
</div>
<pre class="local-log" id="get-log"></pre>
</fieldset>
<!-- WebSocket -->
<fieldset id="ws-controls" disabled>
<legend>WebSocket</legend>
<div class="row">
<input type="text" size="60" id="ws-url" value="wss://echo.websocket.org" />
<button id="btn-ws-connect">Connect</button>
<button id="btn-ws-close" disabled>Close</button>
<span id="ws-status" class="status">Not connected</span>
</div>
<div class="row" style="margin-top: 4px">
<input type="text" size="50" id="ws-message" value="Hello from smolmix-wasm!" />
<button id="btn-ws-send" disabled>Send</button>
</div>
<div class="row" style="margin-top: 4px">
<label>Echo burst:</label>
<input type="number" id="ws-burst-count" value="10" min="1" max="500" style="width: 60px" />
<label>Size:</label>
<input type="number" id="ws-burst-min" value="64" min="1" max="1048576" style="width: 80px" />
<span>&ndash;</span>
<input type="number" id="ws-burst-max" value="1024" min="1" max="1048576" style="width: 80px" />
<span class="status">bytes</span>
<button id="btn-ws-burst" disabled>Send Burst</button>
</div>
<pre class="local-log" id="ws-log"></pre>
</fieldset>
<!-- Stress Test -->
<fieldset id="stress-controls" disabled>
<legend>Stress Test</legend>
<div class="row">
<label>Requests:</label>
<input type="number" id="stress-count" value="10" min="1" max="200" style="width: 60px" />
<label>Mode:</label>
<select id="stress-mode">
<option value="uniform">Uniform</option>
<option value="mixed" selected>Mixed sizes</option>
<option value="drip">Slow drip</option>
</select>
</div>
<div id="stress-uniform-opts" style="display: none; margin-top: 8px; padding: 8px; background: #f9f9f9">
<label>Base URL:</label>
<input type="text" size="50" id="stress-url" value="https://jsonplaceholder.typicode.com/posts/" />
</div>
<div id="stress-mixed-opts" style="margin-top: 8px; padding: 8px; background: #f9f9f9">
<table style="font-size: 0.9em; border-collapse: collapse">
<tr><td style="padding: 1px 10px 1px 0"><b>tiny</b></td><td>128 B</td></tr>
<tr><td style="padding: 1px 10px 1px 0"><b>small</b></td><td>1 KB</td></tr>
<tr><td style="padding: 1px 10px 1px 0"><b>medium</b></td><td>10 KB</td></tr>
<tr><td style="padding: 1px 10px 1px 0"><b>large</b></td><td>100 KB</td></tr>
<tr><td style="padding: 1px 10px 1px 0"><b>xlarge</b></td><td>1 MB</td></tr>
</table>
</div>
<div id="stress-drip-opts" style="display: none; margin-top: 8px; padding: 8px; background: #f9f9f9">
<table style="font-size: 0.9em; border-collapse: collapse">
<tr><td style="padding: 1px 10px 1px 0"><b>safe</b></td><td>~50% of timeout</td></tr>
<tr><td style="padding: 1px 10px 1px 0"><b>boundary</b></td><td>~92% of timeout</td></tr>
<tr><td style="padding: 1px 10px 1px 0"><b>over</b></td><td>~108% of timeout</td></tr>
<tr><td style="padding: 1px 10px 1px 0"><b>slow-start</b></td><td>~17% delay + ~83% drip</td></tr>
</table>
<div style="margin-top: 6px">
<label>Request timeout (s):</label>
<input type="number" id="stress-timeout" value="60" min="5" max="300" style="width: 60px" />
</div>
</div>
<div class="row" style="margin-top: 8px">
<button id="btn-stress">Run Stress Test</button>
<span id="stress-status" class="status"></span>
</div>
<pre class="local-log" id="stress-log"></pre>
</fieldset>
<!-- File Download -->
<fieldset id="download-controls" disabled>
<legend>File Download</legend>
<div style="display: flex; gap: 12px; flex-wrap: wrap">
<div style="flex: 1; min-width: 220px; padding: 8px; background: #f9f9f9; border: 1px solid #ddd">
<b>UTF-8 Demo</b>
<div class="status">Unicode text (Cambridge CS)</div>
<button id="btn-verify-text">Fetch</button>
<span id="verify-text-status" class="status"></span>
<pre id="verify-text-output" style="margin-top: 6px; max-height: 200px; overflow-y: auto; font-size: 0.8em; white-space: pre-wrap; display: none; background: #fff; padding: 6px; border: 1px solid #eee"></pre>
</div>
<div style="flex: 1; min-width: 220px; padding: 8px; background: #f9f9f9; border: 1px solid #ddd">
<b>File Download</b>
<div style="margin: 4px 0 6px">
<input type="text" size="50" id="download-url"
value="https://nymtech.net/uploads/Nym_WFP_Paper_5_58a1105679.pdf" />
</div>
<button id="btn-verify-pdf">Fetch</button>
<button id="btn-save-pdf" disabled>Save</button>
<span id="verify-pdf-status" class="status"></span>
<div id="verify-pdf-output" style="margin-top: 6px; font-size: 0.8em; display: none">
<div>Size: <code id="verify-pdf-size"></code></div>
<div>SHA-256: <code id="verify-pdf-sha"></code></div>
</div>
</div>
</div>
<div class="row" style="margin-top: 8px">
<button id="btn-verify-all">Run Both</button>
<span id="verify-all-status" class="status"></span>
</div>
<pre class="local-log" id="download-log"></pre>
</fieldset>
<!-- Master timeline -->
<fieldset>
<legend>Output (master timeline)</legend>
<pre id="output" style="background: #f5f5f5; padding: 8px; max-height: 300px; overflow-y: auto; font-size: 0.85em; white-space: pre-wrap"></pre>
</fieldset>
</body>
</html>