update-10.18

This commit is contained in:
github-actions[bot] 2021-10-18 09:05:04 +08:00
parent e47ca3fbcc
commit 1391e5bdf8
8 changed files with 145 additions and 11 deletions

View File

@ -229,6 +229,14 @@ o:value("h2", translate("h2"))
o:value("grpc", translate("grpc"))
o:depends("type", "vmess")
o = s:option(ListValue, "obfs_trojan", translate("obfs-mode"))
o.rmempty = true
o.default = "none"
o:value("none")
o:value("ws", translate("websocket (ws)"))
o:value("grpc", translate("grpc"))
o:depends("type", "trojan")
o = s:option(Value, "host", translate("obfs-hosts"))
o.datatype = "host"
o.placeholder = translate("example.com")
@ -242,8 +250,8 @@ o:depends("obfs_snell", "http")
-- vmess路径
o = s:option(Value, "path", translate("path"))
o.rmempty = true
o.placeholder = translate("/")
o:depends("obfs", "websocket")
o:depends("obfs_vmess", "websocket")
o = s:option(DynamicList, "h2_host", translate("host"))
o.rmempty = true
@ -264,15 +272,17 @@ o:depends("obfs_vmess", "http")
o = s:option(Value, "custom", translate("headers"))
o.rmempty = true
o.placeholder = translate("v2ray.com")
o:depends("obfs", "websocket")
o:depends("obfs_vmess", "websocket")
o = s:option(Value, "ws_opts_path", translate("ws-opts-path"))
o.rmempty = true
o.placeholder = translate("/path")
o:depends("obfs_vmess", "websocket")
o = s:option(Value, "ws_opts_headers", translate("ws-opts-headers"))
o = s:option(DynamicList, "ws_opts_headers", translate("ws-opts-headers"))
o.rmempty = true
o.placeholder = translate("Host: v2ray.com")
o:depends("obfs_vmess", "websocket")
o = s:option(Value, "max_early_data", translate("max-early-data"))
@ -366,9 +376,21 @@ o = s:option(Value, "grpc_service_name", translate("grpc-service-name"))
o.rmempty = true
o.datatype = "host"
o.placeholder = translate("example")
o:depends("type", "trojan")
o:depends("obfs_trojan", "grpc")
o:depends("obfs_vmess", "grpc")
-- [[ trojan-ws-path ]]--
o = s:option(Value, "trojan_ws_path", translate("Path"))
o.rmempty = true
o.placeholder = translate("/path")
o:depends("obfs_trojan", "ws")
-- [[ trojan-ws-headers ]]--
o = s:option(DynamicList, "trojan_ws_headers", translate("Headers"))
o.rmempty = true
o.placeholder = translate("Host: v2ray.com")
o:depends("obfs_trojan", "ws")
o = s:option(DynamicList, "groups", translate("Proxy Group"))
o.description = font_red..bold_on..translate("No Need Set when Config Create, The added Proxy Groups Must Exist")..bold_off..font_off
o.rmempty = true

View File

@ -9,5 +9,19 @@
</select>
<input class="cbi-input-file" style="width: 30%" type="file" id="ulfile" name="ulfile" />
<input type="submit" class="btn cbi-button cbi-input-reload" name="upload" value="<%:Upload%>" />
<input type="submit" class="btn cbi-button cbi-button-reset" value="<%:Backup%>" onclick="return backup_all_file(this)"/>
</div>
<%+cbi/valuefooter%>
<script type="text/javascript">//<![CDATA[
function backup_all_file(btn)
{
btn.value = '<%:Backup%>';
btn.disabled = true;
window.location.href='<%="backup"%>';
btn.disabled = false;
return false;
};
//]]></script>

View File

@ -1178,6 +1178,9 @@ msgstr "GEOIPBy MaxMind数据库日期"
msgid "No Backup"
msgstr "暂未备份"
msgid "Backup"
msgstr "备份"
msgid "<Limited State>"
msgstr "<受限状态>"

View File

@ -1002,6 +1002,19 @@ write_run_quick()
fi
}
custom_rule_provider()
{
local section="$1"
local enabled
config_get_bool "enabled" "$section" "enabled" "1"
if [ "$enabled" = "0" ]; then
return
else
config_set_custom_rule_provider=1
fi
}
#运行模式处理
do_run_mode()
{
@ -1081,7 +1094,16 @@ do_run_file()
config_foreach yml_other_rules_get "other_rules" "$CONFIG_NAME"
fi
if [ "$proxy_mode" = "script" ] || [ "$rule_name" = "ConnersHua" ] || [ "$rule_name" = "lhie1" ] || [ -n "$(ruby_read "$RAW_CONFIG_FILE" "['rules'].grep(/(^RULE-SET,|^SCRIPT,)/)")" ] || [ -n "$(ruby_read "/etc/openclash/custom/openclash_custom_rules.list" "['rules'].grep(/(^RULE-SET,|^SCRIPT,)/)")" ] || [ -n "$(ruby_read "/etc/openclash/custom/openclash_custom_rules_2.list" "['rules'].grep(/(^RULE-SET,|^SCRIPT,)/)")" ]; then
config_load "openclash"
config_set_custom_rule_provider=0
for i in "rule_provider_config rule_providers game_config"; do
config_foreach custom_rule_provider "$i"
if [ "$config_set_custom_rule_provider" -eq 1 ]; then
break
fi
done 2>/dev/null
if [ "$proxy_mode" = "script" ] || [ "$config_set_custom_rule_provider" -eq 1 ] || [ "$rule_name" = "ConnersHua" ] || [ "$rule_name" = "lhie1" ] || [ -n "$(ruby_read "$RAW_CONFIG_FILE" "['rules'].grep(/(^RULE-SET,|^SCRIPT,)/)")" ] || [ -n "$(ruby_read "/etc/openclash/custom/openclash_custom_rules.list" "['rules'].grep(/(^RULE-SET,|^SCRIPT,)/)")" ] || [ -n "$(ruby_read "/etc/openclash/custom/openclash_custom_rules_2.list" "['rules'].grep(/(^RULE-SET,|^SCRIPT,)/)")" ]; then
if [ "$en_mode_tun" != "2" ]; then
rm -rf "/etc/openclash/clash"
ln -s "$tun_core_path" /etc/openclash/clash 2>/dev/null
@ -1977,7 +1999,7 @@ get_config()
disable_masq_cache=$(uci -q get openclash.config.disable_masq_cache)
log_level=$(uci -q get openclash.config.log_level)
intranet_allowed=$(uci -q get openclash.config.intranet_allowed)
enable_udp_proxy=$(uci -q get openclash.config.enable_udp_proxy)
enable_udp_proxy=$(uci -q get openclash.config.enable_udp_proxy || echo 1)
disable_udp_quic=$(uci -q get openclash.config.disable_udp_quic)
operation_mode=$(uci -q get openclash.config.operation_mode)
lan_ac_mode=$(uci -q get openclash.config.lan_ac_mode)

View File

@ -8,7 +8,7 @@ if pidof clash >/dev/null && [ -z "$(echo "$en_mode" |grep "redir-host")" ]; the
/usr/share/openclash/openclash_fake_filter.sh
if [ -s "/etc/openclash/servers_fake_filter.conf" ]; then
mkdir -p /tmp/dnsmasq.d
ln -s /etc/openclash/servers_fake_filter.conf /tmp/dnsmasq.d/dnsmasq_openclash.conf >/dev/null 2>&1
cp /etc/openclash/servers_fake_filter.conf /tmp/dnsmasq.d/dnsmasq_openclash.conf >/dev/null 2>&1
/etc/init.d/dnsmasq restart >/dev/null 2>&1
fi
echo "" >$START_LOG

View File

@ -54,7 +54,7 @@ if [ "$2" = "fake-ip" ]; then
fi
if [ -s "/tmp/openclash_servers_fake_filter.conf" ]; then
mkdir -p /tmp/dnsmasq.d
ln -s /tmp/openclash_servers_fake_filter.conf /tmp/dnsmasq.d/dnsmasq_openclash.conf
cp /tmp/openclash_servers_fake_filter.conf /tmp/dnsmasq.d/dnsmasq_openclash.conf
fi
fi

View File

@ -598,8 +598,12 @@ do
end
#ws-opts-headers:
if Value['proxies'][$count]['ws-opts'].key?('headers') then
ws_opts_headers = '${uci_set}ws_opts_headers=\"' + Value['proxies'][$count]['ws-opts']['headers'].to_s + '\"'
system '${uci_del}ws_opts_headers >/dev/null 2>&1'
Value['proxies'][$count]['ws-opts']['headers'].keys.each{
|v|
ws_opts_headers = '${uci_add}ws_opts_headers=\"' + v.to_s + ': '+ Value['proxies'][$count]['ws-opts']['headers'][v].to_s + '\"'
system(ws_opts_headers)
}
end
#max-early-data:
if Value['proxies'][$count]['ws-opts'].key?('max-early-data') then
@ -750,6 +754,7 @@ do
Thread.new{
#grpc-service-name
if Value['proxies'][$count].key?('grpc-opts') then
system '${uci_set}obfs_trojan=grpc'
if Value['proxies'][$count]['grpc-opts'].key?('grpc-service-name') then
grpc_service_name = '${uci_set}grpc_service_name=\"' + Value['proxies'][$count]['grpc-opts']['grpc-service-name'].to_s + '\"'
system(grpc_service_name)
@ -757,6 +762,26 @@ do
end
}.join
Thread.new{
if Value['proxies'][$count].key?('ws-opts') then
system '${uci_set}obfs_trojan=ws'
#trojan_ws_path
if Value['proxies'][$count]['ws-opts'].key?('path') then
trojan_ws_path = '${uci_set}trojan_ws_path=\"' + Value['proxies'][$count]['ws-opts']['path'].to_s + '\"'
system(trojan_ws_path)
end
#trojan_ws_headers
if Value['proxies'][$count]['ws-opts'].key?('headers') then
system '${uci_del}trojan_ws_headers >/dev/null 2>&1'
Value['proxies'][$count]['ws-opts']['headers'].keys.each{
|v|
trojan_ws_headers = '${uci_add}trojan_ws_headers=\"' + v.to_s + ': '+ Value['proxies'][$count]['ws-opts']['headers'][v].to_s + '\"'
system(trojan_ws_headers)
}
end
end
}.join
Thread.new{
#skip-cert-verify
if Value['proxies'][$count].key?('skip-cert-verify') then

View File

@ -166,6 +166,16 @@ cat >> "$SERVER_FILE" <<-EOF
EOF
}
set_ws_headers()
{
if [ -z "$1" ]; then
return
fi
cat >> "$SERVER_FILE" <<-EOF
'$1'
EOF
}
#写入服务器节点到配置文件
yml_servers_set()
{
@ -186,6 +196,7 @@ yml_servers_set()
config_get "obfs_ssr" "$section" "obfs_ssr" ""
config_get "obfs_param" "$section" "obfs_param" ""
config_get "obfs_vmess" "$section" "obfs_vmess" ""
config_get "obfs_trojan" "$section" "obfs_trojan" ""
config_get "protocol" "$section" "protocol" ""
config_get "protocol_param" "$section" "protocol_param" ""
config_get "host" "$section" "host" ""
@ -212,6 +223,8 @@ yml_servers_set()
config_get "ws_opts_headers" "$section" "ws_opts_headers" ""
config_get "max_early_data" "$section" "max_early_data" ""
config_get "early_data_header_name" "$section" "early_data_header_name" ""
config_get "trojan_ws_path" "$section" "trojan_ws_path" ""
config_get "trojan_ws_headers" "$section" "trojan_ws_headers" ""
if [ "$enabled" = "0" ]; then
return
@ -438,13 +451,30 @@ EOF
if [ -n "$ws_opts_path" ] || [ -n "$ws_opts_headers" ] || [ -n "$max_early_data" ] || [ -n "$early_data_header_name" ]; then
cat >> "$SERVER_FILE" <<-EOF
ws-opts:
EOF
if [ -n "$ws_opts_path" ]; then
cat >> "$SERVER_FILE" <<-EOF
path: "$ws_opts_path"
headers: "$ws_opts_headers"
EOF
fi
if [ -n "$ws_opts_headers" ]; then
cat >> "$SERVER_FILE" <<-EOF
headers:
EOF
config_list_foreach "$section" "ws_opts_headers" set_ws_headers
fi
if [ -n "$max_early_data" ]; then
cat >> "$SERVER_FILE" <<-EOF
max-early-data: $max_early_data
EOF
fi
if [ -n "$early_data_header_name" ]; then
cat >> "$SERVER_FILE" <<-EOF
early-data-header-name: "$early_data_header_name"
EOF
fi
fi
fi
if [ "$obfs_vmess" = "network: http" ]; then
if [ ! -z "$http_path" ]; then
cat >> "$SERVER_FILE" <<-EOF
@ -592,6 +622,24 @@ cat >> "$SERVER_FILE" <<-EOF
grpc-service-name: "$grpc_service_name"
EOF
fi
if [ "$obfs_trojan" = "ws" ]; then
if [ -n "$trojan_ws_path" ] || [ -n "$trojan_ws_headers" ]; then
cat >> "$SERVER_FILE" <<-EOF
ws-opts:
EOF
fi
if [ -n "$trojan_ws_path" ]; then
cat >> "$SERVER_FILE" <<-EOF
path: "$trojan_ws_path"
EOF
fi
if [ -n "$trojan_ws_headers" ]; then
cat >> "$SERVER_FILE" <<-EOF
headers:
EOF
config_list_foreach "$section" "trojan_ws_headers" set_ws_headers
fi
fi
fi
#snell