relay_server/README.md
2026-06-27 15:13:50 +08:00

720 B

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 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 RelayKit JSON: host, port, useTLS, and method. The server is a transparent TCP relay: useTLS is parsed for client compatibility, but the upstream connection is always raw TCP.