tparseipv6.nim 5.3 KB

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