Skip to content
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

Trojan 协议 FallbackObject 中的 name 与 alpn 项不生效 #793

Closed
OrvilleQ opened this issue Oct 27, 2021 · 4 comments
Closed

Trojan 协议 FallbackObject 中的 name 与 alpn 项不生效 #793

OrvilleQ opened this issue Oct 27, 2021 · 4 comments

Comments

@OrvilleQ
Copy link

OrvilleQ commented Oct 27, 2021

版本信息

Xray-core Commit: dd67699
Golang Version: 1.17.2

期待结果

根据 VLESS-TCP-XTLS-WHATEVER 模板配置 XTLS 回落至 Trojan 回落至 Nginx。

实际结果

Curl 参数 \ 配置文件 默认回落为 http1.1 默认回落为 h2 无默认回落
-http1.1 ×(1) ×(2)
-http2 ×(1) ×(2)

(1) 表现为连接到错误的 http 协议。
(2) 表现为 (52) Empty reply from server,同时程序会产生 app/proxyman/inbound: connection ends > proxy/trojan: failed to find the default "name" config 的错误。

if apfb == nil {
return newError(`failed to find the default "name" config`).AtWarning()
}

配置文件

05_inbounds.json
{
    "inbounds": [
      {
        "port": 443,
        "protocol": "vless",
        "settings": {
          "clients": [
            {
              "id": "a-client-id",
              "flow": "xtls-rprx-direct",
              "level": 0,
              "email": "a-client@xtls"
            }
          ],
          "decryption": "none",
          "fallbacks": [
            {
              "dest": "8443",
              "xver": 1
            }
          ]
        },
        "streamSettings": {
          "network": "tcp",
          "security": "xtls",
          "xtlsSettings": {
            "alpn": [
              "h2",
              "http/1.1"
            ],
            "certificates": [
              {
                "certificateFile": "/etc/ssl/certs.pem",
                "keyFile": "/etc/ssl/private.pem"
              }
            ]
          }
        }
      },
      {
        "port": 8443,
        "listen": "0.0.0.0",
        "protocol": "trojan",
        "settings": {
          "clients": [
            {
              "password": "a-client-password",
              "level": 0,
              "email": "a-client@trojan"
            }
          ],
          "fallbacks": [
            {
              "name": "a-site.com",
              "dest": "82",
              "xver": 1,
              "alpn": "h2"
            },
            {
              "name": "a-site.com",
              "dest": "80",
              "xver": 1
            },
            {
              "name": "another-site.com",
              "dest": "82",
              "xver": 1,
              "alpn": "h2"
            },
            {
              "name": "another-site.com",
              "dest": "80",
              "xver": 1
            }
          ]
        },
        "streamSettings": {
          "network": "tcp",
          "security": "none",
          "tcpSettings": {
            "acceptProxyProtocol": true
          },
          "tlsSettings": {
            "alpn": [
              "h2",
              "http/1.1"
            ]
          }
        }
      }
    ]
  }
@malikshi
Copy link

"alpn": [
"h2",
"http/1.1"
],
Can you try put http/1.1 first then h2

@OrvilleQ
Copy link
Author

"alpn": [ "h2", "http/1.1" ], Can you try put http/1.1 first then h2

@malikshi

I have tested your suggestion in different situations, including modifying only xtlsSettings or tlsSettings, or both.

All tests present error type 2 with (52) Empty reply from server and app/proxyman/inbound: connection ends > proxy/trojan: failed to find the default "name" config.

And it can't be a bug related to alpn, at least not yet.

if napfb[name] == nil {
name = ""
}
apfb := napfb[name]
if apfb == nil {
return newError(`failed to find the default "name" config`).AtWarning()
}
if apfb[alpn] == nil {
alpn = ""
}
pfb := apfb[alpn]
if pfb == nil {
return newError(`failed to find the default "alpn" config`).AtWarning()
}

Because the program has not yet executed the code that may throw the alpn-related error.

@malikshi
Copy link

malikshi commented Nov 2, 2021

I see. Yes it's still catch error when using trojan/xray trojan. I used trojan-go with alpn order that i suggested

@yuhan6665
Copy link
Member

v2fly/v2ray-core#1286
应该修好了 如果最新版还不行再报告

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants