rport 0.2.19

A p2p port forwarding client using WebRTC datachannels
# RPort - WebRTC-based remote port forwarding tool written in Rust

RPort is a modern, WebRTC-based remote port forwarding tool written in Rust. It enables secure peer-to-peer connections for port forwarding, remote access, and network tunneling without requiring complex NAT traversal configurations.

It is built on top of [rustrtc](https://github.com/restsend/rustrtc), a pure Rust WebRTC implementation.

## Features

- πŸš€ **WebRTC-based P2P connections** - Direct peer-to-peer tunneling
- πŸ”’ **Secure tunneling** - End-to-end encrypted connections
- πŸ“ **Configuration file support** - TOML-based configuration with CLI override
- 🌐 **IPv6 filtering** - Automatic IPv6 candidate filtering for better compatibility
- πŸ”§ **Multiple operation modes** - Agent, client, and proxy modes
- πŸ”„ **Background daemon support** - Run as a system daemon with custom log files
- πŸ“Š **Structured logging** - Comprehensive logging with tracing support
- ⚑ **High performance** - Built with Tokio async runtime
- πŸ›œ **Built-in TURN server** - No need for third-party TURN servers

## Architecture

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    WebRTC P2P    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Client    │◄────────────────►│    Agent    β”‚
β”‚             β”‚                  β”‚             β”‚
β”‚ rport -p    β”‚                  β”‚ rport -t    β”‚
β”‚ 8080:22     β”‚                  β”‚ 22 --id     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚                                β”‚
       β”‚                                β”‚
       β–Ό                                β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚Local Serviceβ”‚                β”‚Remote Serverβ”‚
β”‚ :8080       β”‚                β”‚ :22 (SSH)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

## Quick Start

### 1. Install
```bash
cargo install rport rport-server
```

### 2. Run Server (Coordinator)
```bash
rport-server --addr 0.0.0.0:3000
```

### 3. Run Agent (Remote machine)
```bash
# Forward remote port 22 to the server with ID "my-server"
rport --target 22 --id my-server --token secret-token --server http://your-server:3000
```

### 4. Connect Client (Local machine)
```bash
# Map local port 8080 to remote "my-server"
rport --port 8080 --id my-server --token secret-token --server http://your-server:3000

# Now you can SSH through the tunnel
ssh user@localhost -p 8080
```

## SSH Integration

Easily connect without direct port mapping using `ProxyCommand`:

```bash
# Direct command
ssh -o ProxyCommand='rport --id my-server --token secret-token --server http://your-server:3000' user@localhost

# via ~/.ssh/config
Host my-remote
    ProxyCommand rport --id my-server --token secret-token --server http://your-server:3000
    User ubuntu
```

## Configuration

RPort loads configuration from `~/.rport.toml`:

```toml
token = "secret-token"
server = "http://your-server:3000"

# Optional: Add ICE servers
[[ice_servers]]
urls = ["stun:stun.l.google.com:19302"]
```

## Advanced Usage

- **Daemon Mode**: Append `--daemon --log-file rport.log` to the command.
- **Troubleshooting**: Use `RUST_LOG=rport=debug` for verbose logs.
- **NAT**: Built-in TURN server handles most NAT scenarios automatically.

## Security Considerations

- Use strong tokens and restrict configuration file permissions (`chmod 600`).
- Agent listing functionality is disabled to prevent information disclosure.


## Build on linux
```bash
cargo build -r --target x86_64-unknown-linux-musl -p rport
cargo build -r --target x86_64-pc-windows-gnu -p rport
cargo build -r --target aarch64-apple-darwin -p rport
```