mirror of
https://github.com/gSpotx2f/ruantiblock_openwrt.git
synced 2026-05-14 22:50:58 +00:00
v1.1. Removed separate nftsets for user entries.
This commit is contained in:
@@ -58,8 +58,8 @@ VPN_PKTS_MARK=8
|
||||
NFTSET_MAXELEM_IP=1000000
|
||||
NFTSET_MAXELEM_DNSMASQ=65535
|
||||
### Политика отбора элементов в сетах nftables. "performance" - производительность и большее потребление RAM. "memory" - хуже производительность и меньше потребление RAM
|
||||
NFTSET_POLICY_CIDR="performance"
|
||||
NFTSET_POLICY_IP="performance"
|
||||
NFTSET_POLICY_CIDR="memory"
|
||||
NFTSET_POLICY_IP="memory"
|
||||
NFTSET_POLICY_DNSMASQ="performance"
|
||||
### Таймаут для записей в сете $NFTSET_DNSMASQ
|
||||
NFTSET_DNSMASQ_TIMEOUT="1h"
|
||||
@@ -120,12 +120,12 @@ ZI_ALL_URL="https://raw.githubusercontent.com/zapret-info/z-i/master/dump.csv"
|
||||
#ZI_ALL_URL="https://app.assembla.com/spaces/z-i/git/source/master/dump.csv?_format=raw"
|
||||
AF_IP_URL="https://antifilter.download/list/allyouneed.lst"
|
||||
AF_FQDN_URL="https://antifilter.download/list/domains.lst"
|
||||
RA_IP_IPSET_URL="https://raw.githubusercontent.com/gSpotx2f/ruantiblock_blacklist/master/blacklist-1.0/ip/ruantiblock.ip"
|
||||
RA_IP_DMASK_URL="https://raw.githubusercontent.com/gSpotx2f/ruantiblock_blacklist/master/blacklist-1.0/ip/ruantiblock.dnsmasq"
|
||||
RA_IP_STAT_URL="https://raw.githubusercontent.com/gSpotx2f/ruantiblock_blacklist/master/blacklist-1.0/ip/update_status"
|
||||
RA_FQDN_IPSET_URL="https://raw.githubusercontent.com/gSpotx2f/ruantiblock_blacklist/master/blacklist-1.0/fqdn/ruantiblock.ip"
|
||||
RA_FQDN_DMASK_URL="https://raw.githubusercontent.com/gSpotx2f/ruantiblock_blacklist/master/blacklist-1.0/fqdn/ruantiblock.dnsmasq"
|
||||
RA_FQDN_STAT_URL="https://raw.githubusercontent.com/gSpotx2f/ruantiblock_blacklist/master/blacklist-1.0/fqdn/update_status"
|
||||
RA_IP_IPSET_URL="https://raw.githubusercontent.com/gSpotx2f/ruantiblock_blacklist/master/blacklist-1.1/ip/ruantiblock.ip"
|
||||
RA_IP_DMASK_URL="https://raw.githubusercontent.com/gSpotx2f/ruantiblock_blacklist/master/blacklist-1.1/ip/ruantiblock.dnsmasq"
|
||||
RA_IP_STAT_URL="https://raw.githubusercontent.com/gSpotx2f/ruantiblock_blacklist/master/blacklist-1.1/ip/update_status"
|
||||
RA_FQDN_IPSET_URL="https://raw.githubusercontent.com/gSpotx2f/ruantiblock_blacklist/master/blacklist-1.1/fqdn/ruantiblock.ip"
|
||||
RA_FQDN_DMASK_URL="https://raw.githubusercontent.com/gSpotx2f/ruantiblock_blacklist/master/blacklist-1.1/fqdn/ruantiblock.dnsmasq"
|
||||
RA_FQDN_STAT_URL="https://raw.githubusercontent.com/gSpotx2f/ruantiblock_blacklist/master/blacklist-1.1/fqdn/update_status"
|
||||
RBL_ENCODING=""
|
||||
ZI_ENCODING="CP1251"
|
||||
AF_ENCODING=""
|
||||
|
||||
@@ -29,8 +29,6 @@ Info() {
|
||||
if [ $? -eq 0 ]; then
|
||||
printf ",\"dnsmasq\":"
|
||||
$NFT_CMD -j list set $NFT_TABLE "$NFTSET_DNSMASQ" 2> /dev/null
|
||||
printf ",\"dnsmasq_u\":"
|
||||
$NFT_CMD -j list set $NFT_TABLE "$NFTSET_DNSMASQ_USER" 2> /dev/null
|
||||
printf "}"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -38,16 +38,16 @@ NftCmdWrapper() {
|
||||
return $_return_code
|
||||
}
|
||||
|
||||
IptVpnRouteDel() {
|
||||
NftVpnRouteDelete() {
|
||||
$IP_CMD route flush table $VPN_ROUTE_TABLE_ID
|
||||
$IP_CMD rule del table $VPN_ROUTE_TABLE_ID
|
||||
}
|
||||
|
||||
IptVpnRouteAdd() {
|
||||
NftVpnRouteAdd() {
|
||||
VPN_IP=`$IP_CMD addr list dev $IF_VPN 2> /dev/null | $AWK_CMD '/inet/{sub("/[0-9]{1,2}$", "", $2); print $2; exit}'`
|
||||
if [ -n "$VPN_IP" ]; then
|
||||
echo 0 > /proc/sys/net/ipv4/conf/$IF_VPN/rp_filter
|
||||
IptVpnRouteDel 2> /dev/null
|
||||
NftVpnRouteDelete 2> /dev/null
|
||||
$IP_CMD rule add fwmark $VPN_PKTS_MARK table $VPN_ROUTE_TABLE_ID priority 1000
|
||||
$IP_CMD route add default via $VPN_IP table $VPN_ROUTE_TABLE_ID
|
||||
fi
|
||||
@@ -59,7 +59,7 @@ NftVpnRouteStatus() {
|
||||
}
|
||||
|
||||
NftMainAdd() {
|
||||
local _nft_sets="${NFTSET_CIDR} ${NFTSET_CIDR_USER} ${NFTSET_IP} ${NFTSET_IP_USER} ${NFTSET_DNSMASQ} ${NFTSET_DNSMASQ_USER}" _set
|
||||
local _nft_sets="${NFTSET_CIDR} ${NFTSET_IP} ${NFTSET_DNSMASQ}" _set
|
||||
$NFT_CMD add chain $NFT_TABLE "$NFT_LOCAL_CLIENTS_CHAIN" { $LOCAL_CLIENTS_CHAIN_TYPE }
|
||||
$NFT_CMD add chain $NFT_TABLE "$NFT_ACTION_CHAIN"
|
||||
$NFT_CMD add chain $NFT_TABLE "$NFT_BLLIST_CHAIN"
|
||||
@@ -84,7 +84,7 @@ NftMainAdd() {
|
||||
NftCmdWrapper $NFT_CMD add rule $NFT_TABLE "$NFT_BLLIST_CHAIN" ip daddr "@${_set}" counter goto "$NFT_ACTION_CHAIN"
|
||||
done
|
||||
if [ "$PROXY_MODE" = "2" ]; then
|
||||
IptVpnRouteAdd
|
||||
NftVpnRouteAdd
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ NftMainDelete() {
|
||||
$NFT_CMD delete chain $NFT_TABLE "$NFT_BLLIST_CHAIN"
|
||||
$NFT_CMD flush chain $NFT_TABLE "$NFT_ACTION_CHAIN"
|
||||
$NFT_CMD delete chain $NFT_TABLE "$NFT_ACTION_CHAIN"
|
||||
IptVpnRouteDel 2> /dev/null
|
||||
NftVpnRouteDelete 2> /dev/null
|
||||
}
|
||||
|
||||
NftLocalClientsAdd() {
|
||||
|
||||
Reference in New Issue
Block a user