mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-15 03:51:51 +00:00
commit
295d07f1c8
5 changed files with 39 additions and 7 deletions
|
@ -471,18 +471,32 @@ _intf_rule_v2ray_rules() {
|
|||
#rule_name=$1
|
||||
#[ "$rule_name" = "ss_rules" ] && rule_name="def"
|
||||
rule_name="def"
|
||||
if [ "$(iptables --wait=40 -t nat -L -n | grep v2r_${rule_name}_pre_src)" != "" ] && [ "$(iptables-save | grep v2r | grep omr_dst_bypass_$intf)" = "" ]; then
|
||||
if [ "$(iptables --wait=40 -t nat -L -n | grep v2r_${rule_name}_dst)" != "" ] && [ "$(iptables-save | grep v2r_${rule_name}_dst | grep omr_dst_bypass_$intf)" = "" ]; then
|
||||
iptables-restore -w --wait=60 --noflush <<-EOF
|
||||
*nat
|
||||
-I v2r_${rule_name}_dst 1 -m set --match-set omr_dst_bypass_$intf dst -j MARK --set-mark 0x539$count
|
||||
-I v2r_${rule_name}_dst 2 -m mark --mark 0x539$count -j RETURN
|
||||
COMMIT
|
||||
EOF
|
||||
fi
|
||||
if [ "$(iptables --wait=40 -t nat -L -n | grep v2r_${rule_name}_local_out)" != "" ] && [ "$(iptables-save | grep v2r_${rule_name}_local_out | grep omr_dst_bypass_$intf)" = "" ]; then
|
||||
iptables-restore -w --wait=60 --noflush <<-EOF
|
||||
*nat
|
||||
-I v2r_${rule_name}_local_out 1 -m set --match-set omr_dst_bypass_$intf dst -j MARK --set-mark 0x539$count
|
||||
-I v2r_${rule_name}_local_out 2 -m mark --mark 0x539$count -j RETURN
|
||||
COMMIT
|
||||
EOF
|
||||
fi
|
||||
if [ "$(iptables --wait=40 -t nat -L -n | grep v2r_${rule_name}_pre_src)" != "" ] && [ "$(iptables-save | grep v2r_${rule_name}_pre_src | grep omr_dst_bypass_$intf)" = "" ]; then
|
||||
iptables-restore -w --wait=60 --noflush <<-EOF
|
||||
*nat
|
||||
-I v2r_${rule_name}_pre_src 1 -m set --match-set omr_dst_bypass_$intf dst -j MARK --set-mark 0x539$count
|
||||
-I v2r_${rule_name}_pre_src 2 -m mark --mark 0x539$count -j RETURN
|
||||
COMMIT
|
||||
EOF
|
||||
fi
|
||||
|
||||
|
||||
if [ "$disableipv6" = "0" ]; then
|
||||
if [ "$(ip6tables-save | grep omr-bypass6 | grep omr6_dst_bypass_$intf)" = "" ]; then
|
||||
ip6tables-restore -w --wait=60 --noflush <<-EOF
|
||||
|
@ -552,7 +566,9 @@ _intf_rule() {
|
|||
iptables-restore -w --wait=60 --noflush <<-EOF
|
||||
*mangle
|
||||
-I omr-bypass 1 -m set --match-set omr_dst_bypass_$intf dst -j MARK --set-mark 0x539$count
|
||||
-I omr-bypass 2 -m mark --mark 0x539$count -j RETURN
|
||||
-I omr-bypass-local 1 -m set --match-set omr_dst_bypass_$intf dst -j MARK --set-mark 0x539$count
|
||||
-I omr-bypass-local 2 -m mark --mark 0x539$count -j RETURN
|
||||
COMMIT
|
||||
EOF
|
||||
fi
|
||||
|
@ -610,7 +626,7 @@ _ss_rules_config() {
|
|||
iptables-restore -w --wait=60 --noflush <<-EOF
|
||||
*nat
|
||||
-I ssr_${rule_name}_dst 1 -m set --match-set omr_dst_bypass_all dst -j MARK --set-mark 0x539
|
||||
-I ssr_${rule_name}_dst 1 -m mark --mark 0x539 -j RETURN
|
||||
-I ssr_${rule_name}_dst 2 -m mark --mark 0x539 -j RETURN
|
||||
-I ssr_${rule_name}_local_out 1 -m set --match-set omr_dst_bypass_all dst -j MARK --set-mark 0x539
|
||||
-I ssr_${rule_name}_local_out 2 -m mark --mark 0x539 -j RETURN
|
||||
-I ssr_${rule_name}_pre_src 1 -m set --match-set omr_dst_bypass_all dst -j MARK --set-mark 0x539
|
||||
|
@ -649,7 +665,7 @@ _v2ray_rules_config() {
|
|||
iptables-restore -w --wait=60 --noflush <<-EOF
|
||||
*nat
|
||||
-I v2r_${rule_name}_dst 1 -m set --match-set omr_dst_bypass_all dst -j MARK --set-mark 0x539
|
||||
-I v2r_${rule_name}_dst 1 -m mark --mark 0x539 -j RETURN
|
||||
-I v2r_${rule_name}_dst 2 -m mark --mark 0x539 -j RETURN
|
||||
-I v2r_${rule_name}_local_out 1 -m set --match-set omr_dst_bypass_all dst -j MARK --set-mark 0x539
|
||||
-I v2r_${rule_name}_local_out 2 -m mark --mark 0x539 -j RETURN
|
||||
-I v2r_${rule_name}_pre_src 1 -m set --match-set omr_dst_bypass_all dst -j MARK --set-mark 0x539
|
||||
|
|
|
@ -1153,6 +1153,10 @@ function settings_add()
|
|||
local shadowsocksudp = luci.http.formvalue("shadowsocksudp") or "0"
|
||||
ucic:set("openmptcprouter","settings","shadowsocksudp",shadowsocksudp)
|
||||
|
||||
-- Enable/disable v2ray udp
|
||||
local shadowsocksudp = luci.http.formvalue("v2rayudp") or "1"
|
||||
ucic:set("v2ray","main_transparent_proxy","redirect_udp",v2rayudp)
|
||||
|
||||
-- Enable/disable nDPI
|
||||
local ndpi = luci.http.formvalue("ndpi") or "1"
|
||||
ucic:set("openmptcprouter","settings","ndpi",ndpi)
|
||||
|
|
|
@ -297,6 +297,12 @@
|
|||
<input type="checkbox" name="shadowsocksudp" class="cbi-input-checkbox" value="1" <% if luci.model.uci.cursor():get("openmptcprouter","settings","shadowsocksudp") == "1" then %>checked<% end %>>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:When proxy V2Ray is used, use it for UDP%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="checkbox" name="v2rayudp" class="cbi-input-checkbox" value="1" <% if luci.model.uci.cursor():get("v2ray","main_transparent_proxy","redirect_udp") == "1" then %>checked<% end %>>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:Disable default gateway%></label>
|
||||
<div class="cbi-value-field">
|
||||
|
|
|
@ -1621,7 +1621,7 @@ if [ "$(pgrep dsvpn)" = "" ] && [ "$(uci -q get dsvpn.vpn.enable)" = "1" ] && [
|
|||
/etc/init.d/dsvpn restart 2>&1 >/dev/null
|
||||
sleep 5
|
||||
fi
|
||||
if [ "$(pgrep v2ray)" = "" ] && [ "$(uci -q get v2ray.main.enabled)" = "1" ] && [ -f /etc/init.d/v2ray ]; then
|
||||
if [ "$(pgrep -f v2ray)" = "" ] && [ "$(uci -q get v2ray.main.enabled)" = "1" ] && [ -f /etc/init.d/v2ray ]; then
|
||||
_log "Can't find V2Ray, restart it..."
|
||||
/etc/init.d/v2ray restart 2>&1 >/dev/null
|
||||
sleep 5
|
||||
|
@ -1690,9 +1690,10 @@ if [ -n "$(logread | tail -n 2 | grep 'Ring expansion failed')" ]; then
|
|||
echo 1 > /sys/bus/pci/rescan
|
||||
fi
|
||||
|
||||
if [ -f /etc/init.d/omr-bypass ] && [ "$(iptables-save | grep omr-bypass)" = "" ] && [ "$(pgrep omr-bypass)" = "" ]; then
|
||||
if [ -f /etc/init.d/omr-bypass ] && [ "$(iptables-save | grep omr-bypass)" = "" ] && [ "$(pgrep -f omr-bypass)" = "" ]; then
|
||||
_log "Can't find omr-bypass rules, restart omr-bypass..."
|
||||
/etc/init.d/omr-bypass 2>&1 >/dev/null
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
if [ -f /etc/backup/installed_packages.txt ] && [ -n "$(grep overlay /etc/backup/installed_packages.txt)" ]; then
|
||||
|
|
|
@ -414,10 +414,15 @@ add_v2ray_redirect_rules() {
|
|||
|
||||
# This part need a rewrite
|
||||
v2ray-rules -f
|
||||
v2ray-rules -l ${port} -L ${port} -s $OUTBOUND_SERVERS_V4 --rule-name def --src-default forward --dst-default forward --local-default forward
|
||||
logger -t "v2ray" "v2ray-rules -l ${port} -L ${port} -s $OUTBOUND_SERVERS_V4 --rule-name def --src-default forward --dst-default forward --local-default forward"
|
||||
commandline="-l ${port} -s $OUTBOUND_SERVERS_V4 --rule-name def --src-default forward --dst-default forward --local-default forward"
|
||||
[ "$(uci -q get v2ray.main_transparent_proxy.redirect_udp)" = "1" ] && commandline="$commandline -L ${port}"
|
||||
v2ray-rules $commandline
|
||||
[ "$(uci -q get v2ray.main.inbounds | grep omr6)" != "" ] && {
|
||||
v2ray-rules6 -f
|
||||
v2ray-rules6 -l $((port+1)) -L $((port+1)) -s $OUTBOUND_SERVERS_V6 --rule-name def --src-default forward --dst-default forward --local-default forward
|
||||
commandline="-l $((port+1)) -L $((port+1)) -s $OUTBOUND_SERVERS_V6 --rule-name def --src-default forward --dst-default forward --local-default forward"
|
||||
[ "$(uci -q get v2ray.main_transparent_proxy.redirect_udp)" = "1" ] && commandline="$commandline -L ${port+1}"
|
||||
v2ray-rules6 $commandline
|
||||
}
|
||||
[ -f /etc/init.d/omr-bypass ] && {
|
||||
logger -t "v2ray" "Reload omr-bypass rules"
|
||||
|
|
Loading…
Reference in a new issue