1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Merge pull request #270 from Ysurac/develop

sync
This commit is contained in:
suyuan 2022-08-24 17:44:11 +08:00 committed by GitHub
commit 17e69b18f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 8 deletions

View file

@ -56,6 +56,8 @@ start_instance() {
_log "starting ${PROG_NAME} ${1} instance $*" _log "starting ${PROG_NAME} ${1} instance $*"
host=$(resolveip $host)
if [ "$mode" = "to" ]; then if [ "$mode" = "to" ]; then
bind="bind from addr :: port 5000 to addr $host port $port" bind="bind from addr :: port 5000 to addr $host port $port"
else else

View file

@ -514,13 +514,13 @@
<% <%
end end
%> %>
<div class="cbi-value" id="cbi-network-<%=ifname%>-address" data-depends="[{&#34;cbid.network.<%=ifname%>.proto&#34;:&#34;static&#34;},{&#34;cbid.network.<%=ifname%>.type&#34;:&#34;macvlan&#34;}]" data-index="5"> <div class="cbi-value" id="cbi-network-<%=ifname%>-address" data-depends="[{&#34;cbid.network.<%=ifname%>.proto&#34;:&#34;static&#34;},{&#34;cbid.network.<%=ifname%>.proto&#34;:&#34;other&#34;},{&#34;cbid.network.<%=ifname%>.type&#34;:&#34;macvlan&#34;}]" data-index="5">
<label class="cbi-value-title"><%:IPv4 address%></label> <label class="cbi-value-title"><%:IPv4 address%></label>
<div class="cbi-value-field"> <div class="cbi-value-field">
<input type="text" id="cbid.network.<%=ifname%>.ipaddr" name="cbid.network.<%=ifname%>.ipaddr" class="cbi-input-text" value="<%=uci:get("network",ifname,"ipaddr")%>" data-type="ip4addr"> <input type="text" id="cbid.network.<%=ifname%>.ipaddr" name="cbid.network.<%=ifname%>.ipaddr" class="cbi-input-text" value="<%=uci:get("network",ifname,"ipaddr")%>" data-type="ip4addr">
</div> </div>
</div> </div>
<div class="cbi-value" id="cbi-network-<%=ifname%>-netmask" data-depends="[{&#34;cbid.network.<%=ifname%>.proto&#34;:&#34;static&#34;},{&#34;cbid.network.<%=ifname%>.type&#34;:&#34;macvlan&#34;}]" data-index="6"> <div class="cbi-value" id="cbi-network-<%=ifname%>-netmask" data-depends="[{&#34;cbid.network.<%=ifname%>.proto&#34;:&#34;static&#34;},{&#34;cbid.network.<%=ifname%>.proto&#34;:&#34;other&#34;},{&#34;cbid.network.<%=ifname%>.type&#34;:&#34;macvlan&#34;}]" data-index="6">
<label class="cbi-value-title"><%:IPv4 netmask%></label> <label class="cbi-value-title"><%:IPv4 netmask%></label>
<div class="cbi-value-field"> <div class="cbi-value-field">
<input type="text" id="cbid.network.<%=ifname%>.netmask" name="cbid.network.<%=ifname%>.netmask" class="cbi-input-text" value="<%=uci:get("network",ifname,"netmask") or "255.255.255.0"%>" data-type="ip4addr"> <input type="text" id="cbid.network.<%=ifname%>.netmask" name="cbid.network.<%=ifname%>.netmask" class="cbi-input-text" value="<%=uci:get("network",ifname,"netmask") or "255.255.255.0"%>" data-type="ip4addr">

View file

@ -644,7 +644,7 @@ del_server_route6() {
else else
metric=$(uci -q get network.$OMR_TRACKER_INTERFACE.metric) metric=$(uci -q get network.$OMR_TRACKER_INTERFACE.metric)
fi fi
[ -n "$OMR_TRACKER_DEVICE" ] && [ -n "$metric" ] && [ -n "$serverip"] && [ -n "$(ip -6 route show $serverip dev $OMR_TRACKER_DEVICE metric $metric)" ] && ip -6 route del $serverip dev $OMR_TRACKER_DEVICE metric $metric >/dev/null 2>&1 [ -n "$OMR_TRACKER_DEVICE" ] && [ -n "$metric" ] && [ -n "$serverip" ] && [ -n "$(ip -6 route show $serverip dev $OMR_TRACKER_DEVICE metric $metric)" ] && ip -6 route del $serverip dev $OMR_TRACKER_DEVICE metric $metric >/dev/null 2>&1
[ -n "$OMR_TRACKER_DEVICE" ] && [ -n "$metric" ] && [ -n "$serverip" ] && [ -n "$(ip -6 route show $serverip dev $OMR_TRACKER_DEVICE)" ] && ip -6 route del $serverip dev $OMR_TRACKER_DEVICE >/dev/null 2>&1 [ -n "$OMR_TRACKER_DEVICE" ] && [ -n "$metric" ] && [ -n "$serverip" ] && [ -n "$(ip -6 route show $serverip dev $OMR_TRACKER_DEVICE)" ] && ip -6 route del $serverip dev $OMR_TRACKER_DEVICE >/dev/null 2>&1
} }
config_list_foreach $server ip remove_route config_list_foreach $server ip remove_route
@ -1218,8 +1218,9 @@ if [ -n "$OMR_TRACKER_INTERFACE" ] && ([ "$multipath_config" = "on" ] || [ "$mul
serverip=$1 serverip=$1
#gtudpst="up" #gtudpst="up"
#[ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.multipathvpn)" != "1" ] && [ "$multipath_config" = "backup" ] && [ "$(pgrep glorytun-udp)" != "" ] && gtudpst="backup" #[ "$(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 | grep running)" = "" ] && [ -n "$(resolveip -4 $serverip)" ]; then 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 | grep running)" = "" ] && [ -n "$(resolveip -4 -t 5 $serverip)" ]; then
if [ "$download" != "0" ] && [ "$download" != "" ] && [ "$upload" != "0" ] && [ "$upload" != "" ]; then serverip="$(resolveip -4 -t 5 $serverip | head -n 1 | tr -d '\n')"
if [ "$download" != "0" ] && [ "$download" != "" ] && [ "$upload" != "0" ] && [ "$upload" != "" ]; then
if [ "$(uci -q get glorytun-udp.vpn.rateauto)" = "1" ]; then if [ "$(uci -q get glorytun-udp.vpn.rateauto)" = "1" ]; then
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP to addr $serverip port ${gtudp_port} dev ${gtudp_dev} 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 port ${gtudp_port} dev ${gtudp_dev} set up rate auto tx $((upload*1000/8)) rx $((download*1000/8)) pref 1 > /dev/null 2>&1
else else
@ -1233,7 +1234,8 @@ if [ -n "$OMR_TRACKER_INTERFACE" ] && ([ "$multipath_config" = "on" ] || [ "$mul
fi fi
fi 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 | grep running)" = "" ] && [ -n "$(resolveip -6 $serverip)" ]; 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 | grep running)" = "" ] && [ -n "$(resolveip -6 -t 5 $serverip)" ]; then
serverip="$(resolveip -6 -t 5 $serverip | head -n 1 | tr -d '\n')"
if [ "$download" != "0" ] && [ "$download" != "" ] && [ "$upload" != "0" ] && [ "$upload" != "" ]; then if [ "$download" != "0" ] && [ "$download" != "" ] && [ "$upload" != "0" ] && [ "$upload" != "" ]; then
if [ "$(uci -q get glorytun-udp.vpn.rateauto)" = "1" ]; then if [ "$(uci -q get glorytun-udp.vpn.rateauto)" = "1" ]; then
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP6 to addr $serverip port ${gtudp_port} dev ${gtudp_dev} 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 port ${gtudp_port} dev ${gtudp_dev} set up rate auto tx $((upload*1000/8)) rx $((download*1000/8)) pref 1 > /dev/null 2>&1
@ -1252,8 +1254,8 @@ if [ -n "$OMR_TRACKER_INTERFACE" ] && ([ "$multipath_config" = "on" ] || [ "$mul
# glorytun-udp set dev tun0 kxtimeout 7d > /dev/null 2>&1 # glorytun-udp set dev tun0 kxtimeout 7d > /dev/null 2>&1
# fi # fi
[ "$multipath_config" = "backup" ] && [ "$(pgrep glorytun-udp)" != "" ] && { [ "$multipath_config" = "backup" ] && [ "$(pgrep glorytun-udp)" != "" ] && {
[ -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_IP" ] && [ -n "$(resolveip -4 -t 5 $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 [ -n "$OMR_TRACKER_DEVICE_IP6" ] && [ -n "$(resolveip -6 -t 5 $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_list_foreach $1 ip addpath