43 lines
1.1 KiB
Markdown
43 lines
1.1 KiB
Markdown
# relay_server
|
|
|
|
Rust QUIC implementation of the RelayKit TCP relay server.
|
|
|
|
Each QUIC connection replaces the old UDP peer. Each QUIC bidirectional stream
|
|
replaces the old `stream_id` and maps to one outbound TCP connection. QUIC
|
|
provides ordered stream delivery and connection encryption, so the old UDP frame
|
|
header encryption is intentionally not present.
|
|
|
|
## Run
|
|
|
|
```sh
|
|
cargo run -- config.toml
|
|
```
|
|
|
|
The server also reads the config path from `RELAY_SERVER_CONFIG`. If neither is
|
|
provided and `config.toml` does not exist, built-in defaults are used.
|
|
|
|
## Stream Protocol
|
|
|
|
The client opens a QUIC bidirectional stream and writes one open request using
|
|
the old binary payload format:
|
|
|
|
```text
|
|
host_len(2), host(host_len), port(2),
|
|
username_len(2), username(username_len),
|
|
password_len(2), password(password_len)
|
|
```
|
|
|
|
All integers are unsigned big-endian values. After authentication and a
|
|
successful TCP connect, the server writes:
|
|
|
|
```text
|
|
0
|
|
```
|
|
|
|
Then both sides relay raw TCP bytes over the QUIC stream. On failure, the server
|
|
writes:
|
|
|
|
```text
|
|
1, error_len(2), error(error_len)
|
|
```
|