Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grpc协议下UDP通过cloudflare会断? #671

Closed
AlistairEds opened this issue Aug 11, 2021 · 3 comments
Closed

grpc协议下UDP通过cloudflare会断? #671

AlistairEds opened this issue Aug 11, 2021 · 3 comments

Comments

@AlistairEds
Copy link

Xray版本1.4.2

问题描述:
像GTA5这种UDP联机的在线游戏,使用grpc就会无法匹配到其他玩家(能正常连接上游戏服务器,正常上网),但WS就没有问题。
不使用cf时,grpc倒是能连上一两个玩家,也可能是因为裸连线路不好(套CF线路很好),连接效果很差(正常的话至少能连十几个玩家)。

配置:
netch使用socks5代理到v2rayN--->cf--->fallback--->nginx--->grpc

xray日志:
error.log

nginx配置复制的xray-example里的VLESS-grpc

服务器配置:

{
"log": {
"access": "/var/log/xray/access.log",
"error": "/var/log/xray/error.log",
"loglevel": "info"
},
"dns": {
"servers": [
// "https+local://1.1.1.1/dns-query",
// "localhost"
"8.8.8.8",
"8.8.4.4"
]
},
"routing": {
"domainStrategy": "AsIs",
"rules": [
// prevent server local loop
{
"type": "field",
"ip": [
"geoip:private"
],
"outboundTag": "block"
},
{
"type": "field",
"domain": [
"geosite:category-ads-all"
],
"outboundTag": "block"
},
{
"type": "field",
"domain": [
"geosite:cn"
],
"outboundTag": "block"
}
]
},
"inbounds": [
{
"port": 443,
"protocol": "vless",
"settings": {
"clients": [
{
"id": "",
"level": 0,
},
{
"id": "
",
"level": 0,
}
],
"decryption": "none",
"fallbacks": [
{
"dest": 8080
},
{
"name": "
",
"path": "/
", // websocket
"dest": 10956,
"xver": 1
},
{
"name": "
",
"path": "/
", // vmess+websocket
"dest": 49650,
"xver": 1
},
//fallback to nginx
{
"name": "",
"alpn": "h2",
"dest": 8081,
"xver": 1
},
{
"name": "",
"dest": 8080,
"xver": 1
}
]
},
"streamSettings": {
"network": "tcp",
"security": "xtls",
"xtlsSettings": {
"alpn": [
"h2",
"http/1.1"
],
"certificates": [
{
"certificateFile": "/
",
"keyFile": "/
"
}
]
}
},
"sniffing": {
"enabled": true,
"destOverride": ["http","tls"]
}
},
{
"port": 10956,
"listen": "127.0.0.1",
"protocol": "vless",
"settings": {
"clients": [
{
"id": "************",
"level": 0,
"email": "
"
}
],
"decryption": "none"
},
"streamSettings": {
"network": "ws",
"security": "none",
"wsSettings": {
"acceptProxyProtocol": true,
"path": "/
"
}
}
},
{
"port": 49650,
"protocol": "vmess",
"settings": {
"clients": [
{
"email": "",
"id": "
",
"level": 0,
"alterId": 0
}
]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"acceptProxyProtocol": true,
"path": "/
"
}
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
},
{
"port": 10957,
"listen": "127.0.0.1",
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "
*********", // UUID
"email": "
",
"alterId": 0
}
]
//"decryption": "none"
},
"streamSettings": {
"network": "grpc",
"grpcSettings": {
"serviceName": ********// ServiceName
}
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
}
],
"outbounds": [
{
"protocol": "freedom"
},
{
"protocol": "blackhole",
"tag":"block"
}
]
}

@AlistairEds
Copy link
Author

Nginx的error.log中有大量的“upstream prematurely closed connection while reading upstream”,这是CF关闭了连接?

@xqzr
Copy link
Contributor

xqzr commented Aug 16, 2021

Nginx的error.log中有大量的“upstream prematurely closed connection while reading upstream”,这是CF关闭了连接?

是的,cf 限制 client_max_body_size(100M),因此,不建议 gRPC 通过 cf。

@MuenYu
Copy link

MuenYu commented Aug 17, 2021

跟 UDP 是没啥关系的(毕竟 udp over tcp)。
在 套 cf 使用 grpc 的情况下,似乎 cf 会自动断掉连接时长较长的 tcp。

本地测试是使用代理 ssh 连接主机,大概 30s-5min 会断连。

在此附上以前关于这一点的发现

@XTLS XTLS locked and limited conversation to collaborators Sep 8, 2021
@hmol233 hmol233 closed this as completed Sep 8, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants