1
0
Fork 0
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:
Ycarus (Yannick Chabanois) 2019-09-09 21:28:35 +02:00
parent c8eb844b62
commit 29b42e36a1
3 changed files with 27 additions and 1 deletions

View file

@ -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

View file

@ -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
}

View file

@ -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