mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
sync (#568)
This commit is contained in:
commit
566240db5c
3 changed files with 68 additions and 17 deletions
|
@ -1076,6 +1076,14 @@ function wizard_add()
|
||||||
luci.sys.call("/etc/init.d/shadowsocks-rust rules_down >/dev/null 2>/dev/null")
|
luci.sys.call("/etc/init.d/shadowsocks-rust rules_down >/dev/null 2>/dev/null")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Enable/disable v2ray/xray udp
|
||||||
|
local v2rayudp = luci.http.formvalue("v2rayudp") or "0"
|
||||||
|
ucic:set("v2ray","main_transparent_proxy","redirect_udp",v2rayudp)
|
||||||
|
ucic:save("v2ray")
|
||||||
|
ucic:commit("v2ray")
|
||||||
|
ucic:set("xray","main_transparent_proxy","redirect_udp",v2rayudp)
|
||||||
|
ucic:save("xray")
|
||||||
|
ucic:commit("xray")
|
||||||
|
|
||||||
local v2ray_user = luci.http.formvalue("v2ray_user")
|
local v2ray_user = luci.http.formvalue("v2ray_user")
|
||||||
ucic:set("v2ray","omrout","s_vmess_user_id",v2ray_user)
|
ucic:set("v2ray","omrout","s_vmess_user_id",v2ray_user)
|
||||||
|
@ -1084,13 +1092,15 @@ function wizard_add()
|
||||||
ucic:set("v2ray","omrout","s_socks_user_id",v2ray_user)
|
ucic:set("v2ray","omrout","s_socks_user_id",v2ray_user)
|
||||||
ucic:save("v2ray")
|
ucic:save("v2ray")
|
||||||
ucic:commit("v2ray")
|
ucic:commit("v2ray")
|
||||||
ucic:set("xray","omrout","s_vmess_user_id",v2ray_user)
|
local xray_user = luci.http.formvalue("xray_user")
|
||||||
ucic:set("xray","omrout","s_vless_user_id",v2ray_user)
|
ucic:set("xray","omrout","s_vmess_user_id",xray_user)
|
||||||
ucic:set("xray","omrout","s_vless_reality_user_id",v2ray_user)
|
ucic:set("xray","omrout","s_vless_user_id",xray_user)
|
||||||
ucic:set("xray","omrout","s_trojan_user_id",v2ray_user)
|
ucic:set("xray","omrout","s_vless_reality_user_id",xray_user)
|
||||||
ucic:set("xray","omrout","s_socks_user_id",v2ray_user)
|
ucic:set("xray","omrout","s_trojan_user_id",xray_user)
|
||||||
|
ucic:set("xray","omrout","s_socks_user_id",xray_user)
|
||||||
ucic:save("xray")
|
ucic:save("xray")
|
||||||
ucic:commit("xray")
|
ucic:commit("xray")
|
||||||
|
|
||||||
ucic:save("shadowsocks-libev")
|
ucic:save("shadowsocks-libev")
|
||||||
ucic:commit("shadowsocks-libev")
|
ucic:commit("shadowsocks-libev")
|
||||||
ucic:save("shadowsocks-rust")
|
ucic:save("shadowsocks-rust")
|
||||||
|
|
|
@ -321,14 +321,38 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if nixio.fs.access("/etc/init.d/v2ray") or nixio.fs.access("/etc/init.d/xray") then %>
|
<% if nixio.fs.access("/etc/init.d/v2ray") then %>
|
||||||
<div class="cbi-value">
|
<div class="cbi-value">
|
||||||
<label class="cbi-value-title"><%:V2Ray/XRay user id%></label>
|
<label class="cbi-value-title"><%:V2Ray user id%></label>
|
||||||
<div class="cbi-value-field">
|
<div class="cbi-value-field">
|
||||||
<input type="text" name="v2ray_user" placeholder="<%:V2Ray user%>" class="cbi-input-text" value="<%=uci:get("v2ray","omrout","s_vmess_user_id")%>" />
|
<input type="text" name="v2ray_user" placeholder="<%:V2Ray user%>" class="cbi-input-text" value="<%=uci:get("v2ray","omrout","s_vmess_user_id")%>" />
|
||||||
<br />
|
<br />
|
||||||
<div class="cbi-value-description">
|
<div class="cbi-value-description">
|
||||||
<%:Key is retrieved from server API by default.%> <%:V2Ray is used for TCP and UDP.%>
|
<%:Key is retrieved from server API by default.%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% if nixio.fs.access("/etc/init.d/xray") then %>
|
||||||
|
<div class="cbi-value">
|
||||||
|
<label class="cbi-value-title"><%:XRay user id%></label>
|
||||||
|
<div class="cbi-value-field">
|
||||||
|
<input type="text" name="xray_user" placeholder="<%:XRay user%>" class="cbi-input-text" value="<%=uci:get("xray","omrout","s_vmess_user_id")%>" />
|
||||||
|
<br />
|
||||||
|
<div class="cbi-value-description">
|
||||||
|
<%:Key is retrieved from server API by default.%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% if nixio.fs.access("/etc/init.d/xray") or nixio.fs.access("/etc/init.d/v2ray") then %>
|
||||||
|
<div class="cbi-value">
|
||||||
|
<label class="cbi-value-title"><%:V2Ray/XRay UDP%></label>
|
||||||
|
<div class="cbi-value-field">
|
||||||
|
<input type="checkbox" name="v2rayudp" class="cbi-input-checkbox" value="1" <% if luci.model.uci.cursor():get("v2ray","main_transparent_proxy","redirect_udp") == "1" or luci.model.uci.cursor():get("xray","main_transparent_proxy","redirect_udp") == "1" then %>checked<% end %>>
|
||||||
|
<br />
|
||||||
|
<div class="cbi-value-description">
|
||||||
|
<%:When proxy V2Ray/XRay VLESS, VMESS or Trojan is used, use it for UDP%>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -164,6 +164,7 @@ _ping() {
|
||||||
"${host}" 2>&1
|
"${host}" 2>&1
|
||||||
)
|
)
|
||||||
loss=$(echo "$ret" | awk '/packet loss/ {gsub("%","");print $6}' | tr -d '\n')
|
loss=$(echo "$ret" | awk '/packet loss/ {gsub("%","");print $6}' | tr -d '\n')
|
||||||
|
|
||||||
if [ -n "$loss" ] && [ "$loss" != "100" ]; then
|
if [ -n "$loss" ] && [ "$loss" != "100" ]; then
|
||||||
if [ "$localip" = "yes" ]; then
|
if [ "$localip" = "yes" ]; then
|
||||||
latency=$(echo "$ret" | awk -F/ '/rtt/ {print int($5)}' | tr -d '\n')
|
latency=$(echo "$ret" | awk -F/ '/rtt/ {print int($5)}' | tr -d '\n')
|
||||||
|
@ -205,7 +206,7 @@ _ping() {
|
||||||
fi
|
fi
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
#'
|
||||||
_httping() {
|
_httping() {
|
||||||
local host=$1
|
local host=$1
|
||||||
local deviceip=$2
|
local deviceip=$2
|
||||||
|
@ -216,25 +217,41 @@ _httping() {
|
||||||
-y "${deviceip}" \
|
-y "${deviceip}" \
|
||||||
-t "$OMR_TRACKER_TIMEOUT" \
|
-t "$OMR_TRACKER_TIMEOUT" \
|
||||||
-c "$OMR_TRACKER_COUNT" 2>&1
|
-c "$OMR_TRACKER_COUNT" 2>&1
|
||||||
) && echo "$ret" | grep -sq "1 ok" && {
|
)
|
||||||
|
bindcheck=$(echo "$ret" | grep "Address not available")
|
||||||
|
[ -n "$bindcheck" ] && OMR_TRACKER_NO_BIND=1
|
||||||
|
loss=$(echo "$ret" | awk '/failed/ {gsub("%",""); print int($5)}' | tr -d '\n')
|
||||||
|
if [ -n "$loss" ] && [ "$loss" != "100" ]; then
|
||||||
if [ "$localip" = "yes" ]; then
|
if [ "$localip" = "yes" ]; then
|
||||||
OMR_TRACKER_LATENCY=$(echo "$ret" | cut -d "/" -s -f5 | cut -d "." -f1 | tr -d '\n')
|
latency=$(echo "$ret" | cut -d "/" -s -f5 | cut -d "." -f1 | tr -d '\n')
|
||||||
|
[ -n "$latency" ] && {
|
||||||
|
OMR_TRACKER_LATENCY="$latency"
|
||||||
#_update_rto "$OMR_TRACKER_LATENCY"
|
#_update_rto "$OMR_TRACKER_LATENCY"
|
||||||
|
}
|
||||||
|
OMR_TRACKER_LOSS="$loss"
|
||||||
fi
|
fi
|
||||||
return
|
return
|
||||||
}
|
fi
|
||||||
else
|
else
|
||||||
ret=$(httping -l "${host}" \
|
ret=$(httping -l "${host}" \
|
||||||
-y "${deviceip}" \
|
-y "${deviceip}" \
|
||||||
-t "$OMR_TRACKER_TIMEOUT" \
|
-t "$OMR_TRACKER_TIMEOUT" \
|
||||||
-c "$OMR_TRACKER_COUNT" 2>&1
|
-c "$OMR_TRACKER_COUNT" 2>&1
|
||||||
) && echo "$ret" | grep -sq "1 ok" && {
|
)
|
||||||
|
bindcheck=$(echo "$ret" | grep "Address not available")
|
||||||
|
[ -n "$bindcheck" ] && OMR_TRACKER_NO_BIND=1
|
||||||
|
loss=$(echo "$ret" | awk '/failed/ {gsub("%",""); print int($5)}' | tr -d '\n')
|
||||||
|
if [ -n "$loss" ] && [ "$loss" != "100" ]; then
|
||||||
if [ "$localip" = "yes" ]; then
|
if [ "$localip" = "yes" ]; then
|
||||||
OMR_TRACKER_LATENCY=$(echo "$ret" | cut -d "/" -s -f5 | cut -d "." -f1 | tr -d '\n')
|
latency=$(echo "$ret" | cut -d "/" -s -f5 | cut -d "." -f1 | tr -d '\n')
|
||||||
|
[ -n "$latency" ] && {
|
||||||
|
OMR_TRACKER_LATENCY="$latency"
|
||||||
#_update_rto "$OMR_TRACKER_LATENCY"
|
#_update_rto "$OMR_TRACKER_LATENCY"
|
||||||
|
}
|
||||||
|
OMR_TRACKER_LOSS="$loss"
|
||||||
fi
|
fi
|
||||||
return
|
return
|
||||||
}
|
fi
|
||||||
fi
|
fi
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue