[GH-ISSUE #3568] XTCP 似乎无法使用 Proxy Protocol #2845

Closed
opened 2026-05-05 13:50:35 -06:00 by gitea-mirror · 11 comments
Owner

Originally created by @BingYanchi on GitHub (Aug 11, 2023).
Original GitHub issue: https://github.com/fatedier/frp/issues/3568

Bug Description

我尝试了开启 Proxy Protocol 的服务和不开启的服务。

发现似乎 XTCP 不支持 Proxy Protocol。

从文档中看到的基于 TCP 协议的隧道都能使用 Proxy Protocol。我不太明白问题出在哪里。

frpc Version

0.51.2

frps Version

0.51.2

System Architecture

linux/amd64

Configurations

Frps

[common]
bind_addr = 0.0.0.0
bind_port = 3101

kcp_bind_port = 3100

XTCP server

[common]
server_addr = ***
server_port = 3100

protocol = kcp

[xtcp-server]
role = server
type = xtcp
sk = ***

local_ip = 127.0.0.1
local_port = 10001

proxy_protocol_version = v1

XTCP visitor

[common]
server_addr = ***
server_port = 3100

protocol = kcp

[xtcp-visitor]
role = visitor
type = xtcp
server_name = xtcp-server
sk = ***

bind_addr = 127.0.0.1
bind_port = 10001

Logs

Frps

2023/08/11 17:32:10 [I] [root.go:204] frps uses config file: ./frps.ini
2023/08/11 17:32:10 [I] [service.go:206] frps tcp listen on 0.0.0.0:3101
2023/08/11 17:32:10 [I] [service.go:216] frps kcp listen on udp 0.0.0.0:3100
2023/08/11 17:32:10 [I] [root.go:213] frps started successfully
2023/08/11 17:32:15 [I] [service.go:539] [50ccfc9d769b3a6b] client login info: ip [114.222.116.7:31614] version [0.51.2] hostname [] os [linux] arch [amd64]
2023/08/11 17:32:15 [I] [control.go:497] [50ccfc9d769b3a6b] new proxy [xtcp-server] type [xtcp] success
2023/08/11 17:32:32 [W] [service.go:466] CheckAndEnableTLSServerConnWithTimeout error: timeout
2023/08/11 17:32:34 [I] [service.go:539] [72c162cb1561e5f6] client login info: ip [114.222.116.7:29051] version [0.51.2] hostname [] os [windows] arch [amd64]

XTCP server

2023/08/11 17:22:01 [I] [root.go:220] start frpc service for config file [./frpc.ini]
2023/08/11 17:22:01 [I] [service.go:301] [522cfd44ac1e9b21] login to server success, get run id [522cfd44ac1e9b21]
2023/08/11 17:22:01 [I] [proxy_manager.go:150] [522cfd44ac1e9b21] proxy added: [xtcp-server]
2023/08/11 17:22:01 [I] [control.go:172] [522cfd44ac1e9b21] [xtcp-server] start proxy success
2023/08/11 17:23:45 [I] [xtcp.go:70] [522cfd44ac1e9b21] [xtcp-server] nathole prepare success, nat type: EasyNAT, behavior: BehaviorNoChange, addresses: [114.222.116.7:28952 114.222.116.7:28952], assistedAddresses: [192.168.0.123:59777]
2023/08/11 17:23:45 [I] [xtcp.go:91] [522cfd44ac1e9b21] [xtcp-server] get natHoleRespMsg, sid [1691745825ba7f0ad05e675887], protocol [quic], candidate address [114.222.116.7:28951], assisted address [192.168.0.139:65330], detectBehavior: {Role:receiver Mode:0 TTL:7 SendDelayMs:0 ReadTimeoutMs:5000 CandidatePorts:[] SendRandomPorts:0 ListenRandomPorts:0}
2023/08/11 17:23:46 [I] [xtcp.go:107] [522cfd44ac1e9b21] [xtcp-server] establishing nat hole connection successful, sid [1691745825ba7f0ad05e675887], remoteAddr [192.168.0.139:65330]

XTCP visitor

2023/08/11 17:22:12 [I] [root.go:220] start frpc service for config file [./frpc.ini]
2023/08/11 17:22:20 [I] [service.go:301] [f45cfc1bb0c54878] login to server success, get run id [f45cfc1bb0c54878]
2023/08/11 17:22:20 [I] [visitor_manager.go:116] [f45cfc1bb0c54878] start visitor success
2023/08/11 17:22:20 [I] [visitor_manager.go:116] [f45cfc1bb0c54878] start visitor success
2023/08/11 17:22:20 [I] [visitor_manager.go:156] [f45cfc1bb0c54878] visitor added: [xtcp-visitor]
2023/08/11 17:23:42 [E] [xtcp.go:179] [f45cfc1bb0c54878] [xtcp-visitor] open tunnel error: context deadline exceeded
2023/08/11 17:23:42 [I] [xtcp.go:283] [f45cfc1bb0c54878] [xtcp-visitor] nathole prepare success, nat type: EasyNAT, behavior: BehaviorNoChange, addresses: [114.222.116.7:28951 114.222.116.7:28951], assistedAddresses: [192.168.0.139:65330]
2023/08/11 17:23:44 [I] [xtcp.go:309] [f45cfc1bb0c54878] [xtcp-visitor] get natHoleRespMsg, sid [1691745825ba7f0ad05e675887], protocol [quic], candidate address [114.222.116.7:28952], assisted address [192.168.0.123:59777], detectBehavior: {Role:sender Mode:0 TTL:0 SendDelayMs:0 ReadTimeoutMs:5000 CandidatePorts:[] SendRandomPorts:0 ListenRandomPorts:0}
2023/08/11 17:23:44 [I] [xtcp.go:320] [f45cfc1bb0c54878] [xtcp-visitor] establishing nat hole connection successful, sid [1691745825ba7f0ad05e675887], remoteAddr [192.168.0.123:59777]

Steps to reproduce

  1. 为使用 XTCP 的服务启用 Proxy Protocol
  2. 为 Frp 的配置文件添加 Proxy Protocol 选项
  3. Check

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @BingYanchi on GitHub (Aug 11, 2023). Original GitHub issue: https://github.com/fatedier/frp/issues/3568 ### Bug Description 我尝试了开启 Proxy Protocol 的服务和不开启的服务。 发现似乎 XTCP 不支持 Proxy Protocol。 从文档中看到的基于 TCP 协议的隧道都能使用 Proxy Protocol。我不太明白问题出在哪里。 ### frpc Version 0.51.2 ### frps Version 0.51.2 ### System Architecture linux/amd64 ### Configurations Frps ```ini [common] bind_addr = 0.0.0.0 bind_port = 3101 kcp_bind_port = 3100 ``` XTCP server ```ini [common] server_addr = *** server_port = 3100 protocol = kcp [xtcp-server] role = server type = xtcp sk = *** local_ip = 127.0.0.1 local_port = 10001 proxy_protocol_version = v1 ``` XTCP visitor ```ini [common] server_addr = *** server_port = 3100 protocol = kcp [xtcp-visitor] role = visitor type = xtcp server_name = xtcp-server sk = *** bind_addr = 127.0.0.1 bind_port = 10001 ``` ### Logs Frps ``` 2023/08/11 17:32:10 [I] [root.go:204] frps uses config file: ./frps.ini 2023/08/11 17:32:10 [I] [service.go:206] frps tcp listen on 0.0.0.0:3101 2023/08/11 17:32:10 [I] [service.go:216] frps kcp listen on udp 0.0.0.0:3100 2023/08/11 17:32:10 [I] [root.go:213] frps started successfully 2023/08/11 17:32:15 [I] [service.go:539] [50ccfc9d769b3a6b] client login info: ip [114.222.116.7:31614] version [0.51.2] hostname [] os [linux] arch [amd64] 2023/08/11 17:32:15 [I] [control.go:497] [50ccfc9d769b3a6b] new proxy [xtcp-server] type [xtcp] success 2023/08/11 17:32:32 [W] [service.go:466] CheckAndEnableTLSServerConnWithTimeout error: timeout 2023/08/11 17:32:34 [I] [service.go:539] [72c162cb1561e5f6] client login info: ip [114.222.116.7:29051] version [0.51.2] hostname [] os [windows] arch [amd64] ``` XTCP server ``` 2023/08/11 17:22:01 [I] [root.go:220] start frpc service for config file [./frpc.ini] 2023/08/11 17:22:01 [I] [service.go:301] [522cfd44ac1e9b21] login to server success, get run id [522cfd44ac1e9b21] 2023/08/11 17:22:01 [I] [proxy_manager.go:150] [522cfd44ac1e9b21] proxy added: [xtcp-server] 2023/08/11 17:22:01 [I] [control.go:172] [522cfd44ac1e9b21] [xtcp-server] start proxy success 2023/08/11 17:23:45 [I] [xtcp.go:70] [522cfd44ac1e9b21] [xtcp-server] nathole prepare success, nat type: EasyNAT, behavior: BehaviorNoChange, addresses: [114.222.116.7:28952 114.222.116.7:28952], assistedAddresses: [192.168.0.123:59777] 2023/08/11 17:23:45 [I] [xtcp.go:91] [522cfd44ac1e9b21] [xtcp-server] get natHoleRespMsg, sid [1691745825ba7f0ad05e675887], protocol [quic], candidate address [114.222.116.7:28951], assisted address [192.168.0.139:65330], detectBehavior: {Role:receiver Mode:0 TTL:7 SendDelayMs:0 ReadTimeoutMs:5000 CandidatePorts:[] SendRandomPorts:0 ListenRandomPorts:0} 2023/08/11 17:23:46 [I] [xtcp.go:107] [522cfd44ac1e9b21] [xtcp-server] establishing nat hole connection successful, sid [1691745825ba7f0ad05e675887], remoteAddr [192.168.0.139:65330] ``` XTCP visitor ``` 2023/08/11 17:22:12 [I] [root.go:220] start frpc service for config file [./frpc.ini] 2023/08/11 17:22:20 [I] [service.go:301] [f45cfc1bb0c54878] login to server success, get run id [f45cfc1bb0c54878] 2023/08/11 17:22:20 [I] [visitor_manager.go:116] [f45cfc1bb0c54878] start visitor success 2023/08/11 17:22:20 [I] [visitor_manager.go:116] [f45cfc1bb0c54878] start visitor success 2023/08/11 17:22:20 [I] [visitor_manager.go:156] [f45cfc1bb0c54878] visitor added: [xtcp-visitor] 2023/08/11 17:23:42 [E] [xtcp.go:179] [f45cfc1bb0c54878] [xtcp-visitor] open tunnel error: context deadline exceeded 2023/08/11 17:23:42 [I] [xtcp.go:283] [f45cfc1bb0c54878] [xtcp-visitor] nathole prepare success, nat type: EasyNAT, behavior: BehaviorNoChange, addresses: [114.222.116.7:28951 114.222.116.7:28951], assistedAddresses: [192.168.0.139:65330] 2023/08/11 17:23:44 [I] [xtcp.go:309] [f45cfc1bb0c54878] [xtcp-visitor] get natHoleRespMsg, sid [1691745825ba7f0ad05e675887], protocol [quic], candidate address [114.222.116.7:28952], assisted address [192.168.0.123:59777], detectBehavior: {Role:sender Mode:0 TTL:0 SendDelayMs:0 ReadTimeoutMs:5000 CandidatePorts:[] SendRandomPorts:0 ListenRandomPorts:0} 2023/08/11 17:23:44 [I] [xtcp.go:320] [f45cfc1bb0c54878] [xtcp-visitor] establishing nat hole connection successful, sid [1691745825ba7f0ad05e675887], remoteAddr [192.168.0.123:59777] ``` ### Steps to reproduce 1. 为使用 XTCP 的服务启用 Proxy Protocol 2. 为 Frp 的配置文件添加 Proxy Protocol 选项 3. Check ### Affected area - [ ] Docs - [X] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [X] Others
gitea-mirror 2026-05-05 13:50:35 -06:00
Author
Owner

@fatedier commented on GitHub (Aug 11, 2023):

xtcp 的机制不太一样,目前应该确实不支持。

<!-- gh-comment-id:1674463743 --> @fatedier commented on GitHub (Aug 11, 2023): xtcp 的机制不太一样,目前应该确实不支持。
Author
Owner

@Becods commented on GitHub (Aug 11, 2023):

xtcp前套个开了proxyprotocol的haproxy或nginx

<!-- gh-comment-id:1674476175 --> @Becods commented on GitHub (Aug 11, 2023): xtcp前套个开了proxyprotocol的haproxy或nginx
Author
Owner

@BingYanchi commented on GitHub (Aug 11, 2023):

xtcp前套个开了proxyprotocol的haproxy或nginx

套了 haproxy,但似乎不太行。

<!-- gh-comment-id:1674755904 --> @BingYanchi commented on GitHub (Aug 11, 2023): > xtcp前套个开了proxyprotocol的haproxy或nginx 套了 haproxy,但似乎不太行。
Author
Owner

@BingYanchi commented on GitHub (Aug 12, 2023):

希望未来有实现它的可能。

既然 XTCP 会先和 frps 通信,或许可以在 nat 通信前通过 frps 给 server 提供可靠的 ip 地址。从而提供 Proxy Protocol 支持。

<!-- gh-comment-id:1675766630 --> @BingYanchi commented on GitHub (Aug 12, 2023): 希望未来有实现它的可能。 既然 XTCP 会先和 frps 通信,或许可以在 nat 通信前通过 frps 给 server 提供可靠的 ip 地址。从而提供 Proxy Protocol 支持。
Author
Owner

@github-actions[bot] commented on GitHub (Sep 12, 2023):

Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.

<!-- gh-comment-id:1714794765 --> @github-actions[bot] commented on GitHub (Sep 12, 2023): Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.
Author
Owner

@github-actions[bot] commented on GitHub (Oct 13, 2023):

Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.

<!-- gh-comment-id:1760586748 --> @github-actions[bot] commented on GitHub (Oct 13, 2023): Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.
Author
Owner

@github-actions[bot] commented on GitHub (Nov 13, 2023):

Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.

<!-- gh-comment-id:1807305185 --> @github-actions[bot] commented on GitHub (Nov 13, 2023): Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.
Author
Owner

@github-actions[bot] commented on GitHub (Dec 15, 2023):

Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.

<!-- gh-comment-id:1857083666 --> @github-actions[bot] commented on GitHub (Dec 15, 2023): Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.
Author
Owner

@Vincent-Leon commented on GitHub (May 26, 2024):

一样的问题,期待解决方法

<!-- gh-comment-id:2131937036 --> @Vincent-Leon commented on GitHub (May 26, 2024): 一样的问题,期待解决方法
Author
Owner

@XuruiPro commented on GitHub (Dec 30, 2024):

现在应该可以了,我现在用的就是xtcp的代理socket模式,
image

<!-- gh-comment-id:2564970044 --> @XuruiPro commented on GitHub (Dec 30, 2024): 现在应该可以了,我现在用的就是xtcp的代理socket模式, ![image](https://github.com/user-attachments/assets/ea0822c1-87a6-4ecd-b3d1-ca3ffb0f9bd4)
Author
Owner

@XuruiPro commented on GitHub (Dec 31, 2024):

服务者添加

------------------ 原始邮件 ------------------
发件人: @.>;
发送时间: 2024年12月30日(星期一) 下午3:15
收件人: @.
>;
抄送: @.>; @.>;
主题: Re: [fatedier/frp] XTCP 似乎无法使用 Proxy Protocol (Issue #3568)

现在应该可以了,我现在用的就是xtcp的代理socket模式,
image.png (view on web)

是在服务者还是访问者添加的


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: @.***>

<!-- gh-comment-id:2566152689 --> @XuruiPro commented on GitHub (Dec 31, 2024): 服务者添加 ------------------&nbsp;原始邮件&nbsp;------------------ 发件人: ***@***.***&gt;; 发送时间: 2024年12月30日(星期一) 下午3:15 收件人: ***@***.***&gt;; 抄送: ***@***.***&gt;; ***@***.***&gt;; 主题: Re: [fatedier/frp] XTCP 似乎无法使用 Proxy Protocol (Issue #3568) 现在应该可以了,我现在用的就是xtcp的代理socket模式, image.png (view on web) 是在服务者还是访问者添加的 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: ***@***.***&gt;
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#2845
No description provided.