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 #162 from Ysurac/develop

sync
This commit is contained in:
suyuan 2021-07-18 19:15:26 +08:00 committed by GitHub
commit 2a0275bfb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 23 deletions

View file

@ -100,12 +100,14 @@ _bypass_domain() {
fi fi
if [ "$(uci -q get dhcp.@dnsmasq[0].ipset | grep /$domain/)" = "" ]; then if [ "$(uci -q get dhcp.@dnsmasq[0].ipset | grep /$domain/)" = "" ]; then
uci -q add_list dhcp.@dnsmasq[0].ipset="/$domain/omr_dst_bypass_$intf,omr6_dst_bypass_$intf" uci -q add_list dhcp.@dnsmasq[0].ipset="/$domain/omr_dst_bypass_$intf,omr6_dst_bypass_$intf"
add_domains="true"
else else
dnsmasqipset=$(uci -q get dhcp.@dnsmasq[0].ipset | sed 's/ /\n/g') dnsmasqipset=$(uci -q get dhcp.@dnsmasq[0].ipset | sed 's/ /\n/g')
for dnsipset in $dnsmasqipset; do for dnsipset in $dnsmasqipset; do
if [ "$(echo $dnsipset | cut -d/ -f2)" = "$domain" ]; then if [ "$(echo $dnsipset | cut -d/ -f2)" = "$domain" ]; then
uci -q del_list dhcp.@dnsmasq[0].ipset=$dnsipset uci -q del_list dhcp.@dnsmasq[0].ipset=$dnsipset
uci -q add_list dhcp.@dnsmasq[0].ipset="$dnsipset,omr_dst_bypass_$intf,omr6_dst_bypass_$intf" uci -q add_list dhcp.@dnsmasq[0].ipset="$dnsipset,omr_dst_bypass_$intf,omr6_dst_bypass_$intf"
add_domains="true"
fi fi
done done
fi fi
@ -680,6 +682,7 @@ boot() {
start_service() { start_service() {
#local count #local count
logger -t "omr-bypass" "Starting OMR-ByPass..." logger -t "omr-bypass" "Starting OMR-ByPass..."
add_domains="false"
config_load omr-bypass config_load omr-bypass
config_foreach _add_proto proto config_foreach _add_proto proto
disableipv6="$(uci -q get openmptcprouter.settings.disable_ipv6)" disableipv6="$(uci -q get openmptcprouter.settings.disable_ipv6)"
@ -797,11 +800,11 @@ start_service() {
config_foreach _bypass_proto dpis config_foreach _bypass_proto dpis
uci -q commit omr-bypass uci -q commit omr-bypass
[ -z "$RELOAD" ] && { [ -z "$RELOAD" ] && [ "$add_domains" = "true" ] && {
logger -t "omr-bypass" "Restart dnsmasq..." logger -t "omr-bypass" "Restart dnsmasq..."
/etc/init.d/dnsmasq restart /etc/init.d/dnsmasq restart
} }
[ -n "$RELOAD" ] && { [ -n "$RELOAD" ] && [ "$add_domains" = "true" ] && {
logger -t "omr-bypass" "Reload dnsmasq..." logger -t "omr-bypass" "Reload dnsmasq..."
/etc/init.d/dnsmasq reload /etc/init.d/dnsmasq reload
} }

View file

@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh
# vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 : # vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 :
OVH=false HETZNER=false
if [ "$1" = "ovh" ]; then if [ "$1" = "hetzner" ]; then
OVH=true hetzner=true
INTERFACE="$2" INTERFACE="$2"
else else
INTERFACE="$1" INTERFACE="$1"
@ -13,9 +13,9 @@ fi
exit 0 exit 0
} }
if [ "$OVH" = false ]; then if [ "$HETZNER" = false ]; then
echo "Select best test server..." echo "Select best test server..."
HOSTLST="http://speedtest.frankfurt.linode.com/garbage.php?ckSize=10000 http://speedtest.tokyo2.linode.com/garbage.php?ckSize=10000 http://speedtest.singapore.linode.com/garbage.php?ckSize=10000 http://speedtest.newark.linode.com/garbage.php?ckSize=10000 http://speedtest.atlanta.linode.com/garbage.php?ckSize=10000 http://speedtest.dallas.linode.com/garbage.php?ckSize=10000 http://speedtest.fremont.linode.com/garbage.php?ckSize=10000 http://speedtest.tele2.net/1000GB.zip http://proof.ovh.net/files/10Gb.dat https://speed.hetzner.de/10GB.bin http://ipv4.bouygues.testdebit.info/10G.iso http://par.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin http://ams.download.datapacket.com/10000mb.bin http://fra.download.datapacket.com/10000mb.bin http://lon.download.datapacket.com/10000mb.bin http://mad.download.datapacket.com/10000mb.bin http://prg.download.datapacket.com/10000mb.bin http://sto.download.datapacket.com/10000mb.bin http://vie.download.datapacket.com/10000mb.bin http://war.download.datapacket.com/10000mb.bin http://atl.download.datapacket.com/10000mb.bin http://chi.download.datapacket.com/10000mb.bin http://lax.download.datapacket.com/10000mb.bin http://mia.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin" HOSTLST="http://speedtest.frankfurt.linode.com/garbage.php?ckSize=10000 http://speedtest.tokyo2.linode.com/garbage.php?ckSize=10000 http://speedtest.singapore.linode.com/garbage.php?ckSize=10000 http://speedtest.newark.linode.com/garbage.php?ckSize=10000 http://speedtest.atlanta.linode.com/garbage.php?ckSize=10000 http://speedtest.dallas.linode.com/garbage.php?ckSize=10000 http://speedtest.fremont.linode.com/garbage.php?ckSize=10000 http://speedtest.tele2.net/1000GB.zip https://speed.hetzner.de/10GB.bin http://ipv4.bouygues.testdebit.info/10G.iso http://par.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin http://ams.download.datapacket.com/10000mb.bin http://fra.download.datapacket.com/10000mb.bin http://lon.download.datapacket.com/10000mb.bin http://mad.download.datapacket.com/10000mb.bin http://prg.download.datapacket.com/10000mb.bin http://sto.download.datapacket.com/10000mb.bin http://vie.download.datapacket.com/10000mb.bin http://war.download.datapacket.com/10000mb.bin http://atl.download.datapacket.com/10000mb.bin http://chi.download.datapacket.com/10000mb.bin http://lax.download.datapacket.com/10000mb.bin http://mia.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin"
bestping="9999" bestping="9999"
for pinghost in $HOSTLST; do for pinghost in $HOSTLST; do
domain=$(echo $pinghost | awk -F/ '{print $3}') domain=$(echo $pinghost | awk -F/ '{print $3}')
@ -32,7 +32,7 @@ if [ "$OVH" = false ]; then
done done
fi fi
[ -z "$HOST" ] && HOST="http://proof.ovh.net/files/10Gio.dat" [ -z "$HOST" ] && HOST="https://speed.hetzner.de/10GB.bin"
echo "Best server is $HOST, running test:" echo "Best server is $HOST, running test:"
trap : HUP INT TERM trap : HUP INT TERM

View file

@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh
# vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 : # vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 :
OVH=false HETZNER=false
if [ "$1" = "ovh" ]; then if [ "$1" = "hetzner" ]; then
OVH=true HETZNER=true
INTERFACE="$2" INTERFACE="$2"
else else
INTERFACE="$1" INTERFACE="$1"
@ -14,9 +14,9 @@ fi
} }
if [ "$OVH" = false ]; then if [ "$HETZNER" = false ]; then
echo "Select best test server..." echo "Select best test server..."
HOSTLST="http://speedtest.frankfurt.linode.com/garbage.php?ckSize=10000 http://speedtest.tokyo2.linode.com/garbage.php?ckSize=10000 http://speedtest.singapore.linode.com/garbage.php?ckSize=10000 http://speedtest.newark.linode.com/garbage.php?ckSize=10000 http://speedtest.atlanta.linode.com/garbage.php?ckSize=10000 http://speedtest.dallas.linode.com/garbage.php?ckSize=10000 http://speedtest.fremont.linode.com/garbage.php?ckSize=10000 http://speedtest.tele2.net/1000GB.zip http://www.ovh.net/files/10Gb.dat https://speed.hetzner.de/10GB.bin http://ipv6.bouygues.testdebit.info/10G.iso http://par.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin http://ams.download.datapacket.com/10000mb.bin http://fra.download.datapacket.com/10000mb.bin http://lon.download.datapacket.com/10000mb.bin http://mad.download.datapacket.com/10000mb.bin http://prg.download.datapacket.com/10000mb.bin http://sto.download.datapacket.com/10000mb.bin http://vie.download.datapacket.com/10000mb.bin http://war.download.datapacket.com/10000mb.bin http://atl.download.datapacket.com/10000mb.bin http://chi.download.datapacket.com/10000mb.bin http://lax.download.datapacket.com/10000mb.bin http://mia.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin" HOSTLST="http://speedtest.frankfurt.linode.com/garbage.php?ckSize=10000 http://speedtest.tokyo2.linode.com/garbage.php?ckSize=10000 http://speedtest.singapore.linode.com/garbage.php?ckSize=10000 http://speedtest.newark.linode.com/garbage.php?ckSize=10000 http://speedtest.atlanta.linode.com/garbage.php?ckSize=10000 http://speedtest.dallas.linode.com/garbage.php?ckSize=10000 http://speedtest.fremont.linode.com/garbage.php?ckSize=10000 http://speedtest.tele2.net/1000GB.zip https://speed.hetzner.de/10GB.bin http://ipv6.bouygues.testdebit.info/10G.iso http://par.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin http://ams.download.datapacket.com/10000mb.bin http://fra.download.datapacket.com/10000mb.bin http://lon.download.datapacket.com/10000mb.bin http://mad.download.datapacket.com/10000mb.bin http://prg.download.datapacket.com/10000mb.bin http://sto.download.datapacket.com/10000mb.bin http://vie.download.datapacket.com/10000mb.bin http://war.download.datapacket.com/10000mb.bin http://atl.download.datapacket.com/10000mb.bin http://chi.download.datapacket.com/10000mb.bin http://lax.download.datapacket.com/10000mb.bin http://mia.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin"
bestping="9999" bestping="9999"
for pinghost in $HOSTLST; do for pinghost in $HOSTLST; do
domain=$(echo $pinghost | awk -F/ '{print $3}') domain=$(echo $pinghost | awk -F/ '{print $3}')
@ -33,7 +33,7 @@ if [ "$OVH" = false ]; then
done done
fi fi
[ -z "$HOST" ] && HOST="http://proof.ovh.net/files/10Gio.dat" [ -z "$HOST" ] && HOST="https://speed.hetzner.de/10GB.bin"
echo "Best server is $HOST, running test:" echo "Best server is $HOST, running test:"
trap : HUP INT TERM trap : HUP INT TERM

View file

@ -1,18 +1,22 @@
#!/bin/sh #!/bin/sh
if [ "$(uci -q get wireless.radio0)" != "" ]; then if [ "$(uci -q get wifi-iface.radio0)" != "" ] && [ "$(uci -q get wifi-iface.default_radio0.key)" = "12345678" ]; then
if [ "$(uci -q get wireless.radio0.country)" = "" ]; then if [ "$(uci -q get wifi-device.radio0.country)" = "" ]; then
uci -q batch <<-EOF >/dev/null uci -q batch <<-EOF >/dev/null
set wireless.radio0.country='00' set wifi-device.radio0.country='00'
set wireless.default_radio0.skip_inactivity_poll='1' commit wifi-device
commit wireless
EOF EOF
fi fi
if [ "$(uci -q get wireless.default_radio0.network)" = "lan" ]; then if [ -n "$(uci -q get wifi-iface.radio0.network | grep lan)" ]; then
uci -q batch <<-EOF >/dev/null uci -q batch <<-EOF >/dev/null
set wireless.default_radio0.network='wifi' set wifi-iface.default_radio0.network='wifi'
commit wireless commit wifi-iface
EOF
fi
if [ -n "$(uci -q get wifi-device.radio0.cell_density)" ]; then
uci -q batch <<-EOF >/dev/null
delete wifi-device.radio0.cell_density
commit wifi-device
EOF EOF
fi fi
fi fi