alireza0 / x-ui

xray panel supporting multi-protocol multi-user expire day & traffic (Vmess & Vless & Trojan & Shadowsocks)
https://t.me/XrayUI
GNU General Public License v3.0
2.95k stars 470 forks source link

h2 as Transport protocol #314

Closed TheLordOfTheKings closed 12 months ago

TheLordOfTheKings commented 1 year ago

Hi @alireza0 jan and thanks for your efforts, Can you bring h2 to Transport protocols? It's fast and can be used behind a CDN, though it's missing in all Vaxilu forks. Its config looks like other TCP-based protocols: (Read More)

{ "listen": "@vlessh2", "protocol": "vless", "settings": { "clients": [ { "email":"general@vless-h2", "id": "90e4903e-66a4-45f7-abda-fd5d5ed7f797", "level": 0 } ], "decryption": "none" }, "streamSettings": { "network": "h2", "security": "none", "httpSettings": { "path": "/vlh2" } }, "sniffing": { "enabled": true, "destOverride": [ "http", "tls" ] } }

alireza0 commented 1 year ago

Hello @arash88 jan, Here you can see all the possible values for network parameter. The H2 network will be active when you set HTTP as network and enable tls with h2 in ALPN. It is mentioned in the link that you sent in 2nd paragraph:

Based on the recommendations of HTTP/2, both the client and server must enable TLS to use this transmission mode normally.

TheLordOfTheKings commented 1 year ago

Thanks for the response @alireza0 joon, Can you check this official example ? They strictly use h2 Network for HTTP/2 and use http for HTTP/1,1 scenarios.

alireza0 commented 1 year ago

It is weird! They might have mistakes in documentation or config samples. Here is a good examples of conflict: https://github.com/XTLS/Xray-examples/blob/main/VMess-HTTP2/config_server.json https://github.com/XTLS/Xray-examples/blob/main/All-in-One-fallbacks-Nginx/client.configs/Vless-H2-TLS.json https://github.com/XTLS/Xray-examples/blob/main/All-in-One-fallbacks-Nginx/client.configs/Trojan-H2-TLS.json

And here they configure h2 as well: https://github.com/XTLS/Xray-examples/blob/main/VLESS-H2C-Caddy2/server.json

TheLordOfTheKings commented 1 year ago

Check this out please. Seems like h2 transport also supports REALITY!

alireza0 commented 1 year ago

I can't trust them, and also examples! As far as I know:

It seems, it is same to use h2 and http+tls streams. and the configuration should be same. But please be informed that there is no StreamSetting object defined for h2 and it is only httpSettings (here)

My assumption is that we can use h2 and http in a same way and the result should be same. Check this example out. They use httpSettings for StreamSettings.

TheLordOfTheKings commented 1 year ago

Seems like Its really fun to play with 😅

alireza0 commented 12 months ago

Come back again to this thread mentioning this fact again that trasmission http is exactly what we are talking about : h2. In some applications, tcp + http header transmission called http and use http as transmission called h2.

I will close this isse and will fix the naming in next version.

Thanks again :)