mirror of
https://github.com/zhboner/realm.git
synced 2026-11-17 16:17:22 +00:00
e202c2d9b4ea05894ea3d4cda8f052fe4801f17c
Introduction
realm is a simple, high performance relay server written in rust.
Features
- Zero configuration. Setup and run in one command.
- Concurrency. Bidirectional concurrent traffic leads to high performance.
- Low resources cost.
Custom Build
available Options:
- udp (enabled)
- trust-dns (enabled)
- zero-copy (enabled on linux)
- tfo (disabled)
# simple tcp
cargo build --release --no-default-features
# enable other options
cargo build --release --no-default-features --features udp, tfo, zero-copy, trust-dns
Usage
Realm 1.x
A high efficiency proxy tool
USAGE:
realm [FLAGS] [OPTIONS] [SUBCOMMAND]
FLAGS:
-d, --daemon daemonize
-f, --tfo enable tfo
-u, --udp enable udp
-z, --zero-copy enable tcp zero-copy
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-c, --config <path> use config file
-l, --listen <addr> listen address
-r, --remote <addr> remote address
-x, --through <addr> send through specific ip or address
--tcp-timeout <second> set timeout value
--udp-timeout <second> set timeout value
start from command line arguments:
# enable udp
realm -l 127.0.0.1:5000 -r 1.1.1.1:443 --udp
# specify outbound ip
realm -l 127.0.0.1:5000 -r 1.1.1.1:443 --through 127.0.0.1
or use a config file:
realm -c config.json
Configuration
Example
{
"dns_mode": {
"mode": "ipv4_only",
"protocol": "tcp+udp",
"nameservers": ["8.8.8.8:53", "8.8.4.4:53"]
},
"endpoints": [
{
"local": "0.0.0.0:5000",
"remote": "1.1.1.1:443"
},
{
"local": "0.0.0.0:10000",
"remote": "www.google.com:443",
"udp": true,
"fast_open": true,
"zero_copy": true
},
{
"local": "0.0.0.0:15000",
"remote": "www.microsoft.com:443",
"through": "127.0.0.1"
}
]
}
dns
this is compatibe with old versions(before v1.5.0-rc3), you could still set lookup priority with "dns_mode": "ipv4_only", which is equal to "dns_mode": {"mode": "ipv4_only"}
mode
- ipv4_only
- ipv6_only
- ipv4_then_ipv6 (default)
- ipv6_then_ipv4
- ipv4_and_ipv6
protocol
- tcp
- udp
- tcp+udp (default)
nameservers
format: ["server1", "server2" ...]
default:
On unix/windows, it will read from the default location.(e.g. /etc/resolv.conf). Otherwise use google's public dns as default upstream resolver(8.8.8.8, 8.8.4.4 and 2001:4860:4860::8888, 2001:4860:4860::8844).
endpoint objects
- local (listen address)
- remote (remote address)
- through (send through specified ip or address, this is optional)
- udp (true|false, default=false)
- zero_copy (true|false, default=false)
- fast_open (true|false, default=false)
- tcp_timeout (tcp timeout(sec), default=300)
- udp_timeout (udp timeout(sec), default=30)
Languages
Rust
99.1%
C
0.3%
Dockerfile
0.3%
C++
0.2%
Makefile
0.1%
