mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
sync (#387)
This commit is contained in:
commit
077717e91d
7 changed files with 112 additions and 4 deletions
|
@ -232,6 +232,42 @@
|
|||
<label class="cbi-value-title"><%:Default Proxy%></label>
|
||||
<div class="cbi-value-field">
|
||||
<select class="cbi-input-select" name="default_proxy" size="1">
|
||||
<%
|
||||
local available_proxys = uci:get("openmptcprouter","vps","available_proxy") or ""
|
||||
if available_proxys ~= "" then
|
||||
if (type(available_proxys) ~= "table") then
|
||||
available_proxys = {available_proxys}
|
||||
end
|
||||
for _, proxy in pairs(available_proxys) do
|
||||
if proxy == "shadowsocks" then %>
|
||||
<% if nixio.fs.access("/etc/init.d/shadowsocks-libev") then %><option value="shadowsocks" <% if uci:get("openmptcprouter","settings","shadowsocks") == "0" or uci:get("openmptcprouter","settings","proxy") == nil then %>selected="selected"<% end %>>Shadowsocks</option><% end %>
|
||||
<% elseif proxy == "v2ray" then %>
|
||||
<% if nixio.fs.access("/etc/init.d/v2ray") then %><option value="v2ray" <% if uci:get("openmptcprouter","settings","proxy") == "v2ray" then %>selected="selected"<% end %>>V2Ray VLESS</option><% end %>
|
||||
<% elseif proxy == "v2ray-vmess" then %>
|
||||
<% if nixio.fs.access("/etc/init.d/v2ray") then %><option value="v2ray-vmess" <% if uci:get("openmptcprouter","settings","proxy") == "v2ray-vmess" then %>selected="selected"<% end %>>V2Ray VMESS</option><% end %>
|
||||
<% elseif proxy == "v2ray-trojan" then %>
|
||||
<% if nixio.fs.access("/etc/init.d/v2ray") then %><option value="v2ray-trojan" <% if uci:get("openmptcprouter","settings","proxy") == "v2ray-trojan" then %>selected="selected"<% end %>>V2Ray TROJAN</option><% end %>
|
||||
<% elseif proxy == "v2ray-socks" then %>
|
||||
<% if nixio.fs.access("/etc/init.d/v2ray") then %><option value="v2ray-socks" <% if uci:get("openmptcprouter","settings","proxy") == "v2ray-socks" then %>selected="selected"<% end %>>V2Ray SOCKS</option><% end %>
|
||||
<% elseif proxy == "xray" then %>
|
||||
<% if nixio.fs.access("/etc/init.d/xray") then %><option value="xray" <% if uci:get("openmptcprouter","settings","proxy") == "xray" then %>selected="selected"<% end %>>XRay VLESS</option><% end %>
|
||||
<% elseif proxy == "xray-vless-reality" then %>
|
||||
<% if nixio.fs.access("/etc/init.d/xray") then %><option value="xray-vless-reality" <% if uci:get("openmptcprouter","settings","proxy") == "xray-vless-reality" then %>selected="selected"<% end %>>XRay VLESS Reality</option><% end %>
|
||||
<% elseif proxy == "xray-vmess" then %>
|
||||
<% if nixio.fs.access("/etc/init.d/xray") then %><option value="xray-vmess" <% if uci:get("openmptcprouter","settings","proxy") == "xray-vmess" then %>selected="selected"<% end %>>XRay VMESS</option><% end %>
|
||||
<% elseif proxy == "xray-trojan" then %>
|
||||
<% if nixio.fs.access("/etc/init.d/xray") then %><option value="xray-trojan" <% if uci:get("openmptcprouter","settings","proxy") == "xray-trojan" then %>selected="selected"<% end %>>XRay Trojan</option><% end %>
|
||||
<% elseif proxy == "xray-socks" then %>
|
||||
<% if nixio.fs.access("/etc/init.d/xray") then %><option value="xray-socks" <% if uci:get("openmptcprouter","settings","proxy") == "xray-socks" then %>selected="selected"<% end %>>XRay Socks</option><% end %>
|
||||
<% elseif proxy == "xray-shadowsocks" then %>
|
||||
<% if nixio.fs.access("/etc/init.d/xray") then %><option value="xray-shadowsocks" <% if uci:get("openmptcprouter","settings","proxy") == "xray-shadowsocks" then %>selected="selected"<% end %>>XRay Shadowsocks 2022</option><% end %>
|
||||
<% elseif proxy == "shadowsocks-rust" then %>
|
||||
<% if nixio.fs.access("/etc/init.d/shadowsocks-rust") then %><option value="shadowsocks-rust" <% if uci:get("openmptcprouter","settings","proxy") == "shadowsocks-rust" then %>selected="selected"<% end %>>Shadowsocks-Rust 2022</option><% end %>
|
||||
<% end
|
||||
end %>
|
||||
<%
|
||||
else
|
||||
%>
|
||||
<% if nixio.fs.access("/etc/init.d/shadowsocks-libev") then %><option value="shadowsocks" <% if uci:get("openmptcprouter","settings","shadowsocks") == "0" or uci:get("openmptcprouter","settings","proxy") == nil then %>selected="selected"<% end %>>Shadowsocks</option><% end %>
|
||||
<% if nixio.fs.access("/etc/init.d/v2ray") then %><option value="v2ray" <% if uci:get("openmptcprouter","settings","proxy") == "v2ray" then %>selected="selected"<% end %>>V2Ray VLESS</option><% end %>
|
||||
<% if nixio.fs.access("/etc/init.d/v2ray") then %><option value="v2ray-vmess" <% if uci:get("openmptcprouter","settings","proxy") == "v2ray-vmess" then %>selected="selected"<% end %>>V2Ray VMESS</option><% end %>
|
||||
|
@ -244,6 +280,9 @@
|
|||
<% if nixio.fs.access("/etc/init.d/xray") then %><option value="xray-socks" <% if uci:get("openmptcprouter","settings","proxy") == "xray-socks" then %>selected="selected"<% end %>>XRay Socks</option><% end %>
|
||||
<% if nixio.fs.access("/etc/init.d/xray") then %><option value="xray-shadowsocks" <% if uci:get("openmptcprouter","settings","proxy") == "xray-shadowsocks" then %>selected="selected"<% end %>>XRay Shadowsocks 2022</option><% end %>
|
||||
<% if nixio.fs.access("/etc/init.d/shadowsocks-rust") then %><option value="shadowsocks-rust" <% if uci:get("openmptcprouter","settings","proxy") == "shadowsocks-rust" then %>selected="selected"<% end %>>Shadowsocks-Rust 2022</option><% end %>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
<option value="none" <% if uci:get("openmptcprouter","settings","proxy") == "none" then %>selected="selected"<% end %>>None</option>
|
||||
</select>
|
||||
<br />
|
||||
|
|
|
@ -20,7 +20,7 @@ start_service() {
|
|||
#
|
||||
. /usr/share/ModemManager/modemmanager.common
|
||||
procd_open_instance
|
||||
procd_set_param command /usr/sbin/ModemManager-wrapper
|
||||
procd_set_param command /usr/sbin/ModemManager-wrapper --debug
|
||||
procd_set_param respawn "${respawn_threshold:-3600}" "${respawn_timeout:-5}" "${respawn_retry:-5}"
|
||||
procd_set_param pidfile "${MODEMMANAGER_PID_FILE}"
|
||||
procd_close_instance
|
||||
|
|
|
@ -722,6 +722,7 @@ default_gw=$(ip route get 1.1.1.1 | grep via | awk '{print $3}')
|
|||
default_gw6=$(ip -6 route get 2606:4700:4700::1111 | grep via | awk '{print $3}')
|
||||
#current_interface_gw=$(uci -q get "network.$OMR_TRACKER_INTERFACE.gateway")
|
||||
|
||||
interface_autostart=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["autostart"]')
|
||||
interface_up=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["up"]')
|
||||
interface_available=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["available"]')
|
||||
interface_pending=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["pending"]')
|
||||
|
@ -739,7 +740,20 @@ if [ "$OMR_TRACKER_STATUS" = "ERROR" ] || [ "$interface_up" != "true" ]; then
|
|||
_log "Set $OMR_TRACKER_INTERFACE up"
|
||||
ifup $OMR_TRACKER_INTERFACE
|
||||
sleep 30
|
||||
#elif [ -n "$OMR_TRACKER_INTERFACE" ] && [ -n "$OMR_TRACKER_DEVICE" ] && [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.proto)" = "modemmanager" ]; then
|
||||
elif [ -n "$OMR_TRACKER_INTERFACE" ] && [ -n "$OMR_TRACKER_DEVICE" ] && [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.proto)" = "modemmanager" ] && [ "$interface_up" = "false" ] && [ "$interface_available" = "false" ] && [ "$interface_pending" = "false" ] && [ "$interface_autostart" = "true" ]; then
|
||||
modemfind="0"
|
||||
for modem in $(timeout 3 mmcli -L | awk -F/ '{ print $6}' | awk '{print $1}'); do
|
||||
if [ -n "$(timeout 2 mmcli -m $modem -K | grep $OMR_TRACKER_DEVICE)" ]; then
|
||||
modemfind="1"
|
||||
fi
|
||||
done
|
||||
if [ "$modemfind" = "0" ]; then
|
||||
_log "Can't find $OMR_TRACKER_INTERFACE in ModemManager, restart modemmanager..."
|
||||
/etc/init.d/modemmanager restart
|
||||
sleep 30
|
||||
fi
|
||||
fi
|
||||
#elif [ -n "$OMR_TRACKER_INTERFACE" ] && [ -n "$OMR_TRACKER_DEVICE" ] && [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.proto)" = "modemmanager" ] && [ "$interface_available" = "false" ]; then
|
||||
# for modem in $(timeout 3 mmcli -L | awk -F/ '{ print $6}' | awk '{print $1}'); do
|
||||
# if [ -n "$(timeout 2 mmcli -m $modem -K | grep $OMR_TRACKER_DEVICE)" ]; then
|
||||
# modem_device=$(timeout 2 mmcli -m $modem -K | grep 'modem.generic.device ' | awk '{print $3}')
|
||||
|
@ -753,7 +767,7 @@ if [ "$OMR_TRACKER_STATUS" = "ERROR" ] || [ "$interface_up" != "true" ]; then
|
|||
# }
|
||||
# fi
|
||||
# done
|
||||
fi
|
||||
#fi
|
||||
|
||||
# This part must be done after modems restart because we have no idea when modems will be ready again... (another solution would be to check ModemManager status)
|
||||
if [ "$OMR_TRACKER_PREV_STATUS" = "$OMR_TRACKER_STATUS" ]; then
|
||||
|
|
|
@ -42,7 +42,7 @@ fi
|
|||
if [ "$(pgrep openvpn)" = "" ] && [ -f /etc/init.d/openvpn ]; then
|
||||
openvpn_enable=0
|
||||
openvpn_enabled() {
|
||||
[ "$(uci -q get openvpn.$1.enabled)" = "1" ] && openvpn_enable=1
|
||||
[ "$(uci -q get openvpn.$1.enabled)" = "1" ] && [ -n "$(uci -q get openvpn.$1.ca)" ] && openvpn_enable=1
|
||||
}
|
||||
config_load openvpn
|
||||
config_foreach openvpn_enabled openvpn
|
||||
|
|
39
netxen-nic/Makefile
Normal file
39
netxen-nic/Makefile
Normal file
|
@ -0,0 +1,39 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME := netxen-nic
|
||||
PKG_RELEASE := 1
|
||||
|
||||
PKG_SOURCE := $(LINUX_SOURCE)
|
||||
PKG_SOURCE_URL := $(LINUX_SITE)
|
||||
PKG_HASH := $(LINUX_KERNEL_HASH)
|
||||
|
||||
PKG_LICENSE := GPL-2.0
|
||||
|
||||
PKG_FLAGS := nonshared
|
||||
PKG_BUILD_PARALLEL := 1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TAR_CMD=$(HOST_TAR) -C $(1) --strip-components=1 $(TAR_OPTIONS)
|
||||
|
||||
define Build/Compile
|
||||
$(KERNEL_MAKE) \
|
||||
$(PKG_JOBS) \
|
||||
CONFIG_NETXEN_NIC=m \
|
||||
M=$(PKG_BUILD_DIR)/drivers/net/ethernet/qlogic/netxen \
|
||||
modules
|
||||
endef
|
||||
|
||||
KernelPackage/hooks := :
|
||||
|
||||
define KernelPackage/netxen-nic
|
||||
TITLE := NetXen Multi port (1/10) Gigabit Ethernet NIC
|
||||
KCONFIG := CONFIG_NETXEN_NIC=m
|
||||
FILES := $(PKG_BUILD_DIR)/drivers/net/ethernet/qlogic/netxen/netxen_nic.ko
|
||||
AUTOLOAD := $(call AutoProbe,netxen_nic)
|
||||
DEPENDS := @PCI_SUPPORT
|
||||
endef
|
||||
$(eval $(call KernelPackage,netxen-nic))
|
|
@ -1936,8 +1936,10 @@ _set_config_from_vps() {
|
|||
|
||||
# Get available server
|
||||
available_vpn="$(echo "$vps_config" | jsonfilter -q -e '@.vpn.available' | sed -e 's/\[ //' -e 's/ \]//' -e 's/,//g')"
|
||||
available_proxy="$(echo "$vps_config" | jsonfilter -q -e '@.proxy.available' | sed -e 's/\[ //' -e 's/ \]//' -e 's/,//g')"
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
del openmptcprouter.${servername}.available_vpn
|
||||
del openmptcprouter.${servername}.available_proxy
|
||||
EOF
|
||||
|
||||
if [ "$user_permission" = "ro" ]; then
|
||||
|
@ -1947,6 +1949,12 @@ _set_config_from_vps() {
|
|||
set openmptcprouter.${servername}.available_vpn=${current_vpn}
|
||||
EOF
|
||||
fi
|
||||
current_proxy="$(echo "$vps_config" | jsonfilter -q -e '@.proxy.current')"
|
||||
if [ -n "$current_proxy" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set openmptcprouter.${servername}.available_proxy=${current_proxy}
|
||||
EOF
|
||||
fi
|
||||
|
||||
else
|
||||
if [ -n "$available_vpn" ]; then
|
||||
|
@ -1956,6 +1964,13 @@ _set_config_from_vps() {
|
|||
EOF
|
||||
done
|
||||
fi
|
||||
if [ -n "$available_proxy" ]; then
|
||||
for proxy in $available_proxy; do
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
add_list openmptcprouter.${servername}.available_proxy=$proxy
|
||||
EOF
|
||||
done
|
||||
fi
|
||||
fi
|
||||
if [ "$noerror" = "1" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
|
|
|
@ -7,6 +7,7 @@ uci -q batch <<-EOF >/dev/null
|
|||
set system.ntp.enabled='1'
|
||||
del system.ntp.server
|
||||
set system.@system[-1].cronloglevel=9
|
||||
set system.@system[-1].conloglevel=7
|
||||
add_list system.ntp.server='0.pool.ntp.org'
|
||||
add_list system.ntp.server='1.pool.ntp.org'
|
||||
add_list system.ntp.server='2.pool.ntp.org'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue