luci: optimize v2ray/xray websocket config

Backport from: https://github.com/xiaorouji/openwrt-passwall2/pull/130
This commit is contained in:
Gzxhwq 2022-06-10 14:26:08 +08:00 committed by sbwml
parent 12ce2771e1
commit cce8eb24a9
3 changed files with 12 additions and 8 deletions

View File

@ -177,7 +177,8 @@ function gen_outbound(node, tag, proxy_table)
path = node.ws_path or "",
headers = (node.ws_host ~= nil) and
{Host = node.ws_host} or nil,
maxEarlyData = tonumber(node.ws_maxEarlyData) or nil
maxEarlyData = tonumber(node.ws_maxEarlyData) or nil,
earlyDataHeaderName = (node.ws_earlyDataHeaderName) and node.ws_earlyDataHeaderName or nil
} or nil,
httpSettings = (node.transport == "h2") and {
path = node.h2_path,

View File

@ -693,17 +693,14 @@ ws_path:depends("trojan_transport", "ws")
ws_path:depends({ type = "Brook", brook_protocol = "wsclient" })
ws_enableEarlyData = s:option(Flag, "ws_enableEarlyData", translate("Enable early data"))
ws_enableEarlyData:depends("transport", "ws")
ws_enableEarlyData:depends({ type = "V2ray", transport = "ws" })
ws_maxEarlyData = s:option(Value, "ws_maxEarlyData", translate("Early data length"))
ws_maxEarlyData.default = "1024"
ws_maxEarlyData:depends("ws_enableEarlyData", true)
function ws_maxEarlyData.cfgvalue(self, section)
return m:get(section, "ws_maxEarlyData")
end
function ws_maxEarlyData.write(self, section, value)
m:set(section, "ws_maxEarlyData", value)
end
ws_earlyDataHeaderName = s:option(Value, "ws_earlyDataHeaderName", translate("Early data header name"), translate("Recommended value: Sec-WebSocket-Protocol"))
ws_earlyDataHeaderName:depends("ws_enableEarlyData", true)
-- [[ HTTP/2部分 ]]--
h2_host = s:option(Value, "h2_host", translate("HTTP/2 Host"))

View File

@ -1279,6 +1279,12 @@ msgstr "启用前置数据"
msgid "Early data length"
msgstr "前置数据最大长度"
msgid "Early data header name"
msgstr "前置数据HTTP头名"
msgid "Recommended value: Sec-WebSocket-Protocol"
msgstr "推荐值Sec-WebSocket-Protocol"
msgid "Health check"
msgstr "健康检查"