e1732a364fed / v2ray_simple

a verysimple proxy
MIT License
530 stars 104 forks source link

[Bug]vlesss+utls+lazy 始终只能访问http,访问https则报错空白页 #234

Open lsxposed opened 1 year ago

lsxposed commented 1 year ago

Describe the bug【描述 bug】

_1. 同时开启vlesss v1 + mux ,vs core闪退; https://github.com/e1732a364fed/v2ray_simple/issues/170#issue-1436485414_ 2. 使用其他ws grpc等高级层均正常。但vlesss+utls+lazy 始终只能访问http,访问https则报错空白页。且服务端、客户端均开启debug,日志中无错误。

To Reproduce【如何复现该bug】

1.client同时开启vless v1 + mux; 2.使用vlesss(v0/v1) + lazy访问https。

Expected behavior【预期的行为】

1.不闪退; 2.正常访问所有url。

Envs (please complete the following information):【系统环境】

Debian11 Server vs core 1.2.5 & Win10 Client vs core 1.2.5

Config file 【配置文件,客户端服务端配置都提供】

服务端 vs core conf

[[listen]]
tag = "vless_lazy"
protocol = "vlesss"
network = "unix"
host = "/dev/shm/vless_lazy.sock"
version = -1
fallback = ":80"
cert = "/etc/verysimple/lazy.vlesss.com.crt"
key = "/etc/verysimple/lazy.vlesss.com.key"
lazy = true
xver = 2
sniffing.enabled = true
users = [ {user = "a"} , {user = "b"} , {user = "c"}]
extra.tls_rejectUnknownSni = true

服务端 Nginx conf

stream {
    map $ssl_preread_server_name $backend_name {
        lazy.vlesss.com  vless;
        ...
    }
    upstream vless {
        server unix:/dev/shm/vless_lazy.sock;
    }
    ...

    server {
        listen 443;
        listen [::]:443;
        ssl_preread on;
        proxy_pass $backend_name; 
        proxy_protocol on;
    }
}

客户端

[[dial]]
tag = "vless_lazy"  
protocol = "vlesss"
uuid = "a"
host = "lazy.vlesss.com"
ip = "a.b.c.d"
port = 443
version = 1    
tls_type = "utls"
#mux = true
lazy = true

Debug Log 【Debug日志, 客户端 和 服务端 的 日志 都提供】

1. 同时开启vlesss v1 + mux ,vs core闪退:

终端显示

panic: interface conversion: *simplesocks.TCPConn is not tlsLayer.Conn: missing method GetAlpn

goroutine 43 [running]:
github.com/e1732a364fed/v2ray_simple.tryTlsLazyRawRelay(0xa37a0, 0x0, {0x239b24a83e8?, 0xc00014e000}, {0x0?, 0x0}, {{0x0, 0x0}, {0x0, 0x0}, ...}, ...)
        github.com/e1732a364fed/v2ray_simple/tls_lazy.go:110 +0x54b
github.com/e1732a364fed/v2ray_simple.dialClient_andRelay({0xa37a0, 0xc00027e318, {0x1d1d9f0, 0xc00000a428}, {0x1d1d9f0, 0xc00000a428}, {0x1d230f8, 0xc00014f080}, {0x1d250a8, 0xc00014e000}, ...}, ...)
        github.com/e1732a364fed/v2ray_simple/main.go:1720 +0xace
github.com/e1732a364fed/v2ray_simple.passToOutClient({0xa37a0, 0xc00027e318, {0x1d1d9f0, 0xc00000a428}, {0x1d1d9f0, 0xc00000a428}, {0x1d230f8, 0xc00014f080}, {0x1d250a8, 0xc00014e000}, ...}, ...)
        github.com/e1732a364fed/v2ray_simple/main.go:1159 +0x2f36
github.com/e1732a364fed/v2ray_simple.handshakeInserver_and_passToOutClient({0xa37a0, 0xc00027e318, {0x1d1d9f0, 0xc00000a428}, {0x1d1d9f0, 0xc00000a428}, {0x1d230f8, 0xc00014f080}, {0x1d250a8, 0xc00014e000}, ...})
        github.com/e1732a364fed/v2ray_simple/main.go:650 +0x2b2
github.com/e1732a364fed/v2ray_simple.handleNewIncomeConnection({0x1d230f8, 0xc00014f080}, {0x1d250a8, 0xc00014e000}, {0x1d1d9f0, 0xc00000a428}, 0xc00027e538, 0xc00027e318)
        github.com/e1732a364fed/v2ray_simple/main.go:474 +0x14f8
github.com/e1732a364fed/v2ray_simple.ListenSer.func4({0x1d1d9f0?, 0xc00000a428?})
        github.com/e1732a364fed/v2ray_simple/main.go:186 +0x47
created by github.com/e1732a364fed/v2ray_simple/netLayer.loopAccept
        github.com/e1732a364fed/v2ray_simple/netLayer/listen.go:63 +0x2cd

2. 使用其他ws grpc等高级层均正常。但vlesss+utls+lazy 始终只能访问http,访问https则报错空白页。且服务端、客户端均开启debug,日志中无错误:

服务端vs core日志

{"L":"INFO ","T":"230115 032611.173","M":"New Accepted Conn","connid":306926,"from":"/dev/shm/vless_lazy.sock","handler":"unix+tls+lazy+vless:///dev/shm/vless_lazy.sock#vless_lazy"}
{"L":"DEBUG","T":"230115 032611.229","M":"Try routing","connid":306926,"source":{"Addr":{"Network":"","Name":"google.com","IP":"","Port":443},"InTag":"vless_lazy","UserIdentityStr":"a"}}
{"L":"DEBUG","T":"230115 032611.229","M":"Default Route","connid":306926,"source":"google.com:443","client":"dual+direct","addr":""}
{"L":"INFO ","T":"230115 032611.229","M":"Request","connid":306926,"From":"/dev/shm/vless_lazy.sock","Target":"tcp://google.com:443","through":"dual+direct://#mydirect"}
{"L":"DEBUG","T":"230115 032611.366","M":"Try tls lazy","id":306926}

客户端vs core日志

{"L":"INFO ","T":"230115 162619.560","M":"New Accepted Conn","connid":429572,"from":"127.0.0.1:2801","handler":"socks5http://127.0.0.1:8080"}
{"L":"DEBUG","T":"230115 162619.560","M":"Try routing","connid":429572,"source":{"Addr":{"Network":"tcp","Name":"google.com","IP":"","Port":443},"InTag":"","UserIdentityStr":""}}
{"L":"INFO ","T":"230115 162619.561","M":"Route","connid":429572,"to outtag":"vless_lazy","with addr":"a.b.c.d:443","and protocol":"utls+lazy+vless_1","for source":{"Addr":{"Network":"tcp","Name":"google.com","IP":"","Port":443},"InTag":"","UserIdentityStr":""}}
{"L":"INFO ","T":"230115 162619.564","M":"Request","connid":429572,"From":"127.0.0.1:2801","Target":"tcp://google.com:443","through":"utls+lazy+vless_1://a.b.c.d:443#vless_lazy"}
{"L":"DEBUG","T":"230115 162619.675","M":"handshake client with first payload","connid":429572,"len":757}
{"L":"DEBUG","T":"230115 162619.675","M":"Try tls lazy","id":429572}

Other 【其他】

无。 ps:第二条可能与lazy有关?不知道我的姿势哪里错了...

【注意,配置文件和客户端服务端配置 太长的话,前后加上三个 `, 如 ```】

Leao9203 commented 1 year ago

+1,同样出现这个问题,并进行了一个小测试 测试时的变量有如下三个

version = 0 / 1
lazy = true / false
use_mux = true / false

经过测试, 当 version = 1 ,lazy = true 且 use_mux = true 的情况下,verysimple 会直接闪退,并且跳出和提出者一样的闪退日志; 当 version = 1,lazy = true 或 use_mux = true 的情况下,正常运行且未出现报错; 当 version = 0,lazy = true 且 use_mux = true 的情况下,正常运行但部分网站无法访问(如 GitHub),报错ERR_SSL_BAD_RECORD_MAC_ALERT; 当 version = 0,lazy = true 或 use_mux = true 的情况下,正常运行且网站可访问。 顺带一提,tls_type = "utls" 也可能概率性出现 ERR_SSL_BAD_RECORD_MAC_ALERT 报错

e1732a364fed commented 1 year ago

收到

e1732a364fed commented 1 year ago

第一条不是bug。lazy不能和 mux 共存

e1732a364fed commented 1 year ago

第二条,我在本机测试未能复现。

测试配置:examples/vlesss.client.toml 和 examples/vlesss.server.toml 中,取消 lazy 的注释. 访问网站:bilibili