Reverse Tunnel Control Stream (tunnel/TunnelControlStream.java)

clawbench · android/app/src/main/java/com/clawbench/app/tunnel/TunnelControlStream.java · java · MIT
infra, tag:control-stream, tag:ndjson

Interface for a long-lived reverse tunnel control plane using NDJSON messages to bind, unbind, ping, and receive events; provides non‑blocking reads and safe close handling.

// Source: https://github.com/clawbench-dev/clawbench | License: MIT | Copyright 2025 xulongzhe
// Provided via justclaw.it.com; keep this notice with the code.
package com.clawbench.app.tunnel;

import java.io.Closeable;

/**
 * The long-lived {@code -R} control plane: write one NDJSON line, receive them
 * by line.
 *
 * <p>The request body carries {@code bind}/{@code unbind}/{@code ping}; the
 * response body carries {@code bound}/{@code bind_err}/{@code incoming}/
 * {@code unbound}/{@code pong}. Reads are delivered on the control stream's own
 * reader thread, so a handler must not block: a stalled handler would stall
 * every reverse port on that control stream.
 */
public interface TunnelControlStream extends Closeable {

    /**
     * Send one message. Returns false when the strea

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key