Gateway server for tor-js — providing fast bootstrap data,
WebSocket-to-socket relay, and WebRTC peer discovery so browsers can
connect to the Tor network directly.
»
Fast Bootstrap
Pre-synced consensus, authority certs, and microdescriptors served as a compressed archive. Clients bootstrap in seconds, not minutes.
⇆
WebSocket Relay
Bridges browser WebSocket connections to raw TCP sockets on the Tor network, enabling circuit construction from JavaScript.
✵
Peer Discovery — planned
WebRTC signaling so tor-js clients can relay traffic for each other, enabling access even when gateways are blocked.
Bootstrap from this gateway
Download and parse the Tor consensus directly in the browser:
Open a WebSocket that bridges to a raw TCP socket on a consensus relay:
// Connect to a relay's ORPort via the gatewayconst ws = newWebSocket('wss://this-server/socket/198.51.100.1:9001');
ws.binaryType = 'arraybuffer';
ws.onopen = () => {
// Send raw bytes — the gateway relays them to the TCP socket
ws.send(new Uint8Array([0x00, 0x07, ...]));
};
ws.onmessage = (ev) => {
const data = new Uint8Array(ev.data);
// Received raw bytes from the relay
};
Only addresses advertised in the current Tor consensus are allowed. The gateway rejects connections to non-relay or private IPs.
cargo install --path .
tor-js-gateway init # create config at ~/.config/tor-js-gateway/config.json5
tor-js-gateway # run in foreground
tor-js-gateway install # or install as a systemd service
Manage the service with standard systemd commands: