tparseipv6.nim 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. discard """
  2. output: "all ok"
  3. """
  4. import net
  5. const
  6. positives = [
  7. "::f:8:a8f:218.17.235.229",
  8. "::b:228.19.241.2",
  9. "::8:c:a:f:8.35.8.96",
  10. "::3:e:a:bc:4.19.2.9",
  11. "::2:212.242.248.19",
  12. "::df:a5f:3.250.208.9",
  13. "::8:c:5:e63:250.208.249.0",
  14. "::b:f:181.12.9.98",
  15. "::a:f8:77.8.243.232",
  16. "::a:b:85:e4d9:252.9.229.56",
  17. "941:c:8a:c:e::917",
  18. "e8:7a:e:ad:88a:8:203.235.225.46",
  19. "139c:9e::f8:254.8.21.249",
  20. "b38:f0:e::f9:89.6.12.18",
  21. "ef::8",
  22. "5::ab",
  23. "a::8:255.247.96.253",
  24. "b:c0::c:254.248.95.254",
  25. "::8c:2:99.251.24.3",
  26. "98::c:247.240.249.57",
  27. "9::9",
  28. "628::f1ed:f",
  29. "c::cca8",
  30. "2::3:c",
  31. "fde::8fcc:92:e",
  32. "f::3",
  33. "e85::7",
  34. "8::b:f6",
  35. "0::6:8ca",
  36. "c8::6e:be8",
  37. "87::e",
  38. "6:9::a7:9",
  39. "c::5",
  40. "49::1:62",
  41. "df:c0::f:9",
  42. "a09a:8::21:887a",
  43. "2:f::c",
  44. "8bf5:5::2a6e:f8f",
  45. "a:9e::bc:a",
  46. "f:60::c:fd",
  47. "59::52f:0:fa7",
  48. "8268:6cf::f:9",
  49. "c:abb::f",
  50. "a:ff8d::9:7",
  51. "05:c87::9c:9a",
  52. "e:f::c:9a:1",
  53. "ff6:8::962:e",
  54. "9::bd",
  55. "68:ec::6",
  56. "3b8:f::94:3e9:9952",
  57. "49b4:ae::899:b4",
  58. "cb9:8e8:af::f4",
  59. "8::10:9ae6:f9",
  60. "b9::2:57",
  61. "ff:fba9::d",
  62. "4::a:8",
  63. "caa:c:85a::2:3",
  64. "5::a5:9",
  65. "c:ad::a",
  66. "9a:f:f65::b",
  67. "f:df::9:0",
  68. "c:b9::8de",
  69. "d:f::a",
  70. "ab88:d4:0::fc:8d",
  71. "8f:ee2::3",
  72. "f:f8::bf2:8c8",
  73. "8::efc",
  74. "e:5a::b",
  75. "c:48::94",
  76. "a:b:5::8",
  77. "f:88f::f0a6",
  78. "9:f:e::3",
  79. "b::fedd",
  80. "7b:f::c",
  81. "edf4:7d::88",
  82. "89::d",
  83. "c0:a:62::ac",
  84. "7:f::b",
  85. "8::a2",
  86. "0f::1",
  87. "::",
  88. "b:8::",
  89. "44:a::",
  90. "ef8f::",
  91. "b:4:d::",
  92. "a::",
  93. "5a:8::",
  94. "ddaf:ecbf::",
  95. "f:bb:a1::",
  96. "f8:f::",
  97. "::e:38:ab:f8",
  98. "::cd:c",
  99. "::aa3:eb",
  100. "::bf:9f9",
  101. "::7ef:bf8a",
  102. "::9",
  103. "::a:9af",
  104. "::315",
  105. "::a:a",
  106. "::aed3:a",
  107. "f0eb:0:e8:b:c:a:254.98.233.17",
  108. "bfa:7fc:c66d:15:e9a:ded:254.119.9.9",
  109. "d:ffa8:9:a:879:3:202.39.8.245",
  110. "8e:2:8:fa8a:f1d1:1aa8:252.254.245.81",
  111. "5:d4:a:e9:8:8:6.38.98.253",
  112. "9c5:4:a5c:f:a6:8c9d:5.250.8.2",
  113. "d19a:2:f808:be:f:c:98.86.197.249",
  114. "8:26ac:8:8:cb:f:242.0.254.85",
  115. "38:e:1:0b88:f:0:8.89.248.92",
  116. "e7:ff96:a:f:f:b:253.91.52.195",
  117. "d:8:2:5:894:5:254.0.240.199",
  118. "2:98:9:8aa:9c8f:fa:252.98.248.17",
  119. "e9:d4f:890:ccbe:5:8:88.200.228.216",
  120. "3:3:9:5:6a:df5:255.251.8.12",
  121. "0280:3:8:8:4:9:255.0.251.249",
  122. "8:af7:db:aa:0:9:238.248.250.255",
  123. "ff:ee:9a:9252:a:289:59.83.18.255",
  124. "9f6:5:fc9:b:a89:a:142.1.250.254",
  125. "e:981a:da:bf94:9:f8:254.242.18.95",
  126. "3c:1:4:f2:89:f:8.91.255.14",
  127. "e::9a2:c:9.50.80.8",
  128. "9::4a:07:fb:211.241.254.228",
  129. "9be::2:e:215.189.48.188",
  130. "f::f:d:69.148.99.168",
  131. "f::a:97.18.240.47",
  132. "c::a98e:1:251.253.252.254",
  133. "668::82:214.87.208.9",
  134. "9c0::cf0:ecb:253.208.238.255",
  135. "a::0:f1:210.240.238.49",
  136. "8::a:1:251.238.34.9",
  137. "81:dfe::b8:8.255.249.248",
  138. "d3::7:b:9:83.189.8.244",
  139. "8::9:8:8:0.7.11.252",
  140. "2:8::c:a8:250.221.9.249",
  141. "2::f:99.8.249.247",
  142. "c:22f5::5:2c:243.15.79.89",
  143. "e:8e::da:251.243.255.2",
  144. "f15f:9::a:255.70.247.218",
  145. "f:b::9f38:31.220.94.22",
  146. "9::9a48:3.98.249.119",
  147. "d:d:9b87::2d:a:249.253.38.8",
  148. "d86d:99b::a9b:5:242.236.8.244",
  149. "eb:3::f:9cf:1.253.1.228",
  150. "b::ba2:255.247.114.64",
  151. "2f:ec:bcb::9:219.254.250.94",
  152. "da8a:f6::a:e0:19.251.241.251",
  153. "5e:c1::a:21.250.8.254",
  154. "c:9::8c9b:248.219.212.252",
  155. "2:a::8d4a:216.255.198.223",
  156. "1f::66:255.30.8.150",
  157. "bc2b:8f::2ff9:6.245.99.230",
  158. "a:8::a8:9.251.246.255",
  159. "f:7:7::98:6.14.1.208",
  160. "e:2::9:218.249.255.254",
  161. "79:f::6:250.255.98.246",
  162. "47:9:fb9f::9:38.136.17.251",
  163. "ed::a:247.9.23.239",
  164. "6f::f1:88.254.119.9",
  165. "a::d:218.199.236.0",
  166. "fc88::9:203.196.4.95",
  167. "::8.48.255.85",
  168. "::253.7.255.36",
  169. "9:d::253.7.178.229",
  170. "::250.84.158.253",
  171. "::8.55.204.248",
  172. "2d:c::253.18.18.252",
  173. "df9:88ca::248.255.108.17",
  174. "8e9b::250.206.0.82",
  175. "::209.8.254.209",
  176. "::247.88.8.8",
  177. "::cb:f:ba41:250.208.19.249",
  178. "::fe:0e8:243.240.229.5",
  179. "::c:223.251.5.226",
  180. "::8:8.3.8.250",
  181. "::f:8.88.11.255",
  182. "::fda:48:aa:5.189.7.2",
  183. "::8:c3f:f:240.6.212.255",
  184. "::f:0aa:244.123.99.16",
  185. "::c9b5:c:34.8.90.196",
  186. "::98:c9:254.14.241.81"
  187. ]
  188. negatives = ["foo.bar",
  189. "::::::::::::",
  190. "yet another failure",
  191. "de:6:c:ab5:6a::9:252.6.6.249",
  192. "f9:5f7:fa38:9:b::b6:9.255.248.252",
  193. "97:c:5b:81:8a::f5dd:144.252.250.9",
  194. "9:8:cd:8:a9::f:247.255.9.255",
  195. "18:1:8c:2:3::9:8.254.252.139",
  196. "e:c298:3:e:a::bb12:254.246.5.250",
  197. "e:e:c:8e:fd::8:253.8.49.231",
  198. "9:97f:f:e929:8a::c9:0.8.252.10",
  199. "0df:b24:7:89:c::2b:16.249.240.92",
  200. "b:8f5f:485:c:9a::84c:178.7.249.34",
  201. "::3:e:a:bc:091.19.2.9",
  202. "::a:f8:77.08.243.232",
  203. "::8c:2:99.251.029.3",
  204. "::8:c:a:f:8.35.8.096",
  205. "d:ffa8:9:a:879:3:0202.39.8.245",
  206. "139c:9e::f8:254.07.21.249",
  207. "f0eb:0:e8:b:c:a:254.233.043.17",
  208. "::a:b:85:e4d9:252.9.229.056",
  209. ]
  210. proc ok(pos: openArray[string]) =
  211. for p in pos:
  212. if not isIpAddress(p):
  213. echo "failure ", p
  214. proc notok(neg: openArray[string]) =
  215. for n in neg:
  216. if isIpAddress(n):
  217. echo "failure ", n
  218. ok(positives)
  219. notok(negatives)
  220. echo "all ok"