2026-06-28 21:58:18 +08:00
2026-06-28 21:58:18 +08:00
2026-06-28 21:30:35 +08:00
2026-06-26 23:19:32 +08:00
2026-06-26 23:19:32 +08:00
2026-06-27 16:08:36 +08:00
2026-06-26 23:19:32 +08:00
2026-06-26 23:19:32 +08:00

relay_server

An OTP application with an esockd-based UDP server.

Build

$ rebar3 compile

Run

$ rebar3 shell

The UDP listener is configured in config/sys.config and listens on port 16380 by default. It accepts RelayKit UDP relay frames.

Protocol

Each UDP datagram is encrypted with ChaCha20-Poly1305. The encrypted datagram uses the same combined format as CryptoKit ChaChaPoly:

nonce(12), ciphertext, tag(16)

The decrypted plaintext is one RKP1 frame:

magic(4) = "RKP1", version(1) = 1, type(1), reserved(2),
stream_id(8), payload_len(4), payload(payload_len)

Frame types are open = 1, data = 2, close = 3, and error = 4. open payload is binary encoded as:

host_len(2), host(host_len), port(2),
username_len(2), username(username_len),
password_len(2), password(password_len)

Integer fields are unsigned big-endian values. host, username, and password are binary strings. The server is a transparent TCP relay, so TLS negotiation, HTTP methods, and request bytes are carried inside subsequent data frames without being interpreted by the server.

username and password are checked against the relay_server application users config:

{users, [
  {admin, "password"}
]}
Description
No description provided
Readme 49 KiB
Languages
Erlang 100%