zhboner / realm

A network relay tool
MIT License
1.61k stars 291 forks source link

ws issue #70

Closed ByteInternetHK closed 2 years ago

ByteInternetHK commented 2 years ago

client config

[log]
level = "debug"
output = "/var/log/realm.log"

[dns]
mode = "ipv4_and_ipv6"
protocol = "tcp_and_udp"
nameservers = ["8.8.8.8:53", "1.1.1.1:53"]
min_ttl = 600
max_ttl = 3600
cache_size = 256

[network]
no_tcp = false
use_udp = true
tcp_timeout = 5
udp_timeout = 30
send_proxy = true
send_proxy_version = 2
accept_proxy = false
accept_proxy_timeout = 5

[[endpoints]]
listen = "0.0.0.0:2002"
remote = "relay.com:2002"
remote_transport = "ws;host=example.com;path=/ws"

server config

[log]
level = "debug"
output = "/var/log/realm.log"

[dns]
mode = "ipv4_and_ipv6"
protocol = "tcp_and_udp"
nameservers = ["8.8.8.8:53", "1.1.1.1:53"]
min_ttl = 600
max_ttl = 3600
cache_size = 256

[network]
no_tcp = false
use_udp = true
tcp_timeout = 5
udp_timeout = 30
send_proxy = false
send_proxy_version = 2
accept_proxy = false
accept_proxy_timeout = 5

[[endpoints]]
listen = "0.0.0.0:2002"
remote = "target.com:2002"
listen_transport = "ws;host=example.com;path=/ws"

相同配置下去掉 remote_transport = "ws;host=example.com;path=/ws" listen_transport = "ws;host=example.com;path=/ws" 配置项 可以转发成功

zephyrchien commented 2 years ago

你配置的客户端会发送proxy-protocol,但是服务端没有配置接收proxy-protocol.

文档里面写明了:

make sure the remote peer also speaks proxy-protocol