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

Add sss1 server for secondary server ip and rename ss_redir hi to hi1

This commit is contained in:
Ycarus (Yannick Chabanois) 2021-02-04 11:09:33 +01:00
parent 398d47d1fd
commit e90e6eab51

View file

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