fix ordering in file

This commit is contained in:
2024-09-14 17:52:14 -05:00
parent d6a6743283
commit 249717ef93

View File

@@ -56,9 +56,12 @@ if __name__ == "__main__":
# Write to rbldnsd-compliant file # Write to rbldnsd-compliant file
with open(output_file, "w") as f: with open(output_file, "w") as f:
f.write(":127.0.0.4:Listed, see https://protonvpn.com\n") # Header f.write(":127.0.0.4:Listed, see https://protonvpn.com\n") # Header
for ip_range, (country_code, server_names) in ip_range_groups.items(): # Iterate through IP ranges in sorted order
for ip_range in sorted(ip_range_groups.keys()):
country_code, server_names = ip_range_groups[ip_range]
f.write(f"{ip_range} ; ProtonVPN {country_code}\n") f.write(f"{ip_range} ; ProtonVPN {country_code}\n")
# Calculate and print stats # Calculate and print stats
total_ranges = len(ip_range_groups) total_ranges = len(ip_range_groups)
ranges_per_country = Counter(country_code for country_code, _ in ip_range_groups.values()) ranges_per_country = Counter(country_code for country_code, _ in ip_range_groups.values())