mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-13 02:51:50 +00:00
Add custom proto support for omr-bypass
This commit is contained in:
parent
c8eb844b62
commit
29b42e36a1
3 changed files with 27 additions and 1 deletions
|
@ -95,7 +95,7 @@ if xt_ndpi_available then
|
|||
table.insert(protos,b)
|
||||
end
|
||||
end
|
||||
table.sort(protos)
|
||||
table.sort(protos, function(a, b) return a:upper() < b:upper() end)
|
||||
for _,b in ipairs(protos) do
|
||||
dpi:value(b,"%s" % tostring(b))
|
||||
end
|
||||
|
|
|
@ -8,6 +8,19 @@ EXTRA_COMMANDS="reload_rules"
|
|||
|
||||
. /usr/lib/unbound/iptools.sh
|
||||
|
||||
_add_proto() {
|
||||
protoname=$1
|
||||
echo "add_custom $protoname" >/proc/net/xt_ndpi/proto
|
||||
hosts="$( uci -q get omr-bypass.$protoname.url )"
|
||||
for url in $hosts; do
|
||||
echo "$protoname:$url" >/proc/net/xt_ndpi/host_proto
|
||||
done
|
||||
ip="$( uci -q get omr-bypass.$protoname.ip )"
|
||||
for ip in $ips; do
|
||||
echo "$protoname:$ip" >/proc/net/xt_ndpi/ip_proto
|
||||
done
|
||||
}
|
||||
|
||||
_bypass_ip() {
|
||||
local ip=$1
|
||||
local type=$2
|
||||
|
@ -296,6 +309,9 @@ boot() {
|
|||
start_service() {
|
||||
#local count
|
||||
logger -t "omr-bypass" "Starting OMR-ByPass..."
|
||||
config_load omr-bypass
|
||||
config_foreach _add_proto proto
|
||||
|
||||
[ -n "$RELOAD" ] && [ "$(ipset --list | grep omr_dst_bypass_all)" = "" ] && {
|
||||
unset RELOAD
|
||||
}
|
||||
|
|
|
@ -64,5 +64,15 @@ if [ "$(uci -q get firewall.omr-bypass)" = "" ]; then
|
|||
EOF
|
||||
fi
|
||||
|
||||
if [ "$(uci -q get omr-bypass.m6replay)" = "" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set omr-bypass.m6replay=proto
|
||||
add_list omr-bypass.m6replay.url='m6web.fr'
|
||||
add_list omr-bypass.m6replay.url='6play.fr'
|
||||
add_list omr-bypass.m6replay.url='6cloud.fr'
|
||||
commit omr-bypass
|
||||
EOF
|
||||
fi
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
|
|
Loading…
Reference in a new issue