mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-15 03:51:51 +00:00
Support multi servers with glorytun UDP
This commit is contained in:
parent
e05f1b8e02
commit
6ab5f128a9
1 changed files with 48 additions and 38 deletions
|
@ -891,35 +891,40 @@ if [ "$multipath_config" = "on" ] || [ "$multipath_config" = "backup" ]; then
|
|||
if [ "$(uci -q show | grep mptcpr)" = "" ]; then
|
||||
touch /etc/config/openmptcprouter
|
||||
fi
|
||||
gtudpst="up"
|
||||
[ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.multipathvpn)" != "1" ] && [ "$multipath_config" = "backup" ] && [ "$(pgrep glorytun-udp)" != "" ] && gtudpst="backup"
|
||||
if [ "$OMR_TRACKER_DEVICE_IP" != "" ] && [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.vpn)" != "1" ] && [ "$(pgrep glorytun-udp)" != "" ] && [ "$(glorytun-udp path | grep $OMR_TRACKER_DEVICE_IP)" = "" ]; then
|
||||
glorytunudppath() {
|
||||
gtudp_port="$(uci -q get glorytun-udp.vpn.port)"
|
||||
gtudp_dev="$(uci -q get glorytun-udp.vpn.dev)"
|
||||
addpath() {
|
||||
serverip=$1
|
||||
#gtudpst="up"
|
||||
#[ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.multipathvpn)" != "1" ] && [ "$multipath_config" = "backup" ] && [ "$(pgrep glorytun-udp)" != "" ] && gtudpst="backup"
|
||||
if [ "$OMR_TRACKER_DEVICE_IP" != "" ] && [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.vpn)" != "1" ] && [ "$(pgrep glorytun-udp)" != "" ] && [ "$(glorytun-udp path | grep $OMR_TRACKER_DEVICE_IP)" = "" ] && [ -n "$(resolveip -4 $serverip)" ]; then
|
||||
if [ "$download" != "0" ] && [ "$download" != "" ] && [ "$upload" != "0" ] && [ "$upload" != "" ]; then
|
||||
if [ "$(uci -q get glorytun-udp.vpn.rateauto)" = "1" ]; then
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP dev tun0 set up rate auto tx $((upload*1000/8)) rx $((download*1000/8)) pref 1 > /dev/null 2>&1
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP to addr $serverip dev ${gtudp_dev} port ${gtudp_port} set up rate auto tx $((upload*1000/8)) rx $((download*1000/8)) pref 1 > /dev/null 2>&1
|
||||
else
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP dev tun0 set up rate fixed tx $((upload*1000/8)) rx $((download*1000/8)) pref 1 > /dev/null 2>&1
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP to addr $serverip dev ${gtudp_dev} port ${gtudp_port} set up rate fixed tx $((upload*1000/8)) rx $((download*1000/8)) pref 1 > /dev/null 2>&1
|
||||
fi
|
||||
else
|
||||
if [ "$(uci -q get glorytun-udp.vpn.rateauto)" = "1" ]; then
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP dev tun0 set up rate auto tx 12500000 rx 12500000 pref 1 > /dev/null 2>&1
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP to addr $serverip dev ${gtudp_dev} port ${gtudp_port} set up rate auto tx 12500000 rx 12500000 pref 1 > /dev/null 2>&1
|
||||
else
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP dev tun0 set up rate fixed tx 12500000 rx 12500000 pref 1 > /dev/null 2>&1
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP to addr $serverip dev ${gtudp_dev} port ${gtudp_port} set up rate fixed tx 12500000 rx 12500000 pref 1 > /dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ "$OMR_TRACKER_DEVICE_IP6" != "" ] && [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.vpn)" != "1" ] && [ "$(pgrep glorytun-udp)" != "" ] && [ "$(glorytun-udp path | grep $OMR_TRACKER_DEVICE_IP6)" = "" ]; then
|
||||
if [ "$OMR_TRACKER_DEVICE_IP6" != "" ] && [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.vpn)" != "1" ] && [ "$(pgrep glorytun-udp)" != "" ] && [ "$(glorytun-udp path | grep $OMR_TRACKER_DEVICE_IP6)" = "" ] && [ -n "$(resolveip -6 $serverip)" ]; then
|
||||
if [ "$download" != "0" ] && [ "$download" != "" ] && [ "$upload" != "0" ] && [ "$upload" != "" ]; then
|
||||
if [ "$(uci -q get glorytun-udp.vpn.rateauto)" = "1" ]; then
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP6 dev tun0 set up rate auto tx $((upload*1000/8)) rx $((download*1000/8)) pref 1 > /dev/null 2>&1
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP6 to addr $serverip dev ${gtudp_dev} port ${gtudp_port} set up rate auto tx $((upload*1000/8)) rx $((download*1000/8)) pref 1 > /dev/null 2>&1
|
||||
else
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP6 dev tun0 set up rate fixed tx $((upload*1000/8)) rx $((download*1000/8)) pref 1 > /dev/null 2>&1
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP6 to addr $serverip dev ${gtudp_dev} port ${gtudp_port} set up rate fixed tx $((upload*1000/8)) rx $((download*1000/8)) pref 1 > /dev/null 2>&1
|
||||
fi
|
||||
else
|
||||
if [ "$(uci -q get glorytun-udp.vpn.rateauto)" = "1" ]; then
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP6 dev tun0 set up rate auto tx 12500000 rx 12500000 pref 1 > /dev/null 2>&1
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP6 to addr $serverip dev ${gtudp_dev} port ${gtudp_port} set up rate auto tx 12500000 rx 12500000 pref 1 > /dev/null 2>&1
|
||||
else
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP6 dev tun0 set up rate fixed tx 12500000 rx 12500000 pref 1 > /dev/null 2>&1
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP6 to addr $serverip dev ${gtudp_dev} port ${gtudp_port} set up rate fixed tx 12500000 rx 12500000 pref 1 > /dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -927,9 +932,14 @@ if [ "$multipath_config" = "on" ] || [ "$multipath_config" = "backup" ]; then
|
|||
# glorytun-udp set dev tun0 kxtimeout 7d > /dev/null 2>&1
|
||||
# fi
|
||||
[ "$multipath_config" = "backup" ] && [ "$(pgrep glorytun-udp)" != "" ] && {
|
||||
[ -n "$OMR_TRACKER_DEVICE_IP" ] && glorytun-udp path addr $OMR_TRACKER_DEVICE_IP dev tun0 set pref 125 > /dev/null 2>&1
|
||||
[ -n "$OMR_TRACKER_DEVICE_IP6" ] && glorytun-udp path addr $OMR_TRACKER_DEVICE_IP6 dev tun0 set pref 125 > /dev/null 2>&1
|
||||
[ -n "$OMR_TRACKER_DEVICE_IP" ] && [ -n "$(resolveip -4 $serverip)" ] && glorytun-udp path addr $OMR_TRACKER_DEVICE_IP to addr $serverip port ${gtudp_port} dev ${gtudp_dev} set pref 125 > /dev/null 2>&1
|
||||
[ -n "$OMR_TRACKER_DEVICE_IP6" ] && [ -n "$(resolveip -6 $serverip)" ] && glorytun-udp path addr $OMR_TRACKER_DEVICE_IP6 to addr $serverip port ${gtudp_port} dev ${gtudp_dev} set pref 125 > /dev/null 2>&1
|
||||
}
|
||||
}
|
||||
config_list_foreach $1 ip addpath
|
||||
}
|
||||
config_load openmptcprouter
|
||||
config_foreach glorytunudppath server
|
||||
fi
|
||||
[ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.multipathvpn)" != "1" ] && {
|
||||
[ "$multipath_status" = "$multipath_config" ] || {
|
||||
|
@ -1230,7 +1240,7 @@ if [ "$(pgrep rpcd)" = "" ] && [ -f /etc/init.d/rpcd ]; then
|
|||
sleep 5
|
||||
fi
|
||||
|
||||
if [ "$(uci -q get v2ray.main.enabled)" = "1" ] && [ -f /etc/init.d/v2ray ] && [ "$(pgrep -f omr-tracker-v2ray)" = "" ]; then
|
||||
if [ "$(uci -q get v2ray.main.enabled)" = "1" ] && [ -f /etc/init.d/v2ray ] && [ "$(pgrep -f omr-tracker-v2ray)" = "" ] && [ "$(pgrep -f '/etc/init.d/omr-tracker')" = "" ]; then
|
||||
_log "Can't find omr-tracker-v2ray, restart omr-tracker..."
|
||||
/etc/init.d/omr-tracker restart
|
||||
fi
|
||||
|
@ -1246,7 +1256,7 @@ if [ "$(uci -q get shadowsocks-libev.sss0.disabled)" != "1" ] && [ "$(uci -q get
|
|||
uci -q commit openmptcprouter
|
||||
fi
|
||||
|
||||
if [ "$(uci -q get shadowsocks-libev.sss0.disabled)" != "1" ] && [ "$(uci -q get shadowsocks-libev.sss0.key)" != "" ] && [ "$(uci -q get shadowsocks-libev.sss0.server)" != "" ] && [ "$(uci -q get shadowsocks-libev.sss0.server)" != "192.18.1.3" ] && [ "$(pgrep -f omr-tracker-ss)" = "" ]; then
|
||||
if [ "$(uci -q get shadowsocks-libev.sss0.disabled)" != "1" ] && [ "$(uci -q get shadowsocks-libev.sss0.key)" != "" ] && [ "$(uci -q get shadowsocks-libev.sss0.server)" != "" ] && [ "$(uci -q get shadowsocks-libev.sss0.server)" != "192.18.1.3" ] && [ "$(pgrep -f omr-tracker-ss)" = "" ] && [ "$(pgrep -f '/etc/init.d/omr-tracker')" = "" ]; then
|
||||
_log "Can't find omr-tracker-ss, restart omr-tracker..."
|
||||
/etc/init.d/omr-tracker restart
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue