_dns_pool.py 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. This file is part of the UFONet project, https://ufonet.03c8.net
  5. Copyright (c) 2013/2026 | psy <epsylon@riseup.net>
  6. You should have received a copy of the GNU General Public License along
  7. with UFONet; if not, write to the Free Software Foundation, Inc., 51
  8. Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  9. """
  10. import random
  11. PUBLIC_DNS_RESOLVERS = [
  12. "8.8.8.8", "8.8.4.4",
  13. "1.1.1.1", "1.0.0.1",
  14. "1.1.1.2", "1.0.0.2",
  15. "1.1.1.3", "1.0.0.3",
  16. "208.67.222.222", "208.67.220.220",
  17. "208.67.222.123", "208.67.220.123",
  18. "9.9.9.9", "149.112.112.112",
  19. "9.9.9.10", "149.112.112.10",
  20. "94.140.14.14", "94.140.15.15",
  21. "94.140.14.15", "94.140.15.16",
  22. "94.140.14.140", "94.140.14.141",
  23. "185.228.168.9", "185.228.169.9",
  24. "185.228.168.168", "185.228.169.168",
  25. "185.228.168.10", "185.228.169.11",
  26. "77.88.8.8", "77.88.8.1",
  27. "77.88.8.88", "77.88.8.2",
  28. "77.88.8.7", "77.88.8.3",
  29. "84.200.69.80", "84.200.70.40",
  30. "8.26.56.26", "8.20.247.20",
  31. "64.6.64.6", "64.6.65.6",
  32. "76.76.2.0", "76.76.10.0",
  33. "76.76.2.1", "76.76.10.1",
  34. "76.76.2.2", "76.76.10.2",
  35. "76.76.2.3", "76.76.10.3",
  36. "76.76.2.4", "76.76.10.4",
  37. "45.90.28.0", "45.90.30.0",
  38. "194.242.2.2", "194.242.2.3",
  39. "194.242.2.4", "194.242.2.5",
  40. "193.110.81.0", "185.253.5.0",
  41. "193.110.81.9", "185.253.5.9",
  42. "193.110.81.1", "185.253.5.1",
  43. "74.82.42.42",
  44. "158.64.1.29",
  45. "78.47.64.161",
  46. "89.233.43.71", "91.239.100.100",
  47. "116.203.225.86",
  48. "146.255.56.98",
  49. "159.69.198.101",
  50. "108.61.201.119",
  51. "95.216.211.211",
  52. "216.146.35.35", "216.146.36.36",
  53. "51.158.108.203",
  54. "95.216.165.235",
  55. ]
  56. OPENDNS_RESOLVERS = [
  57. "208.67.222.222", "208.67.220.220",
  58. "208.67.222.123", "208.67.220.123",
  59. ]
  60. DUMMY_ROUTABLE_HOSTS = [
  61. "8.8.8.8", "1.1.1.1", "9.9.9.9", "208.67.222.222",
  62. "8.8.4.4", "1.0.0.1", "149.112.112.112",
  63. ]
  64. def random_resolvers(n=2):
  65. n = max(1, min(n, len(PUBLIC_DNS_RESOLVERS)))
  66. return random.sample(PUBLIC_DNS_RESOLVERS, n)
  67. def random_opendns():
  68. return random.sample(OPENDNS_RESOLVERS, min(2, len(OPENDNS_RESOLVERS)))
  69. def random_dummy_host():
  70. return random.choice(DUMMY_ROUTABLE_HOSTS)