mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-15 03:51:51 +00:00
合并Ysurac/develop的拉取请求#65
sync
This commit is contained in:
commit
f2a9321c87
23 changed files with 472 additions and 274 deletions
|
@ -251,7 +251,7 @@ function wizard_add()
|
||||||
if typeintf == "macvlan" and masterintf ~= "" then
|
if typeintf == "macvlan" and masterintf ~= "" then
|
||||||
ucic:set("network",intf,"type","macvlan")
|
ucic:set("network",intf,"type","macvlan")
|
||||||
ucic:set("network",intf,"masterintf",masterintf)
|
ucic:set("network",intf,"masterintf",masterintf)
|
||||||
elseif typeintf == "" and ifname ~= "" and (proto == "static" or proto == "dhcp" ) then
|
elseif typeintf == "" and ifname ~= "" and (proto == "static" or proto == "dhcp" or proto == "dhcpv6") then
|
||||||
ucic:set("network",intf,"ifname",ifname)
|
ucic:set("network",intf,"ifname",ifname)
|
||||||
elseif typeintf == "" and device ~= "" and proto == "ncm" then
|
elseif typeintf == "" and device ~= "" and proto == "ncm" then
|
||||||
ucic:set("network",intf,"device",device_ncm)
|
ucic:set("network",intf,"device",device_ncm)
|
||||||
|
@ -295,6 +295,11 @@ function wizard_add()
|
||||||
ucic:set("network",intf,"ip6addr","")
|
ucic:set("network",intf,"ip6addr","")
|
||||||
ucic:set("network",intf,"ip6gw","")
|
ucic:set("network",intf,"ip6gw","")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if proto == "dhcpv6" then
|
||||||
|
ucic:set("network",intf,"reqaddress","try")
|
||||||
|
ucic:set("network",intf,"reqprefix","auto")
|
||||||
|
end
|
||||||
|
|
||||||
ucic:delete("openmptcprouter",intf,"lc")
|
ucic:delete("openmptcprouter",intf,"lc")
|
||||||
ucic:save("openmptcprouter")
|
ucic:save("openmptcprouter")
|
||||||
|
@ -437,6 +442,11 @@ function wizard_add()
|
||||||
table.insert(aserverips,ip)
|
table.insert(aserverips,ip)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if disableipv6 == "1" then
|
||||||
|
if table.getn(aserverips) == 2 then
|
||||||
|
table.remove(aserverips, 2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local master = luci.http.formvalue("master") or ""
|
local master = luci.http.formvalue("master") or ""
|
||||||
|
|
||||||
|
@ -477,7 +487,9 @@ function wizard_add()
|
||||||
ucic:set("v2ray","main","enabled","0")
|
ucic:set("v2ray","main","enabled","0")
|
||||||
ucic:foreach("shadowsocks-libev", "server", function(s)
|
ucic:foreach("shadowsocks-libev", "server", function(s)
|
||||||
local sectionname = s[".name"]
|
local sectionname = s[".name"]
|
||||||
ucic:set("shadowsocks-libev",sectionname,"disabled","0")
|
if sectionname:match("^sss.*") then
|
||||||
|
ucic:set("shadowsocks-libev",sectionname,"disabled","0")
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
elseif default_proxy == "v2ray" and serversnb > 0 and serversnb > disablednb then
|
elseif default_proxy == "v2ray" and serversnb > 0 and serversnb > disablednb then
|
||||||
--ucic:set("shadowsocks-libev","sss0","disabled","1")
|
--ucic:set("shadowsocks-libev","sss0","disabled","1")
|
||||||
|
@ -543,9 +555,12 @@ function wizard_add()
|
||||||
local nbip = 0
|
local nbip = 0
|
||||||
for _, ssip in pairs(server_ips) do
|
for _, ssip in pairs(server_ips) do
|
||||||
ucic:set("shadowsocks-libev","sss" .. nbip,"server",ssip)
|
ucic:set("shadowsocks-libev","sss" .. nbip,"server",ssip)
|
||||||
if default_proxy == "shadowsocks" then
|
if default_proxy == "shadowsocks" and serversnb > disablednb then
|
||||||
ucic:set("shadowsocks-libev","sss" .. nbip,"disabled","0")
|
ucic:set("shadowsocks-libev","sss" .. nbip,"disabled","0")
|
||||||
end
|
end
|
||||||
|
if disableipv6 == "1" and nbip > 0 then
|
||||||
|
break
|
||||||
|
end
|
||||||
nbip = nbip + 1
|
nbip = nbip + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -573,10 +588,13 @@ function wizard_add()
|
||||||
local nbip = 0
|
local nbip = 0
|
||||||
for _, ssip in pairs(server_ips) do
|
for _, ssip in pairs(server_ips) do
|
||||||
ucic:set("shadowsocks-libev","sss" .. nbip,"server",ssip)
|
ucic:set("shadowsocks-libev","sss" .. nbip,"server",ssip)
|
||||||
if default_proxy == "shadowsocks" then
|
if default_proxy == "shadowsocks" and serversnb > disablednb then
|
||||||
ucic:set("shadowsocks-libev","sss" .. nbip,"disabled","0")
|
ucic:set("shadowsocks-libev","sss" .. nbip,"disabled","0")
|
||||||
end
|
end
|
||||||
nbip = nbip + 1
|
nbip = nbip + 1
|
||||||
|
if disableipv6 == "1" and nbip > 0 then
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -404,17 +404,26 @@ local statuslogo = ucic:get("openmptcprouter","settings","statuslogo") or "openm
|
||||||
}
|
}
|
||||||
// Populate info
|
// Populate info
|
||||||
var wanip = mArray.wans[i].wanip;
|
var wanip = mArray.wans[i].wanip;
|
||||||
var wanip6 = mArray.wans[i].wanip6;
|
|
||||||
if (anonymize == "true" && testPrivateIP(wanip) == false)
|
if (anonymize == "true" && testPrivateIP(wanip) == false)
|
||||||
{
|
{
|
||||||
wanip=replaceLastNChars(wanip,"x",6);
|
wanip=replaceLastNChars(wanip,"x",6);
|
||||||
}
|
}
|
||||||
|
var wanip6 = mArray.wans[i].wanip6;
|
||||||
|
if (anonymize == "true")
|
||||||
|
{
|
||||||
|
wanip6=replaceLastNChars(wanip6,"x",6);
|
||||||
|
}
|
||||||
var ipaddr = mArray.wans[i].ipaddr;
|
var ipaddr = mArray.wans[i].ipaddr;
|
||||||
var ip6addr = mArray.wans[i].ip6addr;
|
|
||||||
if (anonymize == "true" && testPrivateIP(ipaddr) == false)
|
if (anonymize == "true" && testPrivateIP(ipaddr) == false)
|
||||||
{
|
{
|
||||||
ipaddr=replaceLastNChars(ipaddr,"x",6);
|
ipaddr=replaceLastNChars(ipaddr,"x",6);
|
||||||
}
|
}
|
||||||
|
var ip6addr = mArray.wans[i].ip6addr;
|
||||||
|
if (anonymize == "true")
|
||||||
|
{
|
||||||
|
ip6addr=replaceLastNChars(ip6addr,"x",6);
|
||||||
|
}
|
||||||
|
var ifname = mArray.wans[i].ifname;
|
||||||
var whois = mArray.wans[i].whois;
|
var whois = mArray.wans[i].whois;
|
||||||
var whois6 = mArray.wans[i].whois6;
|
var whois6 = mArray.wans[i].whois6;
|
||||||
var signal = mArray.wans[i].signal;
|
var signal = mArray.wans[i].signal;
|
||||||
|
@ -469,7 +478,7 @@ local statuslogo = ucic:get("openmptcprouter","settings","statuslogo") or "openm
|
||||||
{
|
{
|
||||||
content += String.format('%s <strong>%s</strong><br />','<%:ip address:%>', ipaddr);
|
content += String.format('%s <strong>%s</strong><br />','<%:ip address:%>', ipaddr);
|
||||||
}
|
}
|
||||||
if(ip6addr !== '' && gateway6 != '')
|
if(ip6addr !== '' && gateway6 !== '')
|
||||||
{
|
{
|
||||||
content += String.format('%s <strong>%s</strong><br />','<%:ipv6 address:%>', ip6addr);
|
content += String.format('%s <strong>%s</strong><br />','<%:ipv6 address:%>', ip6addr);
|
||||||
}
|
}
|
||||||
|
@ -481,6 +490,10 @@ local statuslogo = ucic:get("openmptcprouter","settings","statuslogo") or "openm
|
||||||
{
|
{
|
||||||
content += String.format('%s <strong>%s</strong><br />','<%:wan ipv6 address:%>', wanip6);
|
content += String.format('%s <strong>%s</strong><br />','<%:wan ipv6 address:%>', wanip6);
|
||||||
}
|
}
|
||||||
|
if(ifname !== '' && ifname !== mArray.wans[i].label)
|
||||||
|
{
|
||||||
|
content += String.format('%s %s<br />','<%:interface:%>', ifname);
|
||||||
|
}
|
||||||
if(whois !== '')
|
if(whois !== '')
|
||||||
{
|
{
|
||||||
content += String.format('%s %s<br />','<%:whois:%>', whois);
|
content += String.format('%s %s<br />','<%:whois:%>', whois);
|
||||||
|
|
|
@ -65,7 +65,16 @@
|
||||||
</div>
|
</div>
|
||||||
<h3><%=servername%></h3>
|
<h3><%=servername%></h3>
|
||||||
<div class="cbi-section-node" id="cbi-omr-wizard-<%=servername%>">
|
<div class="cbi-section-node" id="cbi-omr-wizard-<%=servername%>">
|
||||||
<div class="cbi-value">
|
<div class="cbi-value" id="<%=servername%>.server_ip" data-depends="[{"enableipv6":"1"}]" data-index="8">
|
||||||
|
<label class="cbi-value-title" for="server_ip.1"><%:Server IP%></label>
|
||||||
|
<div class="cbi-value-field">
|
||||||
|
<input name="<%=servername%>.serverip.ip1" id="<%=servername%>.server_ip.1" placeholder="<%:Server IP%>" class="cbi-input-text" value="<%=uci:get_list("openmptcprouter",servername,"ip")[1]%>" data-optional="false">
|
||||||
|
<div class="cbi-value-description">
|
||||||
|
<%:Server IP will be set for proxy and VPN%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="cbi-value" id="<%=servername%>.server_ipv6" data-depends="[{"enableipv6":"0"}]" data-index="8">
|
||||||
<label class="cbi-value-title" for="server_ip.1"><%:Server IP%></label>
|
<label class="cbi-value-title" for="server_ip.1"><%:Server IP%></label>
|
||||||
<div class="cbi-value-field">
|
<div class="cbi-value-field">
|
||||||
<input name="<%=servername%>.serverip.ip1" id="<%=servername%>.server_ip.1" placeholder="<%:Primary server IP%>" class="cbi-input-text" value="<%=uci:get_list("openmptcprouter",servername,"ip")[1]%>" data-optional="false">
|
<input name="<%=servername%>.serverip.ip1" id="<%=servername%>.server_ip.1" placeholder="<%:Primary server IP%>" class="cbi-input-text" value="<%=uci:get_list("openmptcprouter",servername,"ip")[1]%>" data-optional="false">
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,11 +0,0 @@
|
||||||
msgid ""
|
|
||||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
|
||||||
|
|
||||||
#: applications/luci-app-attendedsysupgrade/luasrc/view/attendedsysupgrade.htm:76
|
|
||||||
#: applications/luci-app-attendedsysupgrade/root/usr/share/luci/menu.d/luci-app-attendedsysupgrade.json:3
|
|
||||||
msgid "Attended Sysupgrade"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: applications/luci-app-attendedsysupgrade/root/usr/share/rpcd/acl.d/attendedsysupgrade.json:3
|
|
||||||
msgid "attended sysupgrade via rpcd and luci"
|
|
||||||
msgstr ""
|
|
81
luci-app-sysupgrade/po/templates/sysupgrade.pot
Normal file
81
luci-app-sysupgrade/po/templates/sysupgrade.pot
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
msgid ""
|
||||||
|
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||||
|
|
||||||
|
#: luci-app-sysupgrade/luasrc/view/sysupgrade.htm:90
|
||||||
|
msgid "Check \"Keep settings\" to retain the current configuration."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: luci-app-sysupgrade/root/www/luci-static/resources/sysupgrade.js:344
|
||||||
|
msgid "Downloading firmware to web browser memory"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: luci-app-sysupgrade/luasrc/view/sysupgrade.htm:78
|
||||||
|
msgid "Easily search and install new releases and package upgrades."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: luci-app-sysupgrade/luasrc/view/sysupgrade.htm:99
|
||||||
|
msgid "Edit installed packages"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: luci-app-sysupgrade/root/www/luci-static/resources/sysupgrade.js:269
|
||||||
|
msgid "Flashing firmware. Don't unpower device"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: luci-app-sysupgrade/root/www/luci-static/resources/sysupgrade.js:192
|
||||||
|
msgid "Installed version:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: luci-app-sysupgrade/luasrc/view/sysupgrade.htm:92
|
||||||
|
msgid "Keep settings:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: luci-app-sysupgrade/root/www/luci-static/resources/sysupgrade.js:215
|
||||||
|
msgid "No upgrades available"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: luci-app-sysupgrade/root/www/luci-static/resources/sysupgrade.js:285
|
||||||
|
msgid "Rebooting device - please wait!"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: luci-app-sysupgrade/root/www/luci-static/resources/sysupgrade.js:209
|
||||||
|
msgid "Request firmware"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: luci-app-sysupgrade/luasrc/view/sysupgrade.htm:110
|
||||||
|
msgid "Search for upgrades"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: luci-app-sysupgrade/root/www/luci-static/resources/sysupgrade.js:165
|
||||||
|
msgid "Searching for upgrades"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: luci-app-sysupgrade/luasrc/view/sysupgrade.htm:103
|
||||||
|
msgid "Server:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: luci-app-sysupgrade/root/www/luci-static/resources/sysupgrade.js:289
|
||||||
|
msgid "Success! Please reload web interface"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: luci-app-sysupgrade/luasrc/view/sysupgrade.htm:76
|
||||||
|
#: luci-app-sysupgrade/root/usr/share/luci/menu.d/luci-app-sysupgrade.json:3
|
||||||
|
msgid "Sysupgrade"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: luci-app-sysupgrade/root/www/luci-static/resources/sysupgrade.js:320
|
||||||
|
msgid "Upload of firmware failed, please retry by reloading web interface"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: luci-app-sysupgrade/root/www/luci-static/resources/sysupgrade.js:305
|
||||||
|
msgid "Uploading firmware to device"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: luci-app-sysupgrade/root/www/luci-static/resources/sysupgrade.js:299
|
||||||
|
msgid ""
|
||||||
|
"Web interface could not reconnect to your device. Please reload web "
|
||||||
|
"interface or check device manually"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: luci-app-sysupgrade/root/usr/share/rpcd/acl.d/sysupgrade.json:3
|
||||||
|
msgid "sysupgrade via rpcd and luci"
|
||||||
|
msgstr ""
|
|
@ -368,7 +368,7 @@ return baseclass.extend({
|
||||||
|
|
||||||
release: {
|
release: {
|
||||||
title: _('Firmware Version'),
|
title: _('Firmware Version'),
|
||||||
value: boardinfo.release.description
|
value: boardinfo.release.description ? boardinfo.release.description : null
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ set_routes_intf() {
|
||||||
interface_gw=$(ubus call network.interface.${INTERFACE}_4 status 2>/dev/null | jsonfilter -q -l 1 -e '@.inactive.route[@.target="0.0.0.0"].nexthop' | tr -d "\n")
|
interface_gw=$(ubus call network.interface.${INTERFACE}_4 status 2>/dev/null | jsonfilter -q -l 1 -e '@.inactive.route[@.target="0.0.0.0"].nexthop' | tr -d "\n")
|
||||||
fi
|
fi
|
||||||
#if [ "$interface_gw" != "" ] && [ "$interface_if" != "" ] && [ "$(ip route show $serverip | grep $interface_if)" = "" ]; then
|
#if [ "$interface_gw" != "" ] && [ "$interface_if" != "" ] && [ "$(ip route show $serverip | grep $interface_if)" = "" ]; then
|
||||||
if [ "$interface_gw" != "" ] && [ "$interface_if" != "" ] && [ -n "$(echo $interface_gw | grep :)" ]; then
|
if [ "$interface_gw" != "" ] && [ "$interface_if" != "" ] && [ -z "$(echo $interface_gw | grep :)" ]; then
|
||||||
if [ "$multipath_config_route" = "master" ]; then
|
if [ "$multipath_config_route" = "master" ]; then
|
||||||
weight=10
|
weight=10
|
||||||
else
|
else
|
||||||
|
@ -827,7 +827,7 @@ if [ "$multipath_config" = "master" ]; then
|
||||||
config_foreach set_route_balancing interface
|
config_foreach set_route_balancing interface
|
||||||
config_foreach set_route_balancing6 interface
|
config_foreach set_route_balancing6 interface
|
||||||
[ -n "$routesbalancing" ] && {
|
[ -n "$routesbalancing" ] && {
|
||||||
([ "$nbintf" -gt "1" ] && [ "$(ip r show default metric 0 | tr -d '\t' | tr -d '\n')" != "default via $routesbalancing " ]) || ([ "$nbintf" = "1" ] && [ "$(ip r show default metric 0 | grep $OMR_TRACKER_DEVICE)" = "" ] && [ -n "$OMR_TRACKER_DEVICE_IP" ]) && {
|
([ "$nbintf" -gt "1" ] && [ "$(ip r show default metric 0 | tr -d '\t' | tr -d '\n')" != "default via $routesbalancing " ]) || ([ "$nbintf" = "1" ] && ([ "$(ip r show default metric 0 | grep $OMR_TRACKER_DEVICE)" = "" ] || [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.vpn)" = "1" ]) && [ -n "$OMR_TRACKER_DEVICE_IP" ]) && {
|
||||||
_log "Set ip route replace default scope global $routesbalancing"
|
_log "Set ip route replace default scope global $routesbalancing"
|
||||||
ip route replace default scope global metric 0 $routesbalancing
|
ip route replace default scope global metric 0 $routesbalancing
|
||||||
}
|
}
|
||||||
|
@ -839,7 +839,7 @@ if [ "$multipath_config" = "master" ]; then
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[ -n "$routesbalancingbackup" ] && {
|
[ -n "$routesbalancingbackup" ] && {
|
||||||
([ "$nbintf" -gt "1" ] && [ "$(ip r show default metric 999 | tr -d '\t' | tr -d '\n')" != "default via $routesbalancingbackup " ]) || ([ "$nbintf" = "1" ] && [ "$(ip r show default metric 999 | grep $OMR_TRACKER_DEVICE)" = "" ] && [ -n "$OMR_TRACKER_DEVICE_IP" ]) && {
|
([ "$nbintf" -gt "1" ] && [ "$(ip r show default metric 999 | tr -d '\t' | tr -d '\n')" != "default via $routesbalancingbackup " ]) || ([ "$nbintf" = "1" ] && ([ "$(ip r show default metric 999 | grep $OMR_TRACKER_DEVICE)" = "" ] || [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.vpn)" = "1" ]) && [ -n "$OMR_TRACKER_DEVICE_IP" ]) && {
|
||||||
_log "Set backup ip route replace default scope global $routesbalancingbackup"
|
_log "Set backup ip route replace default scope global $routesbalancingbackup"
|
||||||
ip route replace default scope global metric 999 $routesbalancingbackup
|
ip route replace default scope global metric 999 $routesbalancingbackup
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,11 +72,11 @@ while true; do
|
||||||
if [ "$(curl -s -I -w %{http_code} --socks5 ${proxy} --max-time ${timeout} $host -o /dev/null)" != "000" ]; then
|
if [ "$(curl -s -I -w %{http_code} --socks5 ${proxy} --max-time ${timeout} $host -o /dev/null)" != "000" ]; then
|
||||||
nocontact=""
|
nocontact=""
|
||||||
[ "${last}" -ge "${retry}" ] || [ "$(uci -q get openmptcprouter.omr.ss_${server})" = "" ] && {
|
[ "${last}" -ge "${retry}" ] || [ "$(uci -q get openmptcprouter.omr.ss_${server})" = "" ] && {
|
||||||
_log "Shadowsocks is up (can contact via http ${host})"
|
_log "Shadowsocks ${server} is up (can contact via http ${host})"
|
||||||
uci -q set openmptcprouter.omr.ss_${server}="up"
|
uci -q set openmptcprouter.omr.ss_${server}="up"
|
||||||
uci -q commit openmptcprouter.omr
|
uci -q commit openmptcprouter.omr
|
||||||
}
|
}
|
||||||
if [ -z "$(iptables -t nat -L -n | grep ss_rules)" ] && [ "$(uci -q get shadowsocks-libev.ss_rules.disabled)" != "1" ]; then
|
if [ -z "$(iptables-save | grep :ssr)" ] && [ "$(uci -q get shadowsocks-libev.ss_rules.disabled)" != "1" ]; then
|
||||||
_log "Reload Shadowsocks rules"
|
_log "Reload Shadowsocks rules"
|
||||||
/etc/init.d/shadowsocks-libev rules_up 2> /dev/null
|
/etc/init.d/shadowsocks-libev rules_up 2> /dev/null
|
||||||
_get_ip
|
_get_ip
|
||||||
|
@ -87,8 +87,8 @@ while true; do
|
||||||
last=$((last + 1 ))
|
last=$((last + 1 ))
|
||||||
[ -z "$nocontact" ] && nocontact="$host" || nocontact="$nocontact, $host"
|
[ -z "$nocontact" ] && nocontact="$host" || nocontact="$nocontact, $host"
|
||||||
[ "${last}" -ge "${retry}" ] && {
|
[ "${last}" -ge "${retry}" ] && {
|
||||||
if [ -n "$(iptables -t nat -L -n | grep ssr)" ]; then
|
if [ -n "$(iptables -w -t nat -L -n | grep ssr)" ]; then
|
||||||
_log "Shadowsocks is down (can't contact via http ${nocontact})"
|
_log "Shadowsocks ${server} is down (can't contact via http ${nocontact})"
|
||||||
uci -q set openmptcprouter.omr.ss_${server}="down"
|
uci -q set openmptcprouter.omr.ss_${server}="down"
|
||||||
uci -q commit openmptcprouter.omr
|
uci -q commit openmptcprouter.omr
|
||||||
[ "$(uci show openmptcprouter.omr | grep ss | grep up)" = "" ] && /etc/init.d/shadowsocks-libev rules_down 2> /dev/null
|
[ "$(uci show openmptcprouter.omr | grep ss | grep up)" = "" ] && /etc/init.d/shadowsocks-libev rules_down 2> /dev/null
|
||||||
|
|
|
@ -139,6 +139,7 @@ _initialize_shadowsocks_tracker() {
|
||||||
#redir_tcp=$(uci -q get shadowsocks-libev.ss_rules.redir_tcp)
|
#redir_tcp=$(uci -q get shadowsocks-libev.ss_rules.redir_tcp)
|
||||||
#config_get tracker_server ss_rules server
|
#config_get tracker_server ss_rules server
|
||||||
config_get ss_disabled $server disabled 0
|
config_get ss_disabled $server disabled 0
|
||||||
|
[ "$ss_disabled" = "0" ] && ss_enable="1"
|
||||||
[ -z "$(uci -q get shadowsocks-libev.tracker_${server})" ] && [ "$ss_disabled" != "1" ] && {
|
[ -z "$(uci -q get shadowsocks-libev.tracker_${server})" ] && [ "$ss_disabled" != "1" ] && {
|
||||||
logger -t "omr-tracker" "Create ShadowSock tracker ss_local..."
|
logger -t "omr-tracker" "Create ShadowSock tracker ss_local..."
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
|
@ -230,7 +231,7 @@ _gre_tunnel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
start_service() {
|
start_service() {
|
||||||
local ss_disabled
|
local ss_enable=0
|
||||||
logger -t "omr-tracker" "Launching..."
|
logger -t "omr-tracker" "Launching..."
|
||||||
config_load shadowsocks-libev
|
config_load shadowsocks-libev
|
||||||
config_foreach _initialize_shadowsocks_tracker server
|
config_foreach _initialize_shadowsocks_tracker server
|
||||||
|
@ -238,7 +239,7 @@ start_service() {
|
||||||
config_load network
|
config_load network
|
||||||
config_foreach _launch_tracker interface
|
config_foreach _launch_tracker interface
|
||||||
|
|
||||||
if [ "$ss_disabled" != "1" ]; then
|
if [ "$ss_enable" = "1" ]; then
|
||||||
config_load shadowsocks-libev
|
config_load shadowsocks-libev
|
||||||
config_foreach _launch_shadowsocks_tracker ss_local
|
config_foreach _launch_shadowsocks_tracker ss_local
|
||||||
#elif [ "$(uci -q get shadowsocks-libev.sss0.disabled)" != "1" ]; then
|
#elif [ "$(uci -q get shadowsocks-libev.sss0.disabled)" != "1" ]; then
|
||||||
|
|
|
@ -50,6 +50,7 @@ MY_DEPENDS := \
|
||||||
speedtestc \
|
speedtestc \
|
||||||
iftop \
|
iftop \
|
||||||
htop \
|
htop \
|
||||||
|
nano \
|
||||||
tcpdump \
|
tcpdump \
|
||||||
ethtool \
|
ethtool \
|
||||||
iputils-ping \
|
iputils-ping \
|
||||||
|
|
|
@ -37,6 +37,7 @@ _login() {
|
||||||
[ -z "$auth" ] && return
|
[ -z "$auth" ] && return
|
||||||
token="$(echo "$auth" | jsonfilter -q -e '@.access_token')"
|
token="$(echo "$auth" | jsonfilter -q -e '@.access_token')"
|
||||||
uci -q set openmptcprouter.${servername}.token="$token"
|
uci -q set openmptcprouter.${servername}.token="$token"
|
||||||
|
[ -n "$token" ] && break
|
||||||
}
|
}
|
||||||
config_load openmptcprouter
|
config_load openmptcprouter
|
||||||
config_list_foreach ${servername} ip login_on_server
|
config_list_foreach ${servername} ip login_on_server
|
||||||
|
|
|
@ -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))
|
||||||
|
@ -67,12 +70,12 @@ if [ "$(uci -q get shadowsocks-libev.hi3)" != "" ]; then
|
||||||
EOF
|
EOF
|
||||||
fi
|
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
|
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
|
||||||
|
|
|
@ -40,7 +40,7 @@ if [ "$(uci -q get dhcp.lan.dhcp_options)" = "" ]; then
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$(uci -q get openmptcprouter.latest_versions)" = "" ] && [ "$(uci -q get https-dns-proxy.@https-dns-proxy[0].listen_port)" = "5053" ]; then
|
if [ "$(uci -q get openmptcprouter.latest_versions)" = "" ]; then
|
||||||
# uci -q batch <<-EOF >/dev/null
|
# uci -q batch <<-EOF >/dev/null
|
||||||
# delete https-dns-proxy.@https-dns-proxy[-1]
|
# delete https-dns-proxy.@https-dns-proxy[-1]
|
||||||
# delete https-dns-proxy.@https-dns-proxy[-1]
|
# delete https-dns-proxy.@https-dns-proxy[-1]
|
||||||
|
|
|
@ -8,8 +8,6 @@ uci -q batch <<-EOF >/dev/null
|
||||||
commit rpcd
|
commit rpcd
|
||||||
set luci.apply.timeout='20'
|
set luci.apply.timeout='20'
|
||||||
commit luci
|
commit luci
|
||||||
set fstab.@global[0].check_fs='1'
|
|
||||||
commit fstab
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
if [ "$(uci -q get rpcd.@rpcd[0].socket)" != "/var/run/ubus/ubus.sock" ]; then
|
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
|
fi
|
||||||
|
|
||||||
/sbin/block detect > /etc/config/fstab
|
/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" ] && {
|
[ -n "$(ubus call system board | jsonfilter -e '@.board_name' | grep raspberry)" ] && [ "$(uci -q get openmptcprouter.settings.scaling_governor)" != "performance" ] && {
|
||||||
# force CPU speed for RPI
|
# force CPU speed for RPI
|
||||||
|
|
10
openmptcprouter/files/etc/uci-defaults/2092-upnpd
Executable file
10
openmptcprouter/files/etc/uci-defaults/2092-upnpd
Executable 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
|
|
@ -1,4 +1,4 @@
|
||||||
config ss_redir hi
|
config ss_redir hi1
|
||||||
option server 'sss0'
|
option server 'sss0'
|
||||||
option local_address '::'
|
option local_address '::'
|
||||||
option local_port '1100'
|
option local_port '1100'
|
||||||
|
|
|
@ -308,6 +308,7 @@ start_service() {
|
||||||
# Add rule to match traffic marked by firewall for bypass
|
# Add rule to match traffic marked by firewall for bypass
|
||||||
ip rule add prio 1 fwmark 0x539 lookup 991337 > /dev/null 2>&1
|
ip rule add prio 1 fwmark 0x539 lookup 991337 > /dev/null 2>&1
|
||||||
rules_up
|
rules_up
|
||||||
|
[ -f /etc/firewall.gre-tunnel ] && sh /etc/firewall.gre-tunnel > /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_service() {
|
stop_service() {
|
||||||
|
@ -320,7 +321,7 @@ reload_service() {
|
||||||
}
|
}
|
||||||
|
|
||||||
rules_exist() {
|
rules_exist() {
|
||||||
[ -n "$(iptables -t nat -L -n | grep ssr)" ] && return 0
|
[ -n "$(iptables-save | grep 'A ssr')" ] && return 0
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,6 +348,7 @@ rules_up() {
|
||||||
config_foreach ss_rules_restart "$cfgtype" "$cfgtype"
|
config_foreach ss_rules_restart "$cfgtype" "$cfgtype"
|
||||||
done
|
done
|
||||||
config_foreach ss_rules ss_rules
|
config_foreach ss_rules ss_rules
|
||||||
|
[ -z "$(iptables-save | grep :ssr)" ] && logger -t "Shadowsocks" "Rules not applied"
|
||||||
[ -f /etc/init.d/omr-bypass ] && {
|
[ -f /etc/init.d/omr-bypass ] && {
|
||||||
logger -t "Shadowsocks" "Reload omr-bypass rules"
|
logger -t "Shadowsocks" "Reload omr-bypass rules"
|
||||||
/etc/init.d/omr-bypass reload_rules
|
/etc/init.d/omr-bypass reload_rules
|
||||||
|
|
|
@ -187,7 +187,7 @@ ss_rules_iptchains_init_tcp() {
|
||||||
forward) local_target=ssr_${rule}_forward ;;
|
forward) local_target=ssr_${rule}_forward ;;
|
||||||
bypass|*) return 0;;
|
bypass|*) return 0;;
|
||||||
esac
|
esac
|
||||||
if [ "$(iptables -t nat -L ssr_${rule}_local_out | grep ssr_${rule}_dst_bypass)" = "" ]; then
|
if [ "$(iptables-save | grep ssr_${rule}_local_out | grep ssr_${rule}_dst_bypass)" = "" ]; then
|
||||||
iptables-restore -w --noflush <<-EOF
|
iptables-restore -w --noflush <<-EOF
|
||||||
*nat
|
*nat
|
||||||
:ssr_${rule}_local_out -
|
:ssr_${rule}_local_out -
|
||||||
|
|
|
@ -175,7 +175,7 @@ ss_rules6_iptchains_init_tcp() {
|
||||||
:ssr6_${rule}_local_out -
|
:ssr6_${rule}_local_out -
|
||||||
-I OUTPUT 1 -p tcp -j ssr6_${rule}_local_out
|
-I OUTPUT 1 -p tcp -j ssr6_${rule}_local_out
|
||||||
-A ssr6_${rule}_local_out -m set --match-set ssr6_${rule}_dst_bypass dst -j RETURN
|
-A ssr6_${rule}_local_out -m set --match-set ssr6_${rule}_dst_bypass dst -j RETURN
|
||||||
-A ssr6_${rule}_local_out -m set --match-set ssr6_${rule}_dst_bypass_all dst -j RETURN
|
-A ssr6_${rule}_local_out -m set --match-set ss_rules6_dst_bypass_all dst -j RETURN
|
||||||
-A ssr6_${rule}_local_out -m set --match-set ssr6_${rule}_dst_bypass_ dst -j RETURN
|
-A ssr6_${rule}_local_out -m set --match-set ssr6_${rule}_dst_bypass_ dst -j RETURN
|
||||||
-A ssr6_${rule}_local_out -m mark --mark 0x6539 -j RETURN
|
-A ssr6_${rule}_local_out -m mark --mark 0x6539 -j RETURN
|
||||||
-A ssr6_${rule}_local_out -p tcp $o_ipt_extra -j $local_target -m comment --comment "local_default: $o_local_default"
|
-A ssr6_${rule}_local_out -p tcp $o_ipt_extra -j $local_target -m comment --comment "local_default: $o_local_default"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
#
|
#
|
||||||
# Copyright 2019-2020 Xingwang Liao <kuoruan@gmail.com>
|
# Copyright 2019-2020 Xingwang Liao <kuoruan@gmail.com>
|
||||||
# Copyright 2020 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
# Copyright 2020-2021 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
||||||
# Licensed to the public under the MIT License.
|
# Licensed to the public under the MIT License.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017 Yousong Zhou <yszhou4tech@gmail.com>
|
# Copyright (C) 2017 Yousong Zhou <yszhou4tech@gmail.com>
|
||||||
# Copyright (C) 2018-2020 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
# Copyright (C) 2018-2021 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
||||||
#
|
#
|
||||||
# The design idea was derived from ss-rules by Jian Chang <aa65535@live.com>
|
# The design idea was derived from ss-rules by Jian Chang <aa65535@live.com>
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017 Yousong Zhou <yszhou4tech@gmail.com>
|
# Copyright (C) 2017 Yousong Zhou <yszhou4tech@gmail.com>
|
||||||
# Copyright (C) 2018-2020 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
# Copyright (C) 2018-2021 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
||||||
#
|
#
|
||||||
# The design idea was derived from ss-rules by Jian Chang <aa65535@live.com>
|
# The design idea was derived from ss-rules by Jian Chang <aa65535@live.com>
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue