A small CLI for temporarily sharing local TCP and UDP services over encrypted peer-to-peer tunnels.
lend is for when you want to share something running on your machine with another machine or network without setting up port-forwarding, standing up a reverse proxy, or signing up for a managed tunnel service.
Good fits include:
- game servers
- local dev servers
- demos
- admin panels
- other private TCP or UDP services you want to be reachable from another machine or network
- No port-forwarding required.
- No account, server setup, dashboard, or public URL. Just two CLI commands.
- End-to-end encrypted transport over QUIC.
- Copy-paste token workflow.
- Built for short-lived sharing, not permanent exposure.
Install lend:
cargo install lendOn the machine that already has access to the service:
lend share tcp 127.0.0.1:3000This prints a token like:
lend_...
On the other machine:
lend use tcp 127.0.0.1:8000 lend_...Traffic sent to 127.0.0.1:8000 on the second machine is then forwarded to 127.0.0.1:3000 on the first.
lend share <PROTOCOL> <SERVICE>
lend use <PROTOCOL> <BIND> <TOKEN>
sharecreates anirohendpoint and prints a connection token.useconnects to the sharing peer using that token.irohhandles direct peer-to-peer connectivity with hole punching when possible and relay fallback when needed.useauthenticates once per peer connection using a random secret embedded in the token.- In
tcpmode, each inbound TCP connection onuseopens a QUIC bidirectional stream overiroh. - In
udpmode,lendforwards best-effort QUIC datagrams and keeps UDP routing isolated per peer connection on the sharing side.
- Tokens are shell-safe ASCII strings prefixed with
lend_. - Tokens encode peer address information, protocol information, and a random secret in a compact binary format.
- Tokens are temporary. If the sharing side stops or restarts, old tokens will be treated as invalid.
- Possession of the token is enough to connect, so treat it as sensitive.
- Traffic is end-to-end encrypted over QUIC via
iroh. - Access is controlled by possession of the token, which includes a random secret verified once per peer connection in constant-time.
lenddoes not add user identity, policy enforcement, or fine-grained authorization on top of that bearer-token model.
Runtime output uses tracing and respects RUST_LOG.
- The token is printed by itself on
stdout, which makes it easy to pipe, capture, or script. - Human-facing logs go to
stderr.
Examples:
RUST_LOG=info lend share tcp 127.0.0.1:3000
RUST_LOG=debug lend use tcp 127.0.0.1:8000 lend_...- Designed for temporary sharing, not long-lived managed tunnels.
- UDP forwarding is best-effort; oversized datagrams may be dropped.
- If the sharing peer exits or restarts, existing and future forwarded connections fail until a new token is generated. This is by design.
- Access is controlled entirely by possession of the token.
- Not intended to be a hardened public exposure layer.
Run the full test suite with:
cargo testCurrent coverage includes:
- half-close and EOF propagation
- end-to-end UDP datagram forwarding through the real
lendbinary - token round-tripping
- tampered token rejection
- end-to-end HTTP forwarding through the real
lendbinary - peer shutdown causing
useto exit on the next attempted use
The integration tests start local TCP and UDP services, run lend share and lend use as child processes, capture the emitted token, and verify that traffic crosses the full tunnel correctly.
- Additional integration coverage for failure modes and protocol-specific behavior
- UDP fragmentation and reassembly for oversized datagrams if real-world use shows a need
This project is available under either the MIT License or Apache 2.0, at your option.