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

Merge branch 'test' into develop

This commit is contained in:
suyuan 2021-02-06 11:49:43 +08:00
commit 89460b0cd8
23 changed files with 473 additions and 276 deletions

View file

@ -37,6 +37,7 @@ _login() {
[ -z "$auth" ] && return
token="$(echo "$auth" | jsonfilter -q -e '@.access_token')"
uci -q set openmptcprouter.${servername}.token="$token"
[ -n "$token" ] && break
}
config_load openmptcprouter
config_list_foreach ${servername} ip login_on_server

View file

@ -1,6 +1,13 @@
#!/bin/sh
# Copyright (C) 2020 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter project
if [ "$(uci -q get shadowsocks-libev.hi)" != ""; then
uci -q batch <<-EOF >/dev/null
rename shadowsocks-libev.hi=hi1
commit shadowsocks-libev
EOF
fi
if [ "$(uci -q get openmptcprouter.latest_versions)" = "" ]; then
NBCPU=$(grep -c '^processor' /proc/cpuinfo | tr -d "\n")
if [ "$NBCPU" -gt 2 ]; then
@ -26,24 +33,16 @@ if [ "$(uci -q get openmptcprouter.latest_versions)" = "" ]; then
fi
fi
if [ "$(uci -q get shadowsocks-libev.hi.timeout)" != "1000" ]; then
uci -q batch <<-EOF > /dev/null
set shadowsocks-libev.hi.timeout=1000
commit shadowsocks-libev
EOF
for c in $(seq 2 $NBCPU); do
if [ "$(uci -q get shadowsocks-libev.hi1.timeout)" != "1000" ]; then
for c in $(seq 1 $NBCPU); do
uci -q batch <<-EOF > /dev/null
set shadowsocks-libev.hi$c.timeout=1000
commit shadowsocks-libev
EOF
done
fi
if [ "$(uci -q get shadowsocks-libev.hi.mode)" != "tcp" ]; then
uci -q batch <<-EOF > /dev/null
set shadowsocks-libev.hi.mode=tcp_and_udp
commit shadowsocks-libev
EOF
for c in $(seq 2 $NBCPU); do
if [ "$(uci -q get shadowsocks-libev.hi1.mode)" != "tcp" ]; then
for c in $(seq 1 $NBCPU); do
uci -q batch <<-EOF > /dev/null
set shadowsocks-libev.hi$c.mode=tcp_and_udp
commit shadowsocks-libev
@ -51,12 +50,16 @@ if [ "$(uci -q get openmptcprouter.latest_versions)" = "" ]; then
done
fi
fi
if [ "$(uci -q get shadowsocks-libev.hi3)" != "" ]; then
port=1101
for c in $(seq 3 2 $NBCPU); do
port=1100
for c in $(seq 1 2 $NBCPU); do
uci -q batch <<-EOF >/dev/null
set shadowsocks-libev.hi$c.local_port=$port
set shadowsocks-libev.hi$c.server=sss0
set shadowsocks-libev.hi$((c+1)).local_port=$port
set shadowsocks-libev.hi$((c+1)).local_address="::"
set shadowsocks-libev.hi$((c+1)).server=sss1
commit shadowsocks-libev
EOF
port=$((port+1))
@ -67,12 +70,12 @@ if [ "$(uci -q get shadowsocks-libev.hi3)" != "" ]; then
EOF
fi
if [ "$(uci -q get shadowsocks-libev.hi.obfs)" = "1" ]; then
if [ "$(uci -q get shadowsocks-libev.hi1.obfs)" = "1" ]; then
uci -q batch <<-EOF > /dev/null
set shadowsocks-libev.sss0.obfs=1
set shadowsocks-libev.sss0.obfs_plugin="$(uci -q get shadowsocks-libev.hi.obfs_plugin)"
set shadowsocks-libev.sss0.obfs_host="$(uci -q get shadowsocks-libev.hi.obfs_host)"
set shadowsocks-libev.sss0.obfs_type="$(uci -q get shadowsocks-libev.hi.obfs_type)"
set shadowsocks-libev.sss0.obfs_plugin="$(uci -q get shadowsocks-libev.hi1.obfs_plugin)"
set shadowsocks-libev.sss0.obfs_host="$(uci -q get shadowsocks-libev.hi1.obfs_host)"
set shadowsocks-libev.sss0.obfs_type="$(uci -q get shadowsocks-libev.hi1.obfs_type)"
commit shadowsocks-libev
EOF
fi
@ -85,12 +88,23 @@ if [ "$(uci -q get shadowsocks-libev.ss_rules.server)" = "" ]; then
fi
if [ "$(uci -q get ucitrack.@shadowsocks-libev[*1].affects | grep openmptcprouter-vps)" = "" ]; then
if [ "$(uci -q get ucitrack.@shadowsocks-libev[-1].affects | grep openmptcprouter-vps)" = "" ]; then
uci -q batch <<-EOF >/dev/null
add_list ucitrack.@shadowsocks-libev[-1].affects="openmptcprouter-vps"
commit ucitrack
EOF
fi
if [ "$(uci -q get shadowsocks-libev.sss1)" = "" ]; then
uci -q batch <<-EOF > /dev/null
set shadowsocks-libev.sss1=server
set shadowsocks-libev.sss1.server_port='65101'
set shadowsocks-libev.sss1.method='chacha20-ietf-poly1305'
set shadowsocks-libev.sss1.obfs='0'
set shadowsocks-libev.sss1.disabled='1'
commit shadowsocks-libev
EOF
fi
rm -f /tmp/luci-indexcache
exit 0

View file

@ -42,9 +42,8 @@ if [ "$(uci -q get dhcp.lan.dhcp_options)" = "" ]; then
commit dhcp
EOF
fi
if [ "$(uci -q get https-dns-proxy.@https-dns-proxy[0].listen_port)" = "5053" ]; then
#if [ "$(uci -q get openmptcprouter.latest_versions)" = "" ] && [ "$(uci -q get https-dns-proxy.@https-dns-proxy[0].listen_port)" = "5053" ]; then
#上面一行是仅在需要时通过HTTPS配置更改DNS可以修改为默认为否
if [ "$(uci -q get openmptcprouter.latest_versions)" = "" ]; then
# uci -q batch <<-EOF >/dev/null
# delete https-dns-proxy.@https-dns-proxy[-1]
# delete https-dns-proxy.@https-dns-proxy[-1]

View file

@ -8,8 +8,6 @@ uci -q batch <<-EOF >/dev/null
commit rpcd
set luci.apply.timeout='20'
commit luci
set fstab.@global[0].check_fs='1'
commit fstab
EOF
if [ "$(uci -q get rpcd.@rpcd[0].socket)" != "/var/run/ubus/ubus.sock" ]; then
@ -20,6 +18,10 @@ if [ "$(uci -q get rpcd.@rpcd[0].socket)" != "/var/run/ubus/ubus.sock" ]; then
fi
/sbin/block detect > /etc/config/fstab
uci -q batch <<-EOF >/dev/null
set fstab.@global[0].check_fs='1'
commit fstab
EOF
[ -n "$(ubus call system board | jsonfilter -e '@.board_name' | grep raspberry)" ] && [ "$(uci -q get openmptcprouter.settings.scaling_governor)" != "performance" ] && {
# force CPU speed for RPI

View file

@ -0,0 +1,10 @@
#!/bin/sh
if [ "$(uci -q get upnpd.config.external_ifac)" != "omrvpn" ]; then
uci -q batch <<-EOF >/dev/null
set upnpd.config.external_iface=omrvpn
commit upnpd
EOF
fi
exit 0