mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-15 03:51:51 +00:00
Merge branch 'develop' into master
This commit is contained in:
commit
7b5d076bef
8 changed files with 104 additions and 11 deletions
|
@ -864,6 +864,10 @@ function settings_add()
|
|||
local disablegwping = luci.http.formvalue("disablegwping") or "0"
|
||||
ucic:set("openmptcprouter","settings","disablegwping",disablegwping)
|
||||
|
||||
-- Enable/disable renaming intf
|
||||
local disableintfrename = luci.http.formvalue("disableintfrename") or "0"
|
||||
ucic:set("openmptcprouter","settings","disableintfrename",disableintfrename)
|
||||
|
||||
-- Enable/disable default gateway
|
||||
local disabledefaultgw = luci.http.formvalue("disabledefaultgw") or "1"
|
||||
ucic:set("openmptcprouter","settings","defaultgw",disabledefaultgw)
|
||||
|
|
|
@ -244,6 +244,16 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:Disable interfaces auto rename%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="checkbox" name="disableintfrename" class="cbi-input-checkbox" value="1" <% if luci.model.uci.cursor():get("openmptcprouter","settings","disableintfrename") == "1" then %>checked<% end %>>
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Disable renaming interfaces%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:When proxy shadowsocks is used, use it for UDP if proxy down%></label>
|
||||
<div class="cbi-value-field">
|
||||
|
|
|
@ -58,6 +58,8 @@ _set_intf_name() {
|
|||
}
|
||||
}
|
||||
|
||||
config_load network
|
||||
config_foreach _set_intf_name interface
|
||||
config_foreach _set_intf_name interface
|
||||
if [ "$(uci -q get openmptcprouter.settings.disableintfrename)" != "0" ]; then
|
||||
config_load network
|
||||
config_foreach _set_intf_name interface
|
||||
config_foreach _set_intf_name interface
|
||||
fi
|
|
@ -580,22 +580,22 @@ if [ "$multipath_config" = "on" ] || [ "$multipath_config" = "backup" ]; then
|
|||
if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.vpn)" != "1" ] && [ "$(pgrep glorytun-udp)" != "" ] && [ "$(glorytun-udp path | grep $OMR_TRACKER_DEVICE_IP)" = "" ]; 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)) > /dev/null 2>&1
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP dev tun0 set up rate pref 1 auto tx $((upload*1000/8)) rx $((download*1000/8)) > /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)) > /dev/null 2>&1
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP dev tun0 set up rate pref 1 fixed tx $((upload*1000/8)) rx $((download*1000/8)) > /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 > /dev/null 2>&1
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP dev tun0 set up pref 1 rate auto tx 12500000 rx 12500000 > /dev/null 2>&1
|
||||
else
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP dev tun0 set up rate fixed tx 12500000 rx 12500000 > /dev/null 2>&1
|
||||
glorytun-udp path addr $OMR_TRACKER_DEVICE_IP dev tun0 set up pref 1 rate fixed tx 12500000 rx 12500000 > /dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
# if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.vpn)" != "1" ] && [ "$(pgrep glorytun-udp)" != "" ] && [ "$(glorytun-udp set | grep 'kxtimeout 7d')" = "" ]; then
|
||||
# glorytun-udp set dev tun0 kxtimeout 7d > /dev/null 2>&1
|
||||
# fi
|
||||
[ "$multipath_config" = "backup" ] && [ "$(pgrep glorytun-udp)" != "" ] && glorytun-udp path addr $OMR_TRACKER_DEVICE_IP dev tun0 set pref 500 > /dev/null 2>&1
|
||||
[ "$multipath_config" = "backup" ] && [ "$(pgrep glorytun-udp)" != "" ] && glorytun-udp path addr $OMR_TRACKER_DEVICE_IP dev tun0 set pref 125 > /dev/null 2>&1
|
||||
fi
|
||||
[ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.multipathvpn)" != "1" ] && {
|
||||
[ "$multipath_status" = "$multipath_config" ] || {
|
||||
|
|
|
@ -150,8 +150,8 @@ _dns() {
|
|||
-b "${deviceip}" \
|
||||
+time="$OMR_TRACKER_TIMEOUT" \
|
||||
+tries=1 \
|
||||
openmptcprouter.com
|
||||
) && echo "$ret" | grep -sq "94.23.252.192" && {
|
||||
one.one.one.one
|
||||
) && echo "$ret" | grep -sq "1.1.1.1" && {
|
||||
OMR_TRACKER_LATENCY=$(echo "$ret" | awk '/Query time/{print $4}')
|
||||
_update_rto "$OMR_TRACKER_LATENCY"
|
||||
return
|
||||
|
|
46
omr-tracker/files/bin/omr-tracker-gre
Executable file
46
omr-tracker/files/bin/omr-tracker-gre
Executable file
|
@ -0,0 +1,46 @@
|
|||
#!/bin/sh
|
||||
# vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 :
|
||||
|
||||
name=$0
|
||||
basename="$(basename $0)"
|
||||
|
||||
_log() {
|
||||
logger -p daemon.info -t "${basename}" "$@"
|
||||
}
|
||||
|
||||
_ping_server() {
|
||||
local host=$1
|
||||
ret=$(ping \
|
||||
-w "$OMR_TRACKER_TIMEOUT" \
|
||||
-c 1 \
|
||||
-q \
|
||||
"${host}"
|
||||
) && echo "$ret" | grep -sq " 0% packet loss" && {
|
||||
server_ping=true
|
||||
}
|
||||
}
|
||||
|
||||
_ping_tunnel() {
|
||||
local name=$1
|
||||
config_get gateway $1 gateway
|
||||
config_get ifname $1 ifname
|
||||
config_get disabled $1 disabled
|
||||
[ "$(echo $ifname | grep omrip)" != "" ] && [ -n "$gateway" ] && [ "$disabled" != "1" ] && {
|
||||
_ping_server $gateway
|
||||
}
|
||||
}
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
timeout=${OMR_TRACKER_TIMEOUT:-5}
|
||||
interval=${OMR_TRACKER_INTERVAL:-10}
|
||||
intervaltries=${OMR_TRACKER_INTERVAL_TRIES:-2}
|
||||
retry=${OMR_TRACKER_TRIES:-4}
|
||||
waittest=${OMR_TRACKER_WAIT_TEST:-0}
|
||||
|
||||
while true; do
|
||||
server_ping=false
|
||||
config_load network
|
||||
config_foreach _ping_tunnel interface
|
||||
sleep "${interval}"
|
||||
done
|
|
@ -103,6 +103,28 @@ _launch_server_tracker() {
|
|||
procd_close_instance
|
||||
}
|
||||
|
||||
_launch_gre_tracker() {
|
||||
local hosts timeout tries interval interval_tries options type enabled wait_test
|
||||
_validate_section "defaults" "defaults"
|
||||
_validate_section "gre" "gre"
|
||||
|
||||
[ "${enabled}" = "0" ] && return
|
||||
[ -z "${interval_tries}" ] && interval_tries=1
|
||||
|
||||
procd_open_instance
|
||||
# shellcheck disable=SC2086
|
||||
procd_set_param command /bin/omr-tracker-gre "$1" $options
|
||||
procd_append_param env "OMR_TRACKER_TIMEOUT=$timeout"
|
||||
procd_append_param env "OMR_TRACKER_TRIES=$tries"
|
||||
procd_append_param env "OMR_TRACKER_INTERVAL=$interval"
|
||||
procd_append_param env "OMR_TRACKER_INTERVAL_TRIES=$interval_tries"
|
||||
procd_append_param env "OMR_TRACKER_WAIT_TEST=$wait_test"
|
||||
procd_set_param limits nofile="51200 51200"
|
||||
procd_set_param respawn 0 10 0
|
||||
procd_set_param stderr 1
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
_initialize_shadowsocks_tracker() {
|
||||
local redir_tcp server tracker_server
|
||||
config_get redir_tcp ss_rules redir_tcp
|
||||
|
@ -199,6 +221,11 @@ _multi_server() {
|
|||
[ "$backup" = "1" ] && multiserver=true
|
||||
}
|
||||
|
||||
_gre_tunnel() {
|
||||
config_get proto $1 proto
|
||||
[ "$proto" = "gre" ] && gretunnel=true
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local ss_disabled
|
||||
logger -t "omr-tracker" "Launching..."
|
||||
|
@ -224,6 +251,10 @@ start_service() {
|
|||
config_load openmptcprouter
|
||||
config_foreach _multi_server server
|
||||
[ "$multiserver" = true ] && _launch_server_tracker
|
||||
gretunnel=false
|
||||
config_load network
|
||||
config_foreach _gre_tunnel interface
|
||||
[ "$gretunnel" = true ] && _launch_gre_tracker
|
||||
logger -t "omr-tracker" "Launched"
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ MY_DEPENDS := \
|
|||
!TARGET_mvebu:kmod-usb-net-huawei-cdc-ncm !TARGET_mvebu:kmod-usb-net-rndis !TARGET_mvebu:kmod-usb-net-cdc-ether !TARGET_mvebu:kmod-usb-net-ipheth !TARGET_mvebu:usbmuxd \
|
||||
kmod-rt2800-usb kmod-rtl8xxxu kmod-rtl8192cu kmod-net-rtl8192su \
|
||||
!TARGET_mvebu:luci-proto-qmi wpad-basic kmod-mt7601u kmod-rtl8187 \
|
||||
luci-app-mlvpn mlvpn 464xlat !TARGET_mvebu:kmod-usb-net-smsc75xx kmod-zram kmod-swconfig swconfig kmod-ipt-nat kmod-ipt-nat6 luci-app-https-dns-proxy kmod-tcp-nanqinlang (TARGET_x86_64||TARGET_arm64):kmod-tcp-bbr2 iptables-mod-ipopt igmpproxy ss iptraf-ng \
|
||||
luci-app-mlvpn mlvpn 464xlat !TARGET_mvebu:kmod-usb-net-smsc75xx kmod-zram kmod-swconfig swconfig kmod-ipt-nat kmod-ipt-nat6 luci-app-https-dns-proxy kmod-tcp-nanqinlang (TARGET_x86_64||TARGET_aarch64):kmod-tcp-bbr2 iptables-mod-ipopt igmpproxy ss iptraf-ng \
|
||||
luci-app-acl block-mount blockd fstools luci-app-shutdown libwebp luci-proto-gre tcptraceroute luci-proto-mbim kmod-rtl8xxxu kmod-ath9k-htc luci-app-ttyd luci-mod-dashboard (TARGET_x86||TARGET_x86_64):rtl8192eu-firmware kmod-usb2 libustream-wolfssl (TARGET_x86||TARGET_x86_64):kmod-ixgbevf \
|
||||
hwinfo (TARGET_x86||TARGET_x86_64):dmidecode luci-app-packet-capture kmod-bonding luci-proto-bonding
|
||||
# luci-theme-bootstrap luci-theme-openwrt-2020 luci-theme-openwrt luci-app-status
|
||||
|
|
Loading…
Reference in a new issue