mirror of
https://github.com/bol-van/zapret.git
synced 2025-04-21 14:32:57 +03:00
Compare commits
5 Commits
3c2f18b2be
...
3444bf978c
Author | SHA1 | Date | |
---|---|---|---|
|
3444bf978c | ||
|
1175b171ba | ||
|
bea643c967 | ||
|
addc813956 | ||
|
92ba6b439e |
40
ipset/get_antifilter_domains.sh
Normal file
40
ipset/get_antifilter_domains.sh
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
IPSET_DIR="$(dirname "$0")"
|
||||||
|
IPSET_DIR="$(cd "$IPSET_DIR"; pwd)"
|
||||||
|
|
||||||
|
. "$IPSET_DIR/def.sh"
|
||||||
|
|
||||||
|
TMPLIST="$TMPDIR/list.txt"
|
||||||
|
|
||||||
|
URL="https://antifilter.download/list/domains.lst"
|
||||||
|
|
||||||
|
dl()
|
||||||
|
{
|
||||||
|
# $1 - url
|
||||||
|
# $2 - file
|
||||||
|
# $3 - minsize
|
||||||
|
# $4 - maxsize
|
||||||
|
curl -L -H "Accept-Encoding: gzip" -k --fail --max-time 60 --connect-timeout 10 --retry 4 --max-filesize 251658240 -o "$TMPLIST" "$1" ||
|
||||||
|
{
|
||||||
|
echo list download failed : $1
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
dlsize=$(LANG=C wc -c "$TMPLIST" | xargs | cut -f 1 -d ' ')
|
||||||
|
if test $dlsize -lt $3; then
|
||||||
|
echo list is too small : $dlsize bytes. can be bad.
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
zzcat "$TMPLIST" | tr -d '\015' | zz "$2"
|
||||||
|
rm -f "$TMPLIST"
|
||||||
|
}
|
||||||
|
|
||||||
|
# useful in case ipban set is used in custom scripts
|
||||||
|
FAIL=
|
||||||
|
getipban || FAIL=1
|
||||||
|
"$IPSET_DIR/create_ipset.sh"
|
||||||
|
[ -n "$FAIL" ] && exit
|
||||||
|
|
||||||
|
dl "$URL" "$ZHOSTLIST" 32768 4194304
|
||||||
|
|
||||||
|
exit 0
|
12
nfq/nfqws.c
12
nfq/nfqws.c
@ -217,10 +217,12 @@ static bool nfq_init(struct nfq_handle **h,struct nfq_q_handle **qh)
|
|||||||
if (!rawsend_preinit(params.bind_fix4,params.bind_fix6))
|
if (!rawsend_preinit(params.bind_fix4,params.bind_fix6))
|
||||||
goto exiterr;
|
goto exiterr;
|
||||||
|
|
||||||
// increase socket buffer size. on slow systems reloading hostlist can take a while.
|
int yes=1, fd = nfq_fd(*h);
|
||||||
// if too many unhandled packets are received its possible to get "no buffer space available" error
|
|
||||||
if (!set_socket_buffers(nfq_fd(*h),Q_RCVBUF/2,Q_SNDBUF/2))
|
#if defined SOL_NETLINK && defined NETLINK_NO_ENOBUFS
|
||||||
goto exiterr;
|
if (setsockopt(fd, SOL_NETLINK, NETLINK_NO_ENOBUFS, &yes, sizeof(yes)) == -1)
|
||||||
|
DLOG_PERROR("setsockopt(NETLINK_NO_ENOBUFS)");
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
exiterr:
|
exiterr:
|
||||||
@ -267,7 +269,7 @@ static int nfq_main(void)
|
|||||||
errno=e;
|
errno=e;
|
||||||
DLOG_PERROR("recv");
|
DLOG_PERROR("recv");
|
||||||
// do not fail on ENOBUFS
|
// do not fail on ENOBUFS
|
||||||
} while(errno==ENOBUFS);
|
} while(e==ENOBUFS);
|
||||||
|
|
||||||
nfq_deinit(&h,&qh);
|
nfq_deinit(&h,&qh);
|
||||||
|
|
||||||
|
@ -711,10 +711,12 @@ void parse_params(int argc, char *argv[])
|
|||||||
while ((v = getopt_long_only(argc, argv, "", long_options, &option_index)) != -1)
|
while ((v = getopt_long_only(argc, argv, "", long_options, &option_index)) != -1)
|
||||||
{
|
{
|
||||||
if (v)
|
if (v)
|
||||||
|
{
|
||||||
if (bDry)
|
if (bDry)
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
else
|
else
|
||||||
exithelp_clean();
|
exithelp_clean();
|
||||||
|
}
|
||||||
switch (option_index)
|
switch (option_index)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user