mirror of
https://github.com/kenzok8/small-package
synced 2025-01-08 13:27:36 +08:00
update 2023-02-26 16:23:01
This commit is contained in:
parent
c013391e20
commit
cf14da5905
@ -173,8 +173,10 @@ return baseclass.extend({
|
||||
var label = uci.get(uciconfig, ucisection, 'label');
|
||||
if (label)
|
||||
return label;
|
||||
else
|
||||
else {
|
||||
uci.set(uciconfig, ucisection, 'label', ucisection);
|
||||
return ucisection;
|
||||
}
|
||||
},
|
||||
|
||||
loadModalTitle: function(title, addtitle, uciconfig, ucisection) {
|
||||
|
@ -127,8 +127,8 @@ return view.extend({
|
||||
var proxy_nodes = {};
|
||||
uci.sections(data[0], 'node', (res) => {
|
||||
proxy_nodes[res['.name']] =
|
||||
String.format('[%s] %s', res.type, res.label || (stubValidator.apply('ip6addr', res.address || '') ?
|
||||
`[${res.address}]` : res.address) + ':' + res.port);
|
||||
String.format('[%s] %s', res.type, res.label || (stubValidator.apply('ip6addr', res.address || '') ?
|
||||
String.format('[%s]', res.address) : res.address) + ':' + res.port);
|
||||
});
|
||||
|
||||
s = m.section(form.NamedSection, 'config', 'homeproxy');
|
||||
@ -848,14 +848,6 @@ return view.extend({
|
||||
so.default = 'disabled';
|
||||
so.rmempty = false;
|
||||
|
||||
so = ss.taboption('lan_ip_policy', form.DynamicList, 'lan_direct_mac_addrs', _('Direct MAC addresses'));
|
||||
so.datatype = 'macaddr';
|
||||
so.depends('lan_proxy_mode', 'except_listed');
|
||||
Object.keys(hosts).forEach(function(mac) {
|
||||
var hint = hosts[mac].name || L.toArray(hosts[mac].ipaddrs || hosts[mac].ipv4)[0];
|
||||
so.value(mac, hint ? '%s (%s)'.format(mac, hint) : mac);
|
||||
});
|
||||
|
||||
so = ss.taboption('lan_ip_policy', form.DynamicList, 'lan_direct_ipv4_ips', _('Direct IPv4 IP-s'));
|
||||
so.datatype = 'or(ip4addr, cidr4)';
|
||||
so.depends('lan_proxy_mode', 'except_listed');
|
||||
@ -871,14 +863,6 @@ return view.extend({
|
||||
});
|
||||
so.depends('homeproxy.config.ipv6_support', '1');
|
||||
|
||||
so = ss.taboption('lan_ip_policy', form.DynamicList, 'lan_proxy_mac_addrs', _('Proxy MAC addresses'));
|
||||
so.datatype = 'macaddr';
|
||||
so.depends('lan_proxy_mode', 'listed_only');
|
||||
Object.keys(hosts).forEach(function(mac) {
|
||||
var hint = hosts[mac].name || L.toArray(hosts[mac].ipaddrs || hosts[mac].ipv4)[0];
|
||||
so.value(mac, hint ? '%s (%s)'.format(mac, hint) : mac);
|
||||
});
|
||||
|
||||
so = ss.taboption('lan_ip_policy', form.DynamicList, 'lan_proxy_ipv4_ips', _('Proxy IPv4 IP-s'));
|
||||
so.datatype = 'or(ip4addr, cidr4)';
|
||||
so.depends('lan_proxy_mode', 'listed_only');
|
||||
@ -894,13 +878,6 @@ return view.extend({
|
||||
});
|
||||
so.depends('homeproxy.config.ipv6_support', '1');
|
||||
|
||||
so = ss.taboption('lan_ip_policy', form.DynamicList, 'lan_gaming_mode_mac_addrs', _('Gaming mode MAC addresses'));
|
||||
so.datatype = 'macaddr';
|
||||
Object.keys(hosts).forEach(function(mac) {
|
||||
var hint = hosts[mac].name || L.toArray(hosts[mac].ipaddrs || hosts[mac].ipv4)[0];
|
||||
so.value(mac, hint ? '%s (%s)'.format(mac, hint) : mac);
|
||||
});
|
||||
|
||||
so = ss.taboption('lan_ip_policy', form.DynamicList, 'lan_gaming_mode_ipv4_ips', _('Gaming mode IPv4 IP-s'));
|
||||
so.datatype = 'or(ip4addr, cidr4)';
|
||||
L.sortedKeys(ipaddrs, null, 'addr').forEach(function(ipv4) {
|
||||
|
@ -849,7 +849,6 @@ return view.extend({
|
||||
so.depends('type', 'shadowsocks');
|
||||
so.depends('type', 'trojan');
|
||||
so.depends('type', 'vmess');
|
||||
so.rmempty = false;
|
||||
so.modalonly = true;
|
||||
|
||||
so = ss.option(form.ListValue, 'multiplex_protocol', _('Protocol'),
|
||||
|
@ -162,15 +162,6 @@ set homeproxy_mainland_addr_v6 {
|
||||
|
||||
{# LAN ACL addresses #}
|
||||
{% if (control_info.lan_proxy_mode === 'listed_only'): %}
|
||||
set homeproxy_lan_proxy_addr_mac {
|
||||
type ether_addr
|
||||
flags interval
|
||||
auto-merge
|
||||
{% if (control_info.lan_proxy_mac_addrs): %}
|
||||
elements = { {{ join(', ', control_info.lan_proxy_mac_addrs) }} }
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
set homeproxy_lan_proxy_addr_v4 {
|
||||
type ipv4_addr
|
||||
flags interval
|
||||
@ -191,15 +182,6 @@ set homeproxy_lan_proxy_addr_v6 {
|
||||
{% endif /* ipv6_support */ %}
|
||||
}
|
||||
{% elif (control_info.lan_proxy_mode === 'except_listed'): %}
|
||||
set homeproxy_lan_direct_addr_mac {
|
||||
type ether_addr
|
||||
flags interval
|
||||
auto-merge
|
||||
{% if (control_info.lan_direct_mac_addrs): %}
|
||||
elements = { {{ join(', ', control_info.lan_direct_mac_addrs) }} }
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
set homeproxy_lan_direct_addr_v4 {
|
||||
type ipv4_addr
|
||||
flags interval
|
||||
@ -221,15 +203,6 @@ set homeproxy_lan_direct_addr_v6 {
|
||||
{% endif /* ipv6_support */ %}
|
||||
{% endif /* lan_proxy_mode */ %}
|
||||
|
||||
set homeproxy_lan_gaming_addr_mac {
|
||||
type ether_addr
|
||||
flags interval
|
||||
auto-merge
|
||||
{% if (control_info.lan_gaming_mode_mac_addrs): %}
|
||||
elements = { {{ join(', ', control_info.lan_gaming_mode_mac_addrs) }} }
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
set homeproxy_lan_gaming_addr_v4 {
|
||||
type ipv4_addr
|
||||
flags interval
|
||||
@ -339,13 +312,11 @@ chain homeproxy_redirect {
|
||||
meta mark {{ self_mark }} counter return
|
||||
|
||||
{% if (control_info.lan_proxy_mode === 'listed_only'): %}
|
||||
ether saddr != @homeproxy_lan_proxy_addr_mac counter return
|
||||
ip saddr != @homeproxy_lan_proxy_addr_v4 counter return
|
||||
{% if (ipv6_support === '1'): %}
|
||||
ip6 saddr != @homeproxy_lan_proxy_addr_v6 counter return
|
||||
{% endif /* ipv6_support */ %}
|
||||
{% elif (control_info.lan_proxy_mode === 'except_listed'): %}
|
||||
ether saddr @homeproxy_lan_direct_addr_mac counter return
|
||||
ip saddr @homeproxy_lan_direct_addr_v4 counter return
|
||||
{% if (ipv6_support === '1'): %}
|
||||
ip6 saddr @homeproxy_lan_direct_addr_v6 counter return
|
||||
@ -391,7 +362,6 @@ chain homeproxy_redirect {
|
||||
{% endif /* ipv6_support */ %}
|
||||
{% endif /* routing_mode */ %}
|
||||
|
||||
ether saddr @homeproxy_lan_gaming_addr_mac counter goto homeproxy_redirect_proxy
|
||||
ip saddr @homeproxy_lan_gaming_addr_v4 counter goto homeproxy_redirect_proxy
|
||||
{% if (ipv6_support === '1'): %}
|
||||
ip6 saddr @homeproxy_lan_gaming_addr_v6 counter goto homeproxy_redirect_proxy
|
||||
@ -449,13 +419,11 @@ chain homeproxy_mangle_prerouting {
|
||||
meta mark {{ self_mark }} counter return
|
||||
|
||||
{% if (control_info.lan_proxy_mode === 'listed_only'): %}
|
||||
ether saddr != @homeproxy_lan_proxy_addr_mac counter return
|
||||
ip saddr != @homeproxy_lan_proxy_addr_v4 counter return
|
||||
{% if (ipv6_support === '1'): %}
|
||||
ip6 saddr != @homeproxy_lan_proxy_addr_v6 counter return
|
||||
{% endif /* ipv6_support */ %}
|
||||
{% elif (control_info.lan_proxy_mode === 'except_listed'): %}
|
||||
ether saddr @homeproxy_lan_direct_addr_mac counter return
|
||||
ip saddr @homeproxy_lan_direct_addr_v4 counter return
|
||||
{% if (ipv6_support === '1'): %}
|
||||
ip6 saddr @homeproxy_lan_direct_addr_v6 counter return
|
||||
@ -505,7 +473,6 @@ chain homeproxy_mangle_prerouting {
|
||||
{% endif /* ipv6_support */ %}
|
||||
{% endif /* routing_mode */ %}
|
||||
|
||||
ether saddr @homeproxy_lan_gaming_addr_mac counter goto homeproxy_mangle_tproxy
|
||||
ip saddr @homeproxy_lan_gaming_addr_v4 counter goto homeproxy_mangle_tproxy
|
||||
{% if (ipv6_support === '1'): %}
|
||||
ip6 saddr @homeproxy_lan_gaming_addr_v6 counter goto homeproxy_mangle_tproxy
|
||||
@ -585,13 +552,11 @@ chain homeproxy_mangle_tun {
|
||||
iifname {{ tun_name }} counter return
|
||||
|
||||
{% if (control_info.lan_proxy_mode === 'listed_only'): %}
|
||||
ether saddr != @homeproxy_lan_proxy_addr_mac counter return
|
||||
ip saddr != @homeproxy_lan_proxy_addr_v4 counter return
|
||||
{% if (ipv6_support === '1'): %}
|
||||
ip6 saddr != @homeproxy_lan_proxy_addr_v6 counter return
|
||||
{% endif /* ipv6_support */ %}
|
||||
{% elif (control_info.lan_proxy_mode === 'except_listed'): %}
|
||||
ether saddr @homeproxy_lan_direct_addr_mac counter return
|
||||
ip saddr @homeproxy_lan_direct_addr_v4 counter return
|
||||
{% if (ipv6_support === '1'): %}
|
||||
ip6 saddr @homeproxy_lan_direct_addr_v6 counter return
|
||||
@ -643,7 +608,6 @@ chain homeproxy_mangle_tun {
|
||||
{% endif /* ipv6_support */ %}
|
||||
{% endif /* routing_mode */ %}
|
||||
|
||||
ether saddr @homeproxy_lan_gaming_addr_mac counter mark set {{ tun_mark }}
|
||||
ip saddr @homeproxy_lan_gaming_addr_v4 counter mark set {{ tun_mark }}
|
||||
{% if (ipv6_support === '1'): %}
|
||||
ip6 saddr @homeproxy_lan_gaming_addr_v6 counter mark set {{ tun_mark }}
|
||||
|
@ -601,11 +601,27 @@ if (!isEmpty(main_node) || !isEmpty(default_outbound))
|
||||
|
||||
if (!isEmpty(main_node)) {
|
||||
/* Routing rules */
|
||||
/* LAN ACL */
|
||||
if (length(lan_proxy_ips)) {
|
||||
push(config.route.rules, {
|
||||
source_ip_cidr: lan_proxy_ips,
|
||||
network: dedicated_udp_node ? 'tcp' : null,
|
||||
outbound: 'main-out'
|
||||
});
|
||||
|
||||
if (dedicated_udp_node) {
|
||||
push(config.route.rules, {
|
||||
source_ip_cidr: lan_proxy_ips,
|
||||
network: 'udp',
|
||||
outbound: 'main-udp-out'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/* Proxy list */
|
||||
if (length(proxy_domain_list) || length(lan_proxy_ips) || length(wan_proxy_ips)) {
|
||||
if (length(proxy_domain_list) || length(wan_proxy_ips)) {
|
||||
push(config.route.rules, {
|
||||
domain_keyword: proxy_domain_list,
|
||||
source_ip_cidr: lan_proxy_ips,
|
||||
ip_cidr: wan_proxy_ips,
|
||||
network: dedicated_udp_node ? 'tcp' : null,
|
||||
outbound: 'main-out'
|
||||
@ -614,7 +630,6 @@ if (!isEmpty(main_node)) {
|
||||
if (dedicated_udp_node) {
|
||||
push(config.route.rules, {
|
||||
domain_keyword: proxy_domain_list,
|
||||
source_ip_cidr: lan_proxy_ips,
|
||||
ip_cidr: wan_proxy_ips,
|
||||
network: 'udp',
|
||||
outbound: 'main-udp-out'
|
||||
|
@ -203,14 +203,13 @@ stop_service() {
|
||||
for i in "homeproxy_local_addr_v4" "homeproxy_local_addr_v6" \
|
||||
"homeproxy_gfw_list_v4" "homeproxy_gfw_list_v6" \
|
||||
"homeproxy_mainland_addr_v4" "homeproxy_mainland_addr_v6" \
|
||||
"homeproxy_lan_proxy_addr_mac" "homeproxy_lan_proxy_addr_v4" \
|
||||
"homeproxy_lan_proxy_addr_v6" "homeproxy_lan_direct_addr_mac" \
|
||||
"homeproxy_lan_proxy_addr_v4" "homeproxy_lan_proxy_addr_v6" \
|
||||
"homeproxy_lan_direct_addr_v4" "homeproxy_lan_direct_addr_v6" \
|
||||
"homeproxy_lan_gaming_addr_mac" "homeproxy_lan_gaming_addr_v4" \
|
||||
"homeproxy_lan_gaming_addr_v6" "homeproxy_lan_global_proxy_addr_v4" \
|
||||
"homeproxy_lan_global_proxy_addr_v6" "homeproxy_wan_proxy_addr_v4" \
|
||||
"homeproxy_wan_proxy_addr_v6" "homeproxy_wan_direct_addr_v4" \
|
||||
"homeproxy_wan_direct_addr_v6" "homeproxy_routing_port"; do
|
||||
"homeproxy_lan_gaming_addr_v4" "homeproxy_lan_gaming_addr_v6" \
|
||||
"homeproxy_lan_global_proxy_addr_v4" "homeproxy_lan_global_proxy_addr_v6" \
|
||||
"homeproxy_wan_proxy_addr_v4" "homeproxy_wan_proxy_addr_v6" \
|
||||
"homeproxy_wan_direct_addr_v4" "homeproxy_wan_direct_addr_v6" \
|
||||
"homeproxy_routing_port"; do
|
||||
nft flush set inet fw4 "$i"
|
||||
nft delete set inet fw4 "$i"
|
||||
done 2>"/dev/null"
|
||||
|
Loading…
Reference in New Issue
Block a user