Skip to content

Commit

Permalink
chore: meta sniffer conf change
Browse files Browse the repository at this point in the history
  • Loading branch information
vernesong committed Jan 23, 2023
1 parent 366bdc3 commit b2b528f
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 39 deletions.
2 changes: 1 addition & 1 deletion luci-app-openclash/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ define Build/Prepare
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_custom_netflix_domains.list" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_custom_netflix_domains.list" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_force_sniffing_domain.yaml" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_force_sniffing_domain.yaml" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_sniffing_domain_filter.yaml" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_sniffing_domain_filter.yaml" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_sniffing_port_filter.yaml" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_sniffing_port_filter.yaml" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_sniffing_ports_filter.yaml" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_sniffing_ports_filter.yaml" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_custom_localnetwork_ipv4.list" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_custom_localnetwork_ipv4.list" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_custom_localnetwork_ipv6.list" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_custom_localnetwork_ipv6.list" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_custom_chnroute_pass.list" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_custom_chnroute_pass.list" >/dev/null 2>&1
Expand Down
6 changes: 3 additions & 3 deletions luci-app-openclash/luasrc/model/cbi/openclash/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -450,14 +450,14 @@ sniffing_port_filter.rows = 20
sniffing_port_filter.wrap = "off"

function sniffing_port_filter.cfgvalue(self, section)
return NXFS.readfile("/etc/openclash/custom/openclash_sniffing_port_filter.yaml") or ""
return NXFS.readfile("/etc/openclash/custom/openclash_sniffing_ports_filter.yaml") or ""
end
function sniffing_port_filter.write(self, section, value)
if value then
value = value:gsub("\r\n?", "\n")
local old_value = NXFS.readfile("/etc/openclash/custom/openclash_sniffing_port_filter.yaml")
local old_value = NXFS.readfile("/etc/openclash/custom/openclash_sniffing_ports_filter.yaml")
if value ~= old_value then
NXFS.writefile("/etc/openclash/custom/openclash_sniffing_port_filter.yaml", value)
NXFS.writefile("/etc/openclash/custom/openclash_sniffing_ports_filter.yaml", value)
end
end
end
Expand Down
10 changes: 5 additions & 5 deletions luci-app-openclash/po/zh-cn/openclash.zh-cn.po
Original file line number Diff line number Diff line change
Expand Up @@ -2990,13 +2990,13 @@ msgid "Sniffing Ports Filter"
msgstr "指定探测(嗅探)的端口列表"

msgid "Will Override Dns Queries If Domains in The List"
msgstr "仅列表中的域名将会使用探测(嗅探)的结果进行连接"
msgstr "列表中的域名将会强制进行探测(嗅探)"

msgid "Will Disable Sniffing If Domains(sni) in The List"
msgstr "仅列表中的域名(sni)不会使用探测(嗅探)的结果进行连接"
msgstr "列表中的域名(sni)不会进行探测(嗅探)"

msgid "Will Only Sniffing If Ports in The List"
msgstr "仅列表中的端口将会使用探测(嗅探)的结果进行连接"
msgstr "仅探测(嗅探)列表中指定的协议端口"

msgid "Custom Sniffer Settings"
msgstr "自定义流量探测(嗅探)设置"
Expand Down Expand Up @@ -3262,5 +3262,5 @@ msgstr "存在于防火墙规则设置"
msgid "auto bypassing may cause the normal connection of the client not to reach the core, if necessary, please add your own in the access control!"
msgstr "自动绕过后可能造成客户端的正常连接无法到达内核,如有需要,请在访问控制中自行添加!"

msgid "Tip: Start Add Port Bypassing Rules..."
msgstr "提示:开始添加端口绕过规则..."
msgid "Tip: Start Add Port Bypassing Rules For Firewall Redirect and Firewall Rules..."
msgstr "提示:正在根据防火墙端口转发和防火墙通信规则添加端口绕过规则..."
2 changes: 1 addition & 1 deletion luci-app-openclash/root/etc/init.d/openclash
Original file line number Diff line number Diff line change
Expand Up @@ -2503,7 +2503,7 @@ else
fi

#端口转发
LOG_OUT "Tip: Start Add Port Bypassing Rules..."
LOG_OUT "Tip: Start Add Port Bypassing Rules For Firewall Redirect and Firewall Rules..."
config_load "firewall"
config_foreach firewall_redirect_exclude "redirect"
config_foreach firewall_rule_exclude "rule"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
sniff:
# TLS 默认如果不配置 ports 默认嗅探 443
TLS:
# ports: [443, 8443]

# 默认嗅探 80
HTTP:
# 需要嗅探的端口

ports: [80, 8080-8880]
# 是否使用嗅探结果作为实际访问
override-destination: true
2 changes: 1 addition & 1 deletion luci-app-openclash/root/etc/uci-defaults/luci-openclash
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ cp -f "/etc/openclash/custom/openclash_custom_fallback_filter.yaml" "/usr/share/
cp -f "/etc/openclash/custom/openclash_custom_netflix_domains.list" "/usr/share/openclash/backup/openclash_custom_netflix_domains.list" >/dev/null 2>&1
cp -f "/etc/openclash/custom/openclash_force_sniffing_domain.yaml" "/usr/share/openclash/backup/openclash_force_sniffing_domain.yaml" >/dev/null 2>&1
cp -f "/etc/openclash/custom/openclash_sniffing_domain_filter.yaml" "/usr/share/openclash/backup/openclash_sniffing_domain_filter.yaml" >/dev/null 2>&1
cp -f "/etc/openclash/custom/openclash_sniffing_port_filter.yaml" "/usr/share/openclash/backup/openclash_sniffing_port_filter.yaml" >/dev/null 2>&1
cp -f "/etc/openclash/custom/openclash_sniffing_ports_filter.yaml" "/usr/share/openclash/backup/openclash_sniffing_ports_filter.yaml" >/dev/null 2>&1
cp -f "/etc/openclash/custom/openclash_custom_localnetwork_ipv4.list" "/usr/share/openclash/backup/openclash_custom_localnetwork_ipv4.list" >/dev/null 2>&1
cp -f "/etc/openclash/custom/openclash_custom_localnetwork_ipv6.list" "/usr/share/openclash/backup/openclash_custom_localnetwork_ipv6.list" >/dev/null 2>&1
cp -f "/etc/openclash/custom/openclash_custom_chnroute_pass.list" "/usr/share/openclash/backup/openclash_custom_chnroute_pass.list" >/dev/null 2>&1
Expand Down
76 changes: 52 additions & 24 deletions luci-app-openclash/root/usr/share/openclash/yml_change.sh
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,6 @@ Thread.new{
if ${20} == 1 and ${21} == 1 then
Value_sniffer={'sniffer'=>{'enable'=>true}};
Value['sniffer']=Value_sniffer['sniffer'];
Value_sniffer={'sniffing'=>['tls','http']};
Value['sniffer'].merge!(Value_sniffer);
if '$1' == 'redir-host' then
Value['sniffer']['ForceDnsMapping']=true;
else
Expand All @@ -429,30 +427,60 @@ Thread.new{
else
Value['sniffer']['ParsePureIp']=false;
end;
if File::exist?('/etc/openclash/custom/openclash_force_sniffing_domain.yaml') and ${24} == 1 then
Value_7 = YAML.load_file('/etc/openclash/custom/openclash_force_sniffing_domain.yaml');
if Value_7 != false and not Value_7['force-domain'].to_a.empty? then
Value['sniffer']['force-domain']=Value_7['force-domain'];
Value['sniffer']['force-domain']=Value['sniffer']['force-domain'].uniq;
end
if File::exist?('/etc/openclash/custom/openclash_force_sniffing_domain.yaml') then
if ${24} == 1 then
Value_7 = YAML.load_file('/etc/openclash/custom/openclash_force_sniffing_domain.yaml');
if Value_7 != false and not Value_7['force-domain'].to_a.empty? then
Value['sniffer']['force-domain']=Value_7['force-domain'];
Value['sniffer']['force-domain']=Value['sniffer']['force-domain'].uniq;
end;
else
if not Value['sniffer'].key?('force-domain') then
Value_force_domain={'force-domain'=>['+.netflix.com', '+.nflxvideo.net', '+.amazonaws.com', '+.media.dssott.com']};
Value['sniffer'].merge!(Value_force_domain);
end;
end;
end;
if File::exist?('/etc/openclash/custom/openclash_sniffing_domain_filter.yaml') and ${24} == 1 then
Value_7 = YAML.load_file('/etc/openclash/custom/openclash_sniffing_domain_filter.yaml');
if Value_7 != false and not Value_7['skip-sni'].to_a.empty? then
Value['sniffer']['skip-domain']=Value_7['skip-sni'];
Value['sniffer']['skip-domain']=Value['sniffer']['skip-domain'].uniq;
end
if Value_7 != false and not Value_7['skip-domain'].to_a.empty? then
Value['sniffer']['skip-domain']=Value_7['skip-domain'];
Value['sniffer']['skip-domain']=Value['sniffer']['skip-domain'].uniq;
end
if File::exist?('/etc/openclash/custom/openclash_sniffing_domain_filter.yaml') then
if ${24} == 1 then
Value_7 = YAML.load_file('/etc/openclash/custom/openclash_sniffing_domain_filter.yaml');
if Value_7 != false and not Value_7['skip-sni'].to_a.empty? then
Value['sniffer']['skip-domain']=Value_7['skip-sni'];
Value['sniffer']['skip-domain']=Value['sniffer']['skip-domain'].uniq;
end;
if Value_7 != false and not Value_7['skip-domain'].to_a.empty? then
Value['sniffer']['skip-domain']=Value_7['skip-domain'];
Value['sniffer']['skip-domain']=Value['sniffer']['skip-domain'].uniq;
end;
else
if not Value['sniffer'].key?('skip-domain') then
Value_skip_domain={'skip-domain'=>['+.apple.com', 'Mijia Cloud', '+.jd.com']};
Value['sniffer'].merge!(Value_skip_domain);
end;
end;
end;
if File::exist?('/etc/openclash/custom/openclash_sniffing_port_filter.yaml') and ${24} == 1 then
Value_7 = YAML.load_file('/etc/openclash/custom/openclash_sniffing_port_filter.yaml');
if Value_7 != false and not Value_7['port-whitelist'].to_a.empty? then
Value['sniffer']['port-whitelist']=Value_7['port-whitelist'];
Value['sniffer']['port-whitelist']=Value['sniffer']['port-whitelist'].uniq;
end
if File::exist?('/etc/openclash/custom/openclash_sniffing_ports_filter.yaml') then
if ${24} == 1 then
Value_7 = YAML.load_file('/etc/openclash/custom/openclash_sniffing_ports_filter.yaml');
if Value_7 != false and not Value_7['sniff'].to_a.empty? then
Value['sniffer']['sniff']=Value_7['sniff'];
end;
else
if not Value['sniffer'].key?('sniff') then
Value_sniff={'sniff'=>{'TLS'=>nil, 'HTTP'=>{'ports'=>[80, '8080-8880'], 'override-destination'=>true}}};
Value['sniffer'].merge!(Value_sniff);
end;
end;
else
if File::exist?('/etc/openclash/custom/openclash_sniffing_port_filter.yaml') and ${24} == 1 then
Value_7 = YAML.load_file('/etc/openclash/custom/openclash_sniffing_port_filter.yaml');
if Value_7 != false and not Value_7['port-whitelist'].to_a.empty? then
Value['sniffer']['port-whitelist']=Value_7['port-whitelist'];
Value['sniffer']['port-whitelist']=Value['sniffer']['port-whitelist'].uniq;
end;
end;
Value_sniffer={'sniffing'=>['tls','http']};
Value['sniffer'].merge!(Value_sniffer);
end;
else
if Value.key?('sniffer') then
Expand Down

0 comments on commit b2b528f

Please sign in to comment.