Skip to content

Commit

Permalink
sync (#560)
Browse files Browse the repository at this point in the history
  • Loading branch information
suyuan168 authored Oct 29, 2024
2 parents b81f3c4 + 8eb8b22 commit 305f18a
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';
'require baseclass';
'require form';

return baseclass.extend({
trigger: _('Proxy status (service: proxy)'),
kernel: false,
addFormOptions: function(s){
var o;

o = s.option(form.ListValue, 'proxy_status', _('Proxy Status'));
o.rmempty = true;
o.modalonly = true;
o.value('up', _('Up'));
o.value('down', _('Down'));
o.depends('trigger','proxy');
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';
'require baseclass';
'require form';

return baseclass.extend({
trigger: _('VPN status (service: vpn)'),
kernel: false,
addFormOptions: function(s){
var o;

o = s.option(form.ListValue, 'vpn_status', _('VPN Status'));
o.rmempty = true;
o.modalonly = true;
o.value('up', _('Up'));
o.value('down', _('Down'));
o.depends('trigger','vpn');
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"/usr/bin/mmcli -m [0-9]* -J": [ "exec" ],
"/usr/bin/mmcli -i [0-9]* -J": [ "exec" ],
"/usr/bin/mmcli -m [0-9]* --location-get -J": [ "exec" ]
},
"ubus": {
"modemmanager": [ "*" ]
}
}
}
Expand Down
29 changes: 20 additions & 9 deletions omr-tracker/files/bin/omr-tracker-ss
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,26 @@ _log() {
}

_post_tracking() {
[ ! -d /usr/share/omr/ss-post-tracking.d ] && return
for tracker_bin in /usr/share/omr/ss-post-tracking.d/*; do
[ -x "$tracker_bin" ] && (
_log() {
logger -t "ss-post-tracking-${tracker_bin##*/}" "$*"
}
. "$tracker_bin" 2>&1
)
done
[ -d /usr/share/omr/ss-post-tracking.d ] && {
for tracker_bin in /usr/share/omr/ss-post-tracking.d/*; do
[ -x "$tracker_bin" ] && (
_log() {
logger -t "ss-post-tracking-${tracker_bin##*/}" "$*"
}
. "$tracker_bin" 2>&1
)
done
}
[ -d /usr/share/omr/proxy-post-tracking.d ] && {
for tracker_bin in /usr/share/omr/proxy-post-tracking.d/*; do
[ -x "$tracker_bin" ] && (
_log() {
logger -t "proxy-post-tracking-${tracker_bin##*/}" "$*"
}
. "$tracker_bin" 2>&1
)
done
}
}

_ping_server() {
Expand Down
29 changes: 20 additions & 9 deletions omr-tracker/files/bin/omr-tracker-v2ray
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,26 @@ _log() {
}

_post_tracking() {
[ ! -d /usr/share/omr/v2ray-post-tracking.d ] && return
for tracker_bin in /usr/share/omr/v2ray-post-tracking.d/*; do
[ -x "$tracker_bin" ] && (
_log() {
logger -t "v2ray-post-tracking-${tracker_bin##*/}" "$*"
}
. "$tracker_bin" 2>&1
)
done
[ -d /usr/share/omr/v2ray-post-tracking.d ] && {
for tracker_bin in /usr/share/omr/v2ray-post-tracking.d/*; do
[ -x "$tracker_bin" ] && (
_log() {
logger -t "v2ray-post-tracking-${tracker_bin##*/}" "$*"
}
. "$tracker_bin" 2>&1
)
done
}
[ -d /usr/share/omr/proxy-post-tracking.d ] && {
for tracker_bin in /usr/share/omr/proxy-post-tracking.d/*; do
[ -x "$tracker_bin" ] && (
_log() {
logger -t "proxy-post-tracking-${tracker_bin##*/}" "$*"
}
. "$tracker_bin" 2>&1
)
done
}
}

_ping_server() {
Expand Down
30 changes: 20 additions & 10 deletions omr-tracker/files/bin/omr-tracker-xray
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,28 @@ _log() {
}

_post_tracking() {
[ ! -d /usr/share/omr/xray-post-tracking.d ] && return
for tracker_bin in /usr/share/omr/xray-post-tracking.d/*; do
[ -x "$tracker_bin" ] && (
_log() {
logger -t "xray-post-tracking-${tracker_bin##*/}" "$*"
}
. "$tracker_bin" 2>&1
)
done
[ -d /usr/share/omr/xray-post-tracking.d ] && {
for tracker_bin in /usr/share/omr/xray-post-tracking.d/*; do
[ -x "$tracker_bin" ] && (
_log() {
logger -t "xray-post-tracking-${tracker_bin##*/}" "$*"
}
. "$tracker_bin" 2>&1
)
done
}
[ -d /usr/share/omr/proxy-post-tracking.d ] && {
for tracker_bin in /usr/share/omr/proxy-post-tracking.d/*; do
[ -x "$tracker_bin" ] && (
_log() {
logger -t "proxy-post-tracking-${tracker_bin##*/}" "$*"
}
. "$tracker_bin" 2>&1
)
done
}
}


_ping_server() {
local host=$1
ret=$(ping \
Expand Down
2 changes: 1 addition & 1 deletion omr-tracker/files/usr/share/omr/post-tracking.d/003-up
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if [ "$OMR_TRACKER_STATUS" = "ERROR" ]; then
exit 0
fi

if [ "$OMR_TRACKER_PREV_STATUS" = "$OMR_TRACKER_STATUS" ] && [ -n "$OMR_TRACKER_INTERFACE" ] && [ "$OMR_TRACKER_PREV_DEVICE_IP" = "$OMR_TRACKER_DEVICE_IP" ] && [ "$OMR_TRACKER_PREV_DEVICE_IP6" = "$OMR_TRACKER_DEVICE_IP6" ] && (([ -n "$OMR_TRACKER_DEVICE_GATEWAY" ] && [ -n "$(ip r show table 991337)" ]) || ([ -n "$OMR_TRACKER_DEVICE_GATEWAY6" ] && [ -n "$(ip -6 r show table 6991337)" ])); then
if [ "$OMR_TRACKER_INTERFACE" != "omrvpn" ] && [ "$OMR_TRACKER_INTERFACE" != "omr6in4" ] && [ "$OMR_TRACKER_PREV_STATUS" = "$OMR_TRACKER_STATUS" ] && [ -n "$OMR_TRACKER_INTERFACE" ] && [ "$OMR_TRACKER_PREV_DEVICE_IP" = "$OMR_TRACKER_DEVICE_IP" ] && [ "$OMR_TRACKER_PREV_DEVICE_IP6" = "$OMR_TRACKER_DEVICE_IP6" ] && (([ -n "$OMR_TRACKER_DEVICE_GATEWAY" ] && [ -n "$(ip r show table 991337)" ]) || ([ -n "$OMR_TRACKER_DEVICE_GATEWAY6" ] && [ -n "$(ip -6 r show table 6991337)" ])); then
exit 0
fi

Expand Down
8 changes: 6 additions & 2 deletions openmptcprouter/files/etc/firewall.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
_set_ttl() {
device=$(uci -q get network.$1.name)
ttl=$(uci -q get network.$1.ttl)
if [ -n "$ttl" ] && [ -z "$(iptables-save 2>/dev/null | grep TTL | grep $device)" ]; then
iptables -w -t mangle -I POSTROUTING -o $device -j TTL --ttl-set $ttl 2>&1 >/dev/null
if [ -n "$ttl" ]; then
if [ -e /usr/sbin/iptables-nft ] && [ -z "$(nft list ruleset 2>/dev/null | grep ttl | grep $device)" ]; then
nft add rule inet fw4 mangle_forward oifname $device ip ttl set $ttl >/dev/null 2>&1
elif [ ! -e /usr/sbin/iptables-nft ] && [ -z "$(iptables-save 2>/dev/null | grep TTL | grep $device)" ]; then
iptables -w -t mangle -I POSTROUTING -o $device -j TTL --ttl-set $ttl >/dev/null 2>&1
fi
fi
}

Expand Down
1 change: 1 addition & 0 deletions openmptcprouter/files/etc/ntpd.d/force_ntp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tinker panic 0
4 changes: 3 additions & 1 deletion openmptcprouter/files/etc/uci-defaults/1980-omr-firewall
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,15 @@ if [ "$(uci -q get firewall.ttl)" = "" ]; then
uci -q batch <<-EOF >/dev/null
set firewall.ttl=include
set firewall.ttl.path=/etc/firewall.ttl
set firewall.ttl.type='script'
set firewall.ttl.fw4_compatible='1'
commit firewall
EOF
fi
if [ "$(uci -q get firewall.upnp)" = "" ]; then
uci -q batch <<-EOF >/dev/null
set firewall.upnp=include
set firewall.upnp.path='/etc/firewall.ttl'
set firewall.upnp.path='/etc/firewall.upnp'
set firewall.upnp.type='script'
set firewall.upnp.fw4_compatible='1'
commit firewall
Expand Down

0 comments on commit 305f18a

Please sign in to comment.