-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
完整性要求
- 我读完了 issue 模板中的所有注释,确保填写符合要求。
- 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
- 我提供了完整的配置文件和日志,而不是出于自己的判断只给出截取的部分。
- 我搜索了 issues, 没有发现已提出的类似问题。
- 问题在 Release 最新的版本上可以成功复现
描述
正确的ProxyProtocolv1报文格式应该是:
PROXY <TCP4|TCP6> <客户端发包的源IP> <客户端发包的目的IP> <客户端发包的源端口> <客户端发包的目的端口>
而freedom发出的ProxyProtocolv1报文格式却是:
PROXY <TCP4|TCP6> <客户端发包的源IP> <freedom要访问的IP> <客户端发包的源端口> <freedom要访问的端口>
这导致:如果客户端和后端服务的IP类型不一致,ProxyProtocolv1报文就会混杂IPv4和IPv6地址,某些后端会报错(postfix就会报错)。
重现方式
测试场景
客户端 -> [tunnel(监听IPv4v6)] ->[freedom]--(发送ProxyProtocolv1)-->[后端服务(仅监听IPv4)]
如果客户端是IPv4,ProxyProtocolv1报头为:
PROXY TCP4 127.0.0.1 192.168.0.250 53312 60025
如果客户端是IPv6,ProxyProtocolv1报头为:
PROXY TCP6 ::1 192.168.0.250 53321 60025
客户端配置
{ "inbounds": [ { "tag": "frontend", "port": "25", "protocol": "dokodemo-door", "settings": { "address": "192.168.0.250", "port": 60025, "network": "tcp" } } ],
"outbounds": [ { "tag": "direct", "protocol": "freedom", "settings": { "proxyProtocol": 1 } } ], "log": { "loglevel": "debug" }
}
服务端配置
N/A
客户端日志
Xray 25.9.11 (Xray, Penetrates Everything.) 3edfb0e (go1.25.1 linux/amd64) A unified platform for anti-censorship. 2025/09/16 16:04:31.256580 [Info] infra/conf/serial: Reading config: &{Name:/tmp/123.json Format:json} 2025/09/16 16:04:31.257453 [Debug] app/log: Logger started 2025/09/16 16:04:31.257518 [Debug] app/proxyman/inbound: creating stream worker on 0.0.0.0:25 2025/09/16 16:04:31.257802 [Info] transport/internet/tcp: listening TCP on 0.0.0.0:25 2025/09/16 16:04:31.257807 [Warning] core: Xray 25.9.11 started
IPv4 Client Connected
2025/09/16 16:04:40.785263 [Debug] [1205060989] proxy/dokodemo: processing connection from: 127.0.0.1:53312
2025/09/16 16:04:40.785290 [Info] [1205060989] proxy/dokodemo: received request for 127.0.0.1:53312
2025/09/16 16:04:40.785299 [Info] [1205060989] app/dispatcher: default route for tcp:192.168.0.250:60025
2025/09/16 16:04:40.785304 [Info] [1205060989] transport/internet/tcp: dialing TCP to tcp:192.168.0.250:60025
2025/09/16 16:04:40.785310 from 127.0.0.1:53312 accepted tcp:192.168.0.250:60025 [frontend >> direct]
2025/09/16 16:04:40.785349 [Debug] [1205060989] transport/internet: dialing to tcp:192.168.0.250:60025
2025/09/16 16:04:40.802696 [Info] [1205060989] proxy/freedom: connection opened to tcp:192.168.0.250:60025, local endpoint 192.168.0.250:53313, remote endpoint 192.168.0.250:60025
2025/09/16 16:04:40.802718 [Info] [1205060989] proxy: CopyRawConn (maybe) readvIPv6 Client Connected
2025/09/16 16:04:52.125121 [Debug] [3828714682] proxy/dokodemo: processing connection from: [::1]:53321
2025/09/16 16:04:52.125132 from [::1]:53321 accepted tcp:192.168.0.250:60025 [frontend >> direct]
2025/09/16 16:04:52.125138 [Info] [3828714682] proxy/dokodemo: received request for [::1]:53321
2025/09/16 16:04:52.125146 [Info] [3828714682] app/dispatcher: default route for tcp:192.168.0.250:60025
2025/09/16 16:04:52.125151 [Info] [3828714682] transport/internet/tcp: dialing TCP to tcp:192.168.0.250:60025
2025/09/16 16:04:52.125154 [Debug] [3828714682] transport/internet: dialing to tcp:192.168.0.250:60025
2025/09/16 16:04:52.128594 [Info] [3828714682] proxy/freedom: connection opened to tcp:192.168.0.250:60025, local endpoint 192.168.0.250:53322, remote endpoint 192.168.0.250:60025
2025/09/16 16:04:52.128613 [Info] [3828714682] proxy: CopyRawConn (maybe) readv
^C2025/09/16 16:06:04.103745 [Debug] app/log: Logger closing
服务端日志
N/A