From 4fc65fc04bf849b6c021a895dbc282651eb8bc2b Mon Sep 17 00:00:00 2001 From: tansuo Date: Sat, 20 Oct 2018 21:16:20 +0800 Subject: [PATCH] add http/2 option in v2ray pro --- .../luci-app-v2ray-pro/luasrc/model/cbi/v2raypro.lua | 9 +++++++++ .../luci-app-v2ray-pro/root/etc/v2ray/gen_config.lua | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/package/lean/luci-app-v2ray-pro/luasrc/model/cbi/v2raypro.lua b/package/lean/luci-app-v2ray-pro/luasrc/model/cbi/v2raypro.lua index 12f203a5f..28137d207 100644 --- a/package/lean/luci-app-v2ray-pro/luasrc/model/cbi/v2raypro.lua +++ b/package/lean/luci-app-v2ray-pro/luasrc/model/cbi/v2raypro.lua @@ -100,6 +100,7 @@ network_type = s:taboption("main",ListValue, "network_type", translate("Network network_type:value("tcp") network_type:value("kcp") network_type:value("ws") +network_type:value("h2") -- tcp settings tcp_obfs = s:taboption("main",ListValue, "tcp_obfs", translate("TCP Obfs")) @@ -159,6 +160,14 @@ ws_headers = s:taboption("main",Value, "ws_headers", translate("WebSocket Header ws_headers:depends("network_type", "ws") ws_headers.datatype = "host" +-- http/2 settings +h2_path = s:taboption("main",Value, "h2_path", translate("HTTP Path")) +h2_path:depends("network_type", "h2") + +h2_domain = s:taboption("main",Value, "h2_domain", translate("HTTP Domain")) +h2_domain:depends("network_type", "h2") +h2_domain.datatype = "host" + -- others tls = s:taboption("main",Flag, "tls", translate("TLS")) tls.rmempty = false diff --git a/package/lean/luci-app-v2ray-pro/root/etc/v2ray/gen_config.lua b/package/lean/luci-app-v2ray-pro/root/etc/v2ray/gen_config.lua index 1b467eb9b..409ed480f 100644 --- a/package/lean/luci-app-v2ray-pro/root/etc/v2ray/gen_config.lua +++ b/package/lean/luci-app-v2ray-pro/root/etc/v2ray/gen_config.lua @@ -137,6 +137,13 @@ local v2ray = { Host = ucursor:get(conf_path, "v2raypro", "ws_headers") } or nil, } or nil, + + httpSettings = (v2ray_stream_mode == "h2") and { + path = ucursor:get(conf_path, "v2raypro", "h2_path"), + host = (ucursor:get(conf_path, "v2raypro", "h2_domain") ~= nil) and { + ucursor:get(conf_path, "v2raypro", "h2_domain") + } or nil, + } or nil, }, mux = { enabled = (ucursor:get(conf_path, "v2raypro", "mux") == "1") and true or false