Support multiple AS numbers for providers

AS constants are now lists to allow matching multiple AS numbers per provider. Updated subnet processing logic to check membership in the target AS list.
This commit is contained in:
Dimariqe
2025-11-20 17:57:47 +07:00
parent b1dc7a53f1
commit 1174999155

View File

@@ -12,11 +12,11 @@ AS_FILE = 'AS.lst'
IPv4_DIR = 'Subnets/IPv4' IPv4_DIR = 'Subnets/IPv4'
IPv6_DIR = 'Subnets/IPv6' IPv6_DIR = 'Subnets/IPv6'
AS_META = '32934' AS_META = ['32934','63293','54115','149642']
AS_TWITTER = '13414' AS_TWITTER = ['13414']
AS_HETZNER = '24940' AS_HETZNER = ['24940']
AS_OVH = '16276' AS_OVH = ['16276']
AS_DIGITALOCEAN = '14061' AS_DIGITALOCEAN = ['14061']
META = 'meta.lst' META = 'meta.lst'
TWITTER = 'twitter.lst' TWITTER = 'twitter.lst'
@@ -53,7 +53,7 @@ def process_subnets(subnet_list, target_as):
for subnet_str, as_number in subnet_list: for subnet_str, as_number in subnet_list:
try: try:
subnet = ipaddress.ip_network(subnet_str) subnet = ipaddress.ip_network(subnet_str)
if as_number == target_as: if as_number in target_as:
if subnet.version == 4: if subnet.version == 4:
ipv4_subnets.append(subnet_str) ipv4_subnets.append(subnet_str)
elif subnet.version == 6: elif subnet.version == 6: