mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-02 18:13:56 +08:00
⛄ Sync 2026-11-01 05:43:29
This commit is contained in:
1 parent
fae68afc83
commit
d1e51134a0
187 files changed
+3752
-2114
No files matched your search
@@ -16,7 +16,7 @@ config global
|
||||
dns.google.com 8.8.8.8'
|
||||
option log_node '1'
|
||||
option loglevel 'error'
|
||||
|
||||
|
||||
config global_haproxy
|
||||
option balancing_enable '0'
|
||||
|
||||
@@ -53,7 +53,7 @@ config global_app
|
||||
|
||||
config global_subscribe
|
||||
option filter_keyword_mode '1'
|
||||
|
||||
|
||||
config global_singbox
|
||||
|
||||
config nodes 'examplenode'
|
||||
|
||||
@@ -781,7 +781,7 @@ run_ipset_chinadns_ng() {
|
||||
node_servers=$(uci show "${CONFIG}" | grep -E "(.address=|.download_address=)" | cut -d "'" -f 2)
|
||||
hosts_foreach "node_servers" host_from_url | grep '[a-zA-Z]$' | sort -u | grep -v "engage.cloudflareclient.com" > $TMP_ACL_PATH/vpslist
|
||||
}
|
||||
|
||||
|
||||
[ -n "${ipset}" ] && {
|
||||
set_names=$ipset
|
||||
vps_set_names="psw2_vps,psw2_vps6"
|
||||
|
||||
@@ -213,7 +213,7 @@ function acl_app(l)
|
||||
add_args(run_args, "config_file", config_file)
|
||||
add_args(run_args, "loglevel", v.loglevel)
|
||||
add_args(run_args, "log_file", log_file)
|
||||
|
||||
|
||||
local out = io.open(api.TMP_ACL_PATH .. "/acl_node_" .. flag , "a")
|
||||
out:write(table.concat(run_args, " "))
|
||||
out:close()
|
||||
|
||||
@@ -120,9 +120,9 @@ function copy_instance(var)
|
||||
local TMP_DNSMASQ_PATH = var["TMP_DNSMASQ_PATH"]
|
||||
local conf_lines = {}
|
||||
local DEFAULT_DNSMASQ_CFGID = sys.exec("echo -n $(uci -q show dhcp.@dnsmasq[0] | awk 'NR==1 {split($0, conf, /[.=]/); print conf[2]}')")
|
||||
|
||||
|
||||
local conf_file = "/var/etc/dnsmasq.conf." .. DEFAULT_DNSMASQ_CFGID
|
||||
|
||||
|
||||
local retry = 5
|
||||
while not fs.access(conf_file) and retry > 0 do
|
||||
api.nixio.nanosleep(1, 0)
|
||||
|
||||
@@ -291,7 +291,7 @@ load_acl() {
|
||||
}
|
||||
|
||||
local comment_l="$(i18n "Local")"
|
||||
|
||||
|
||||
if [ -n "$node" ] && ([ -z "$no_tcp_local_proxy" ] || [ -z "$no_udp_local_proxy" ]); then
|
||||
[ -n "$dns_redirect_port" ] && {
|
||||
#$ipt_m -A PSW2_OUTPUT $(comment "${comment_l}") -p udp --dport 53 -j ACCEPT
|
||||
@@ -390,7 +390,7 @@ load_acl() {
|
||||
|
||||
$ipt_m -I OUTPUT $(comment "mangle-OUTPUT-PSW2") -o lo -j RETURN
|
||||
insert_rule_before "$ipt_m" "OUTPUT" "mwan3" "$(comment mangle-OUTPUT-PSW2) -m mark --mark ${FWMARK} -j RETURN"
|
||||
|
||||
|
||||
$ip6t_m -I OUTPUT $(comment "mangle-OUTPUT-PSW2") -o lo -j RETURN
|
||||
insert_rule_before "$ip6t_m" "OUTPUT" "mwan3" "$(comment mangle-OUTPUT-PSW2) -m mark --mark ${FWMARK} -j RETURN"
|
||||
|
||||
@@ -463,7 +463,7 @@ load_acl() {
|
||||
log 2 "${msg}$(i18n "not proxy all %s" "TCP")"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
[ -n "$udp_no_redir_ports" ] && {
|
||||
if ! has_1_65535 "$udp_no_redir_ports"; then
|
||||
[ "$_ipv4" != "1" ] && add_port_rules "$ip6t_m -A PSW2 $(comment "$remarks") ${_ipt_source} -p udp" $udp_no_redir_ports "-j RETURN" 2>/dev/null
|
||||
@@ -475,7 +475,7 @@ load_acl() {
|
||||
log 2 "${msg}$(i18n "not proxy all %s" "UDP")"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
if ([ -z "$no_tcp_proxy" ] || [ -z "$no_udp_proxy" ]) && [ -n "$dns_redirect_port" ]; then
|
||||
$ipt_m -A PSW2 $(comment "$remarks") -p udp ${_ipt_source} --dport 53 -j ACCEPT
|
||||
$ipt_m -A PSW2 $(comment "$remarks") -p tcp ${_ipt_source} --dport 53 -j ACCEPT
|
||||
@@ -508,7 +508,7 @@ load_acl() {
|
||||
add_shunt_t_rule "${shunt_list4}" "$ipt_n -A PSW2 $(comment "$remarks") -p icmp ${_ipt_source}" "$(REDIRECT)"
|
||||
$ipt_n -A PSW2 $(comment "$remarks") -p icmp ${_ipt_source} $(REDIRECT)
|
||||
}
|
||||
|
||||
|
||||
[ "$accept_icmpv6" = "1" ] && [ "$PROXY_IPV6" == "1" ] && {
|
||||
$ip6t_n -A PSW2 $(comment "$remarks") -p ipv6-icmp ${_ipt_source} -d $FAKE_IP_6 $(REDIRECT) 2>/dev/null
|
||||
add_shunt_t_rule "${shunt_list6}" "$ip6t_n -A PSW2 $(comment "$remarks") -p ipv6-icmp ${_ipt_source}" "$(REDIRECT)" 2>/dev/null
|
||||
@@ -650,12 +650,12 @@ update_wan_sets() {
|
||||
|
||||
add_firewall_rule() {
|
||||
log_i18n 0 "Starting to load %s firewall rules..." "iptables"
|
||||
|
||||
|
||||
ipset -! create $IPSET_LOCAL nethash maxelem 1048576
|
||||
ipset -! create $IPSET_DIRECT nethash maxelem 1048576
|
||||
ipset -! create $IPSET_VPS iphash maxelem 1048576
|
||||
ipset -! create $IPSET_WAN nethash maxelem 1048576
|
||||
|
||||
|
||||
ipset -! create $IPSET_LOCAL6 nethash family inet6 maxelem 1048576
|
||||
ipset -! create $IPSET_DIRECT6 nethash family inet6 maxelem 1048576
|
||||
ipset -! create $IPSET_VPS6 iphash family inet6 maxelem 1048576
|
||||
@@ -734,7 +734,7 @@ add_firewall_rule() {
|
||||
$ipt_n -N PSW2
|
||||
$ipt_n -A PSW2 $(dst $IPSET_VPS) -j RETURN
|
||||
$ipt_n -A PSW2 $(comment "WAN_IP_RETURN") $(dst $IPSET_WAN) -j RETURN
|
||||
|
||||
|
||||
[ "$accept_icmp" = "1" ] && insert_rule_after "$ipt_n" "PREROUTING" "prerouting_rule" "$(dst $IPSET_DIRECT !) -p icmp -j PSW2"
|
||||
[ -z "${is_tproxy}" ] && insert_rule_after "$ipt_n" "PREROUTING" "prerouting_rule" "$(dst $IPSET_DIRECT !) -p tcp -j PSW2"
|
||||
|
||||
@@ -784,7 +784,7 @@ add_firewall_rule() {
|
||||
$ip6t_n -A PSW2_OUTPUT $(dst $IPSET_VPS6) -j RETURN
|
||||
$ip6t_n -A PSW2_OUTPUT -m mark --mark 0xff/0xff -j RETURN
|
||||
}
|
||||
|
||||
|
||||
$ip6t_n -N PSW2_DNS
|
||||
if [ $(config_n_get @global[0] dns_redirect "1") = "0" ]; then
|
||||
#Only hijack when dest address is local IP
|
||||
@@ -945,7 +945,7 @@ gen_include() {
|
||||
${__ipt}
|
||||
|
||||
${__ip6t}
|
||||
|
||||
|
||||
return 0
|
||||
EOF
|
||||
return 0
|
||||
|
||||
@@ -26,7 +26,7 @@ while [ "$ENABLED" -eq 1 ]; do
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
rm -f $LOCK_FILE
|
||||
sleep 58s
|
||||
done
|
||||
@@ -157,20 +157,20 @@ insert_nftset() {
|
||||
RS = "[ \t\n\r]+"
|
||||
ORS = ""
|
||||
}
|
||||
$0 != "" {
|
||||
if (!first) {
|
||||
printf "add element %s %s { \n", t, n
|
||||
$0 != "" {
|
||||
if (!first) {
|
||||
printf "add element %s %s { \n", t, n
|
||||
first = 1
|
||||
} else {
|
||||
print ",\n"
|
||||
}
|
||||
printf " %s", $0
|
||||
}
|
||||
END {
|
||||
if (first) {
|
||||
print "\n }\n"
|
||||
}
|
||||
}' | nft -f -
|
||||
} else {
|
||||
print ",\n"
|
||||
}
|
||||
printf " %s", $0
|
||||
}
|
||||
END {
|
||||
if (first) {
|
||||
print "\n }\n"
|
||||
}
|
||||
}' | nft -f -
|
||||
}
|
||||
|
||||
gen_nftset() {
|
||||
@@ -455,7 +455,7 @@ load_acl() {
|
||||
continue
|
||||
fi
|
||||
msg="${msg1}${msg}"
|
||||
|
||||
|
||||
[ -n "$tcp_no_redir_ports" ] && {
|
||||
if ! has_1_65535 "$tcp_no_redir_ports"; then
|
||||
nft "add rule $NFTABLE_NAME $nft_prerouting_chain ${_ipt_source} ip protocol tcp $(factor $tcp_no_redir_ports "tcp dport") counter return comment \"$remarks\""
|
||||
@@ -467,7 +467,7 @@ load_acl() {
|
||||
log 2 "${msg}$(i18n "not proxy all %s" "TCP")"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
[ -n "$udp_no_redir_ports" ] && {
|
||||
if ! has_1_65535 "$udp_no_redir_ports"; then
|
||||
nft "add rule $NFTABLE_NAME PSW2_MANGLE ip protocol udp ${_ipt_source} $(factor $udp_no_redir_ports "udp dport") counter return comment \"$remarks\""
|
||||
@@ -958,7 +958,7 @@ gen_include() {
|
||||
|
||||
cat <<-EOF >> $FWI
|
||||
${__nft}
|
||||
|
||||
|
||||
return 0
|
||||
EOF
|
||||
return 0
|
||||
|
||||
@@ -155,7 +155,7 @@ do
|
||||
if true then
|
||||
local szType = "@global[0]"
|
||||
local option = "node"
|
||||
|
||||
|
||||
local node_id = uci_get(szType, option)
|
||||
CONFIG[#CONFIG + 1] = {
|
||||
log = true,
|
||||
@@ -651,7 +651,7 @@ local function parseClashNode(node, add_mode, group, sub_cfg)
|
||||
end
|
||||
end
|
||||
result.transport = node.network and string.lower(node.network) or "tcp"
|
||||
if result.type == "sing-box" and result.transport == "raw" then
|
||||
if result.type == "sing-box" and result.transport == "raw" then
|
||||
result.transport = "tcp"
|
||||
elseif result.type == "Xray" and result.transport == "tcp" then
|
||||
result.transport = "raw"
|
||||
@@ -723,7 +723,7 @@ local function parseClashNode(node, add_mode, group, sub_cfg)
|
||||
result.reality_shortId = (node["reality-opts"] and node["reality-opts"]["short-id"]) or nil
|
||||
end
|
||||
result.transport = node.network and string.lower(node.network) or "tcp"
|
||||
if result.type == "sing-box" and result.transport == "raw" then
|
||||
if result.type == "sing-box" and result.transport == "raw" then
|
||||
result.transport = "tcp"
|
||||
elseif result.type == "Xray" and result.transport == "tcp" then
|
||||
result.transport = "raw"
|
||||
@@ -914,7 +914,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
result.protocol = hostInfo[#hostInfo-3]
|
||||
result.method = hostInfo[#hostInfo-2]
|
||||
result.obfs = hostInfo[#hostInfo-1]
|
||||
result.password = base64Decode(hostInfo[#hostInfo])
|
||||
result.password = base64Decode(hostInfo[#hostInfo])
|
||||
local params = {}
|
||||
for _, v in pairs(split(dat[2], '&')) do
|
||||
local s = v:find("=", 1, true)
|
||||
@@ -1001,7 +1001,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
|
||||
if not info.net then info.net = "tcp" end
|
||||
info.net = string.lower(info.net)
|
||||
if result.type == "sing-box" and info.net == "raw" then
|
||||
if result.type == "sing-box" and info.net == "raw" then
|
||||
info.net = "tcp"
|
||||
elseif result.type == "Xray" and info.net == "tcp" then
|
||||
info.net = "raw"
|
||||
@@ -1282,7 +1282,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
|
||||
if params.type then
|
||||
params.type = string.lower(params.type)
|
||||
if result.type == "sing-box" and params.type == "raw" then
|
||||
if result.type == "sing-box" and params.type == "raw" then
|
||||
params.type = "tcp"
|
||||
elseif result.type == "Xray" and params.type == "tcp" then
|
||||
params.type = "raw"
|
||||
@@ -1447,7 +1447,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
log(2, i18n.translatef("Skipping the %s node is due to incompatibility with the %s core program or incorrect node usage type settings.", "Trojan", "Trojan"))
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
local alias = ""
|
||||
if content:find("#") then
|
||||
local idx_sp = content:find("#")
|
||||
@@ -1511,7 +1511,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
|
||||
if not params.type then params.type = "tcp" end
|
||||
params.type = string.lower(params.type)
|
||||
if result.type == "sing-box" and params.type == "raw" then
|
||||
if result.type == "sing-box" and params.type == "raw" then
|
||||
params.type = "tcp"
|
||||
elseif result.type == "Xray" and params.type == "tcp" then
|
||||
params.type = "raw"
|
||||
@@ -1652,7 +1652,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
if ({ xhttp=true, kcp=true, mkcp=true })[params.type] and result.type ~= "Xray" and has_xray then
|
||||
result.type = "Xray"
|
||||
end
|
||||
if result.type == "sing-box" and params.type == "raw" then
|
||||
if result.type == "sing-box" and params.type == "raw" then
|
||||
params.type = "tcp"
|
||||
elseif result.type == "Xray" and params.type == "tcp" then
|
||||
params.type = "raw"
|
||||
@@ -1791,7 +1791,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
content = content:sub(0, idx_sp - 1)
|
||||
end
|
||||
result.remarks = UrlDecode(alias)
|
||||
|
||||
|
||||
local query = split(content:gsub("/%?", "?"), '%?')
|
||||
local host_port = query[1]
|
||||
local params = {}
|
||||
@@ -2508,7 +2508,7 @@ local function update_node(manual)
|
||||
uci_set(cfgid, "chain_proxy", "3")
|
||||
uci_set(cfgid, "outbound_iface", outbound_iface_group)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user