[GH-ISSUE #4610] xtcp 开启 transport.useCompression = true 就连不上 #3642

Closed
opened 2026-05-05 14:20:17 -06:00 by gitea-mirror · 2 comments
Owner

Originally created by @verygoodlee on GitHub (Dec 27, 2024).
Original GitHub issue: https://github.com/fatedier/frp/issues/4610

Bug Description

P2P打洞成功,但是连不上,
经排查,关闭transport.useCompression后就可以了

frpc Version

0.60.0

frps Version

0.60.0

System Architecture

frps: linux/amd64 frpc: windows/amd64

Configurations

frps.toml

bindAddr = "0.0.0.0"
bindPort = 7000
auth.method = "token"
auth.token = "xxxxxx"

frpc.toml
为方便测试,proxy和visitor都放在一台机器上,确保能打洞成功,实际使用时两者肯定是在不同机器上的

serverAddr = "x.x.x.x"
serverPort = 7000
auth.method = "token"
auth.token = "xxxxxx"

transport.heartbeatInterval = 30
transport.heartbeatTimeout = 90

log.level = "trace"

[[proxies]]
name = "emby_p2p"
type = "xtcp"
localIP = "127.0.0.1"
localPort = 8096
secretKey = "xxxxxx"
transport.useEncryption = false
transport.useCompression = true

[[visitors]]
name = "emby_p2p_visitor"
type = "xtcp"
serverName = "emby_p2p"
secretKey = "xxxxxx"
bindAddr = "0.0.0.0"
bindPort = 28096

Logs

frpc.log
2024-12-27 17:38:09.725 [I] [sub/root.go:142] start frpc service for config file [frpc.toml]
2024-12-27 17:38:09.738 [I] [client/service.go:295] try to connect to server...
2024-12-27 17:38:09.784 [I] [client/service.go:287] [3a63e11ac1831a68] login to server success, get run id [3a63e11ac1831a68]
2024-12-27 17:38:09.784 [I] [proxy/proxy_manager.go:173] [3a63e11ac1831a68] proxy added: [emby_p2p]
2024-12-27 17:38:09.784 [D] [client/control.go:240] [3a63e11ac1831a68] send heartbeat to server
2024-12-27 17:38:09.784 [T] [proxy/proxy_wrapper.go:200] [3a63e11ac1831a68] [emby_p2p] change status from [new] to [wait start]
2024-12-27 17:38:09.785 [I] [visitor/visitor_manager.go:121] [3a63e11ac1831a68] start visitor success
2024-12-27 17:38:09.785 [I] [visitor/visitor_manager.go:172] [3a63e11ac1831a68] visitor added: [qbit_p2p_visitor]
2024-12-27 17:38:09.800 [D] [client/control.go:193] [3a63e11ac1831a68] receive heartbeat from server
2024-12-27 17:38:09.801 [I] [client/control.go:168] [3a63e11ac1831a68] [emby_p2p] start proxy success
2024-12-27 17:38:39.796 [D] [client/control.go:240] [3a63e11ac1831a68] send heartbeat to server
2024-12-27 17:38:39.810 [D] [client/control.go:193] [3a63e11ac1831a68] receive heartbeat from server
^C
C:\Program Files\frp>frpc.exe -c frpc.toml
2024-12-27 17:39:24.043 [I] [sub/root.go:142] start frpc service for config file [frpc.toml]
2024-12-27 17:39:24.055 [I] [client/service.go:295] try to connect to server...
2024-12-27 17:39:24.120 [I] [client/service.go:287] [cbc2938e289cbe13] login to server success, get run id [cbc2938e289cbe13]
2024-12-27 17:39:24.121 [I] [proxy/proxy_manager.go:173] [cbc2938e289cbe13] proxy added: [emby_p2p]
2024-12-27 17:39:24.121 [D] [client/control.go:240] [cbc2938e289cbe13] send heartbeat to server
2024-12-27 17:39:24.121 [T] [proxy/proxy_wrapper.go:200] [cbc2938e289cbe13] [emby_p2p] change status from [new] to [wait start]
2024-12-27 17:39:24.121 [I] [visitor/visitor_manager.go:121] [cbc2938e289cbe13] start visitor success
2024-12-27 17:39:24.121 [I] [visitor/visitor_manager.go:172] [cbc2938e289cbe13] visitor added: [emby_p2p_visitor]
2024-12-27 17:39:24.141 [D] [client/control.go:193] [cbc2938e289cbe13] receive heartbeat from server
2024-12-27 17:39:24.141 [I] [client/control.go:168] [cbc2938e289cbe13] [emby_p2p] start proxy success
2024-12-27 17:39:35.967 [D] [visitor/xtcp.go:167] [cbc2938e289cbe13] [emby_p2p_visitor] get a new xtcp user connection
2024-12-27 17:39:35.967 [T] [visitor/xtcp.go:271] [cbc2938e289cbe13] [emby_p2p_visitor] makeNatHole start
2024-12-27 17:39:35.992 [T] [visitor/xtcp.go:277] [cbc2938e289cbe13] [emby_p2p_visitor] nathole prepare start
2024-12-27 17:39:36.459 [I] [visitor/xtcp.go:283] [cbc2938e289cbe13] [emby_p2p_visitor] nathole prepare success, nat type: EasyNAT, behavior: BehaviorNoChange, addresses: [183.239.156.67:54306 183.239.156.67:54306], assistedAddresses: [192.168.124.20:54306]
2024-12-27 17:39:36.459 [T] [visitor/xtcp.go:301] [cbc2938e289cbe13] [emby_p2p_visitor] nathole exchange info start
2024-12-27 17:39:36.479 [D] [proxy/proxy_wrapper.go:260] [cbc2938e289cbe13] [emby_p2p] start a new work connection, localAddr: 192.168.124.20:61344 remoteAddr: 47.106.160.202:3389
2024-12-27 17:39:36.479 [T] [proxy/xtcp.go:66] [cbc2938e289cbe13] [emby_p2p] nathole prepare start
2024-12-27 17:39:36.939 [I] [proxy/xtcp.go:72] [cbc2938e289cbe13] [emby_p2p] nathole prepare success, nat type: EasyNAT, behavior: BehaviorNoChange, addresses: [183.239.156.67:54307 183.239.156.67:54307], assistedAddresses: [192.168.124.20:54307]
2024-12-27 17:39:36.939 [T] [proxy/xtcp.go:86] [cbc2938e289cbe13] [emby_p2p] nathole exchange info start
2024-12-27 17:39:36.959 [I] [visitor/xtcp.go:309] [cbc2938e289cbe13] [emby_p2p_visitor] get natHoleRespMsg, sid [1735292376ac4a6f76777c773c], protocol [quic], candidate address [183.239.156.67:54307], assisted address [192.168.124.20:54307], detectBehavior: {Role:receiver Mode:0 TTL:7 SendDelayMs:0 ReadTimeoutMs:5000 CandidatePorts:[] SendRandomPorts:0 ListenRandomPorts:0}
2024-12-27 17:39:36.960 [T] [nathole/nathole.go:332] [cbc2938e289cbe13] [emby_p2p_visitor] send sid message from 0.0.0.0:54306 to 183.239.156.67:54307 with ttl 7
2024-12-27 17:39:36.960 [T] [nathole/nathole.go:357] [cbc2938e289cbe13] [emby_p2p_visitor] original ttl 128
2024-12-27 17:39:37.961 [I] [proxy/xtcp.go:93] [cbc2938e289cbe13] [emby_p2p] get natHoleRespMsg, sid [1735292376ac4a6f76777c773c], protocol [quic], candidate address [183.239.156.67:54306], assisted address [192.168.124.20:54306], detectBehavior: {Role:sender Mode:0 TTL:0 SendDelayMs:0 ReadTimeoutMs:5000 CandidatePorts:[] SendRandomPorts:0 ListenRandomPorts:0}
2024-12-27 17:39:37.961 [T] [nathole/nathole.go:332] [cbc2938e289cbe13] [emby_p2p] send sid message from 0.0.0.0:54307 to 192.168.124.20:54306
2024-12-27 17:39:37.961 [T] [nathole/nathole.go:332] [cbc2938e289cbe13] [emby_p2p] send sid message from 0.0.0.0:54307 to 183.239.156.67:54306
2024-12-27 17:39:37.961 [D] [nathole/nathole.go:292] [cbc2938e289cbe13] [emby_p2p_visitor] get udp message local 0.0.0.0:54306, from 192.168.124.20:54307
2024-12-27 17:39:37.961 [I] [visitor/xtcp.go:320] [cbc2938e289cbe13] [emby_p2p_visitor] establishing nat hole connection successful, sid [1735292376ac4a6f76777c773c], remoteAddr [192.168.124.20:54307]
2024-12-27 17:39:37.961 [D] [nathole/nathole.go:292] [cbc2938e289cbe13] [emby_p2p] get udp message local 0.0.0.0:54307, from 192.168.124.20:54306
2024-12-27 17:39:37.961 [I] [proxy/xtcp.go:109] [cbc2938e289cbe13] [emby_p2p] establishing nat hole connection successful, sid [1735292376ac4a6f76777c773c], remoteAddr [192.168.124.20:54306]
2024-12-27 17:39:38.471 [T] [proxy/proxy.go:144] [cbc2938e289cbe13] [emby_p2p] handle tcp work connection, useEncryption: false, useCompression: true
2024-12-27 17:39:38.472 [D] [proxy/proxy.go:210] [cbc2938e289cbe13] [emby_p2p] join connections, localConn(l[127.0.0.1:61354] r[127.0.0.1:8096]) workConn(l[0.0.0.0:54307] r[192.168.124.20:54306])
2024-12-27 17:39:38.472 [D] [proxy/proxy.go:222] [cbc2938e289cbe13] [emby_p2p] join connections closed
2024-12-27 17:39:38.472 [T] [proxy/proxy.go:224] [cbc2938e289cbe13] [emby_p2p] join connections errors: [readfrom tcp 127.0.0.1:61354->127.0.0.1:8096: snappy: corrupt input writeto tcp 127.0.0.1:61354->127.0.0.1:8096: read tcp 127.0.0.1:61354->127.0.0.1:8096: use of closed network connection]
2024-12-27 17:39:38.472 [D] [visitor/xtcp.go:209] [cbc2938e289cbe13] [emby_p2p_visitor] join connections closed
2024-12-27 17:39:38.472 [T] [visitor/xtcp.go:211] [cbc2938e289cbe13] [emby_p2p_visitor] join connections errors: [writeto tcp [::1]:28096->[::1]:61353: read tcp [::1]:28096->[::1]:61353: use of closed network connection]
2024-12-27 17:39:39.507 [D] [visitor/xtcp.go:167] [cbc2938e289cbe13] [emby_p2p_visitor] get a new xtcp user connection
2024-12-27 17:39:39.507 [T] [proxy/proxy.go:144] [cbc2938e289cbe13] [emby_p2p] handle tcp work connection, useEncryption: false, useCompression: true
2024-12-27 17:39:39.507 [D] [proxy/proxy.go:210] [cbc2938e289cbe13] [emby_p2p] join connections, localConn(l[127.0.0.1:61357] r[127.0.0.1:8096]) workConn(l[0.0.0.0:54307] r[192.168.124.20:54306])
2024-12-27 17:39:39.507 [D] [proxy/proxy.go:222] [cbc2938e289cbe13] [emby_p2p] join connections closed
2024-12-27 17:39:39.507 [T] [proxy/proxy.go:224] [cbc2938e289cbe13] [emby_p2p] join connections errors: [readfrom tcp 127.0.0.1:61357->127.0.0.1:8096: snappy: corrupt input writeto tcp 127.0.0.1:61357->127.0.0.1:8096: read tcp 127.0.0.1:61357->127.0.0.1:8096: use of closed network connection]
2024-12-27 17:39:39.507 [D] [visitor/xtcp.go:209] [cbc2938e289cbe13] [emby_p2p_visitor] join connections closed
2024-12-27 17:39:39.507 [T] [visitor/xtcp.go:211] [cbc2938e289cbe13] [emby_p2p_visitor] join connections errors: [writeto tcp [::1]:28096->[::1]:61356: read tcp [::1]:28096->[::1]:61356: use of closed network connection]
2024-12-27 17:39:44.523 [D] [visitor/xtcp.go:167] [cbc2938e289cbe13] [emby_p2p_visitor] get a new xtcp user connection
2024-12-27 17:39:44.523 [T] [proxy/proxy.go:144] [cbc2938e289cbe13] [emby_p2p] handle tcp work connection, useEncryption: false, useCompression: true
2024-12-27 17:39:44.523 [D] [proxy/proxy.go:210] [cbc2938e289cbe13] [emby_p2p] join connections, localConn(l[127.0.0.1:61359] r[127.0.0.1:8096]) workConn(l[0.0.0.0:54307] r[192.168.124.20:54306])
2024-12-27 17:39:44.523 [D] [proxy/proxy.go:222] [cbc2938e289cbe13] [emby_p2p] join connections closed
2024-12-27 17:39:44.523 [T] [proxy/proxy.go:224] [cbc2938e289cbe13] [emby_p2p] join connections errors: [readfrom tcp 127.0.0.1:61359->127.0.0.1:8096: snappy: corrupt input writeto tcp 127.0.0.1:61359->127.0.0.1:8096: read tcp 127.0.0.1:61359->127.0.0.1:8096: use of closed network connection]
2024-12-27 17:39:44.523 [D] [visitor/xtcp.go:209] [cbc2938e289cbe13] [emby_p2p_visitor] join connections closed
2024-12-27 17:39:44.523 [T] [visitor/xtcp.go:211] [cbc2938e289cbe13] [emby_p2p_visitor] join connections errors: [writeto tcp [::1]:28096->[::1]:61358: read tcp [::1]:28096->[::1]:61358: use of closed network connection]

proxy端报的错是

[emby_p2p] join connections closed
[emby_p2p] join connections errors: [readfrom tcp 127.0.0.1:61359->127.0.0.1:8096: snappy: corrupt input writeto tcp 127.0.0.1:61359->127.0.0.1:8096: read tcp 127.0.0.1:61359->127.0.0.1:8096: use of closed network connection]

visitor端报的错是

[emby_p2p_visitor] join connections closed
[emby_p2p_visitor] join connections errors: [writeto tcp [::1]:28096->[::1]:61358: read tcp [::1]:28096->[::1]:61358: use of closed network connection]

Steps to reproduce

  1. 本地开启一个8096端口的http服务
  2. 用上述配置文件启动frpc
  3. 浏览器访问http://localhost:28096

结果访问失败,把transport.useCompression改为false就能成功访问了

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @verygoodlee on GitHub (Dec 27, 2024). Original GitHub issue: https://github.com/fatedier/frp/issues/4610 ### Bug Description P2P打洞成功,但是连不上, 经排查,关闭transport.useCompression后就可以了 ### frpc Version 0.60.0 ### frps Version 0.60.0 ### System Architecture frps: linux/amd64 frpc: windows/amd64 ### Configurations frps.toml ```toml bindAddr = "0.0.0.0" bindPort = 7000 auth.method = "token" auth.token = "xxxxxx" ``` frpc.toml 为方便测试,proxy和visitor都放在一台机器上,确保能打洞成功,实际使用时两者肯定是在不同机器上的 ```toml serverAddr = "x.x.x.x" serverPort = 7000 auth.method = "token" auth.token = "xxxxxx" transport.heartbeatInterval = 30 transport.heartbeatTimeout = 90 log.level = "trace" [[proxies]] name = "emby_p2p" type = "xtcp" localIP = "127.0.0.1" localPort = 8096 secretKey = "xxxxxx" transport.useEncryption = false transport.useCompression = true [[visitors]] name = "emby_p2p_visitor" type = "xtcp" serverName = "emby_p2p" secretKey = "xxxxxx" bindAddr = "0.0.0.0" bindPort = 28096 ``` ### Logs <details> <summary>frpc.log</summary> ``` 2024-12-27 17:38:09.725 [I] [sub/root.go:142] start frpc service for config file [frpc.toml] 2024-12-27 17:38:09.738 [I] [client/service.go:295] try to connect to server... 2024-12-27 17:38:09.784 [I] [client/service.go:287] [3a63e11ac1831a68] login to server success, get run id [3a63e11ac1831a68] 2024-12-27 17:38:09.784 [I] [proxy/proxy_manager.go:173] [3a63e11ac1831a68] proxy added: [emby_p2p] 2024-12-27 17:38:09.784 [D] [client/control.go:240] [3a63e11ac1831a68] send heartbeat to server 2024-12-27 17:38:09.784 [T] [proxy/proxy_wrapper.go:200] [3a63e11ac1831a68] [emby_p2p] change status from [new] to [wait start] 2024-12-27 17:38:09.785 [I] [visitor/visitor_manager.go:121] [3a63e11ac1831a68] start visitor success 2024-12-27 17:38:09.785 [I] [visitor/visitor_manager.go:172] [3a63e11ac1831a68] visitor added: [qbit_p2p_visitor] 2024-12-27 17:38:09.800 [D] [client/control.go:193] [3a63e11ac1831a68] receive heartbeat from server 2024-12-27 17:38:09.801 [I] [client/control.go:168] [3a63e11ac1831a68] [emby_p2p] start proxy success 2024-12-27 17:38:39.796 [D] [client/control.go:240] [3a63e11ac1831a68] send heartbeat to server 2024-12-27 17:38:39.810 [D] [client/control.go:193] [3a63e11ac1831a68] receive heartbeat from server ^C C:\Program Files\frp>frpc.exe -c frpc.toml 2024-12-27 17:39:24.043 [I] [sub/root.go:142] start frpc service for config file [frpc.toml] 2024-12-27 17:39:24.055 [I] [client/service.go:295] try to connect to server... 2024-12-27 17:39:24.120 [I] [client/service.go:287] [cbc2938e289cbe13] login to server success, get run id [cbc2938e289cbe13] 2024-12-27 17:39:24.121 [I] [proxy/proxy_manager.go:173] [cbc2938e289cbe13] proxy added: [emby_p2p] 2024-12-27 17:39:24.121 [D] [client/control.go:240] [cbc2938e289cbe13] send heartbeat to server 2024-12-27 17:39:24.121 [T] [proxy/proxy_wrapper.go:200] [cbc2938e289cbe13] [emby_p2p] change status from [new] to [wait start] 2024-12-27 17:39:24.121 [I] [visitor/visitor_manager.go:121] [cbc2938e289cbe13] start visitor success 2024-12-27 17:39:24.121 [I] [visitor/visitor_manager.go:172] [cbc2938e289cbe13] visitor added: [emby_p2p_visitor] 2024-12-27 17:39:24.141 [D] [client/control.go:193] [cbc2938e289cbe13] receive heartbeat from server 2024-12-27 17:39:24.141 [I] [client/control.go:168] [cbc2938e289cbe13] [emby_p2p] start proxy success 2024-12-27 17:39:35.967 [D] [visitor/xtcp.go:167] [cbc2938e289cbe13] [emby_p2p_visitor] get a new xtcp user connection 2024-12-27 17:39:35.967 [T] [visitor/xtcp.go:271] [cbc2938e289cbe13] [emby_p2p_visitor] makeNatHole start 2024-12-27 17:39:35.992 [T] [visitor/xtcp.go:277] [cbc2938e289cbe13] [emby_p2p_visitor] nathole prepare start 2024-12-27 17:39:36.459 [I] [visitor/xtcp.go:283] [cbc2938e289cbe13] [emby_p2p_visitor] nathole prepare success, nat type: EasyNAT, behavior: BehaviorNoChange, addresses: [183.239.156.67:54306 183.239.156.67:54306], assistedAddresses: [192.168.124.20:54306] 2024-12-27 17:39:36.459 [T] [visitor/xtcp.go:301] [cbc2938e289cbe13] [emby_p2p_visitor] nathole exchange info start 2024-12-27 17:39:36.479 [D] [proxy/proxy_wrapper.go:260] [cbc2938e289cbe13] [emby_p2p] start a new work connection, localAddr: 192.168.124.20:61344 remoteAddr: 47.106.160.202:3389 2024-12-27 17:39:36.479 [T] [proxy/xtcp.go:66] [cbc2938e289cbe13] [emby_p2p] nathole prepare start 2024-12-27 17:39:36.939 [I] [proxy/xtcp.go:72] [cbc2938e289cbe13] [emby_p2p] nathole prepare success, nat type: EasyNAT, behavior: BehaviorNoChange, addresses: [183.239.156.67:54307 183.239.156.67:54307], assistedAddresses: [192.168.124.20:54307] 2024-12-27 17:39:36.939 [T] [proxy/xtcp.go:86] [cbc2938e289cbe13] [emby_p2p] nathole exchange info start 2024-12-27 17:39:36.959 [I] [visitor/xtcp.go:309] [cbc2938e289cbe13] [emby_p2p_visitor] get natHoleRespMsg, sid [1735292376ac4a6f76777c773c], protocol [quic], candidate address [183.239.156.67:54307], assisted address [192.168.124.20:54307], detectBehavior: {Role:receiver Mode:0 TTL:7 SendDelayMs:0 ReadTimeoutMs:5000 CandidatePorts:[] SendRandomPorts:0 ListenRandomPorts:0} 2024-12-27 17:39:36.960 [T] [nathole/nathole.go:332] [cbc2938e289cbe13] [emby_p2p_visitor] send sid message from 0.0.0.0:54306 to 183.239.156.67:54307 with ttl 7 2024-12-27 17:39:36.960 [T] [nathole/nathole.go:357] [cbc2938e289cbe13] [emby_p2p_visitor] original ttl 128 2024-12-27 17:39:37.961 [I] [proxy/xtcp.go:93] [cbc2938e289cbe13] [emby_p2p] get natHoleRespMsg, sid [1735292376ac4a6f76777c773c], protocol [quic], candidate address [183.239.156.67:54306], assisted address [192.168.124.20:54306], detectBehavior: {Role:sender Mode:0 TTL:0 SendDelayMs:0 ReadTimeoutMs:5000 CandidatePorts:[] SendRandomPorts:0 ListenRandomPorts:0} 2024-12-27 17:39:37.961 [T] [nathole/nathole.go:332] [cbc2938e289cbe13] [emby_p2p] send sid message from 0.0.0.0:54307 to 192.168.124.20:54306 2024-12-27 17:39:37.961 [T] [nathole/nathole.go:332] [cbc2938e289cbe13] [emby_p2p] send sid message from 0.0.0.0:54307 to 183.239.156.67:54306 2024-12-27 17:39:37.961 [D] [nathole/nathole.go:292] [cbc2938e289cbe13] [emby_p2p_visitor] get udp message local 0.0.0.0:54306, from 192.168.124.20:54307 2024-12-27 17:39:37.961 [I] [visitor/xtcp.go:320] [cbc2938e289cbe13] [emby_p2p_visitor] establishing nat hole connection successful, sid [1735292376ac4a6f76777c773c], remoteAddr [192.168.124.20:54307] 2024-12-27 17:39:37.961 [D] [nathole/nathole.go:292] [cbc2938e289cbe13] [emby_p2p] get udp message local 0.0.0.0:54307, from 192.168.124.20:54306 2024-12-27 17:39:37.961 [I] [proxy/xtcp.go:109] [cbc2938e289cbe13] [emby_p2p] establishing nat hole connection successful, sid [1735292376ac4a6f76777c773c], remoteAddr [192.168.124.20:54306] 2024-12-27 17:39:38.471 [T] [proxy/proxy.go:144] [cbc2938e289cbe13] [emby_p2p] handle tcp work connection, useEncryption: false, useCompression: true 2024-12-27 17:39:38.472 [D] [proxy/proxy.go:210] [cbc2938e289cbe13] [emby_p2p] join connections, localConn(l[127.0.0.1:61354] r[127.0.0.1:8096]) workConn(l[0.0.0.0:54307] r[192.168.124.20:54306]) 2024-12-27 17:39:38.472 [D] [proxy/proxy.go:222] [cbc2938e289cbe13] [emby_p2p] join connections closed 2024-12-27 17:39:38.472 [T] [proxy/proxy.go:224] [cbc2938e289cbe13] [emby_p2p] join connections errors: [readfrom tcp 127.0.0.1:61354->127.0.0.1:8096: snappy: corrupt input writeto tcp 127.0.0.1:61354->127.0.0.1:8096: read tcp 127.0.0.1:61354->127.0.0.1:8096: use of closed network connection] 2024-12-27 17:39:38.472 [D] [visitor/xtcp.go:209] [cbc2938e289cbe13] [emby_p2p_visitor] join connections closed 2024-12-27 17:39:38.472 [T] [visitor/xtcp.go:211] [cbc2938e289cbe13] [emby_p2p_visitor] join connections errors: [writeto tcp [::1]:28096->[::1]:61353: read tcp [::1]:28096->[::1]:61353: use of closed network connection] 2024-12-27 17:39:39.507 [D] [visitor/xtcp.go:167] [cbc2938e289cbe13] [emby_p2p_visitor] get a new xtcp user connection 2024-12-27 17:39:39.507 [T] [proxy/proxy.go:144] [cbc2938e289cbe13] [emby_p2p] handle tcp work connection, useEncryption: false, useCompression: true 2024-12-27 17:39:39.507 [D] [proxy/proxy.go:210] [cbc2938e289cbe13] [emby_p2p] join connections, localConn(l[127.0.0.1:61357] r[127.0.0.1:8096]) workConn(l[0.0.0.0:54307] r[192.168.124.20:54306]) 2024-12-27 17:39:39.507 [D] [proxy/proxy.go:222] [cbc2938e289cbe13] [emby_p2p] join connections closed 2024-12-27 17:39:39.507 [T] [proxy/proxy.go:224] [cbc2938e289cbe13] [emby_p2p] join connections errors: [readfrom tcp 127.0.0.1:61357->127.0.0.1:8096: snappy: corrupt input writeto tcp 127.0.0.1:61357->127.0.0.1:8096: read tcp 127.0.0.1:61357->127.0.0.1:8096: use of closed network connection] 2024-12-27 17:39:39.507 [D] [visitor/xtcp.go:209] [cbc2938e289cbe13] [emby_p2p_visitor] join connections closed 2024-12-27 17:39:39.507 [T] [visitor/xtcp.go:211] [cbc2938e289cbe13] [emby_p2p_visitor] join connections errors: [writeto tcp [::1]:28096->[::1]:61356: read tcp [::1]:28096->[::1]:61356: use of closed network connection] 2024-12-27 17:39:44.523 [D] [visitor/xtcp.go:167] [cbc2938e289cbe13] [emby_p2p_visitor] get a new xtcp user connection 2024-12-27 17:39:44.523 [T] [proxy/proxy.go:144] [cbc2938e289cbe13] [emby_p2p] handle tcp work connection, useEncryption: false, useCompression: true 2024-12-27 17:39:44.523 [D] [proxy/proxy.go:210] [cbc2938e289cbe13] [emby_p2p] join connections, localConn(l[127.0.0.1:61359] r[127.0.0.1:8096]) workConn(l[0.0.0.0:54307] r[192.168.124.20:54306]) 2024-12-27 17:39:44.523 [D] [proxy/proxy.go:222] [cbc2938e289cbe13] [emby_p2p] join connections closed 2024-12-27 17:39:44.523 [T] [proxy/proxy.go:224] [cbc2938e289cbe13] [emby_p2p] join connections errors: [readfrom tcp 127.0.0.1:61359->127.0.0.1:8096: snappy: corrupt input writeto tcp 127.0.0.1:61359->127.0.0.1:8096: read tcp 127.0.0.1:61359->127.0.0.1:8096: use of closed network connection] 2024-12-27 17:39:44.523 [D] [visitor/xtcp.go:209] [cbc2938e289cbe13] [emby_p2p_visitor] join connections closed 2024-12-27 17:39:44.523 [T] [visitor/xtcp.go:211] [cbc2938e289cbe13] [emby_p2p_visitor] join connections errors: [writeto tcp [::1]:28096->[::1]:61358: read tcp [::1]:28096->[::1]:61358: use of closed network connection] ``` </details> proxy端报的错是 ``` [emby_p2p] join connections closed [emby_p2p] join connections errors: [readfrom tcp 127.0.0.1:61359->127.0.0.1:8096: snappy: corrupt input writeto tcp 127.0.0.1:61359->127.0.0.1:8096: read tcp 127.0.0.1:61359->127.0.0.1:8096: use of closed network connection] ``` visitor端报的错是 ``` [emby_p2p_visitor] join connections closed [emby_p2p_visitor] join connections errors: [writeto tcp [::1]:28096->[::1]:61358: read tcp [::1]:28096->[::1]:61358: use of closed network connection] ``` ### Steps to reproduce 1. 本地开启一个8096端口的http服务 2. 用上述配置文件启动frpc 3. 浏览器访问`http://localhost:28096` 结果访问失败,把transport.useCompression改为false就能成功访问了 ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
Author
Owner

@fatedier commented on GitHub (Dec 27, 2024):

The root cause of your “snappy: corrupt input” error is that the P2P (xtcp) configuration is inconsistent between the proxy and the visitor. Specifically:

If you enable transport.useCompression on the proxy side, you must also enable it on the visitor side for the same xtcp proxy name.
In your current setup, one side is sending compressed data while the other side isn’t expecting to decompress it, triggering the snappy: corrupt input error.
Once you align the settings—either both transport.useCompression = true or both false—the P2P connection should work correctly.

<!-- gh-comment-id:2563533946 --> @fatedier commented on GitHub (Dec 27, 2024): The root cause of your “snappy: corrupt input” error is that the P2P (xtcp) configuration is inconsistent between the proxy and the visitor. Specifically: If you enable transport.useCompression on the proxy side, you must also enable it on the visitor side for the same xtcp proxy name. In your current setup, one side is sending compressed data while the other side isn’t expecting to decompress it, triggering the snappy: corrupt input error. Once you align the settings—either both transport.useCompression = true or both false—the P2P connection should work correctly.
Author
Owner

@verygoodlee commented on GitHub (Dec 27, 2024):

好吧,没看到文档中有说这个,为啥stcp没这个限制,只要proxy端开启压缩,visitor端不需要,

建议完善一下文档,或者在frps_full_example.toml里简单提一下

<!-- gh-comment-id:2563541246 --> @verygoodlee commented on GitHub (Dec 27, 2024): 好吧,没看到文档中有说这个,为啥stcp没这个限制,只要proxy端开启压缩,visitor端不需要, 建议完善一下文档,或者在frps_full_example.toml里简单提一下
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#3642
No description provided.