{"id":29822845,"url":"https://github.com/rockcavera/nim-iputils","last_synced_at":"2025-07-29T01:09:46.681Z","repository":{"id":170167025,"uuid":"256078503","full_name":"rockcavera/nim-iputils","owner":"rockcavera","description":"Utilities for use with IP. It has functions for IPv4, IPv6 and CIDR.","archived":false,"fork":false,"pushed_at":"2024-05-31T05:45:56.000Z","size":25,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-31T06:48:35.553Z","etag":null,"topics":["cidr","ip","ipv4","ipv6","nim","nim-lang","parser","range"],"latest_commit_sha":null,"homepage":"https://rockcavera.github.io/nim-iputils/theindex.html","language":"Nim","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rockcavera.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-16T01:30:18.000Z","updated_at":"2024-05-31T05:42:52.000Z","dependencies_parsed_at":"2023-06-29T06:30:31.457Z","dependency_job_id":null,"html_url":"https://github.com/rockcavera/nim-iputils","commit_stats":null,"previous_names":["rockcavera/nim-iputils"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/rockcavera/nim-iputils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rockcavera%2Fnim-iputils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rockcavera%2Fnim-iputils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rockcavera%2Fnim-iputils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rockcavera%2Fnim-iputils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rockcavera","download_url":"https://codeload.github.com/rockcavera/nim-iputils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rockcavera%2Fnim-iputils/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267613602,"owners_count":24115653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cidr","ip","ipv4","ipv6","nim","nim-lang","parser","range"],"created_at":"2025-07-29T01:09:44.299Z","updated_at":"2025-07-29T01:09:46.669Z","avatar_url":"https://github.com/rockcavera.png","language":"Nim","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iputils\nUtilities for use with IP. It has functions for IPv4, IPv6 and CIDR.\n\nBy rockcavera (rockcavera@gmail.com)\n\n# Install\nRun the Nimble install command\n\n``nimble install iputils``\n\n# Basic usage\n\n```nim\nimport iputils\n\nlet stringsIps = @[\"192.168.0.63\", \"0.0.0\", \"0\", \"256.0.0.1\", \"::1\", \"0:0:0:0:0:0:0:0\", \"2607:5300:60:37df::c4f3\", \":::1\"]\n\nfor ip in stringsIps:\n  if isIpv4(ip):\n    echo ip, \" is IPv4!\"\n  \n  elif isIpv6(ip):\n    echo ip, \" is IPv6!\"\n  \n  else:\n    echo ip, \" not is IPv4 or IPv6!\"\n\nfor ip in stringsIps:\n  try:\n    let parsed = parseIpv4(ip)\n  except:\n    echo ip, \" could not parse how IPv4.\"\n  \n  try:\n    let parsed = parseIpv6(ip)\n  except:\n    echo ip, \" could not parse how IPv6.\"\n\nfor ip in stringsIps:\n  var\n    ipv4: Ipv4\n    ipv6: Ipv6\n\n  if isIpv4AndStore(ip, ipv4):\n    echo \"Stored: \", ipv4\n\n  elif isIpv6AndStore(ip, ipv6):\n    echo \"Stored: \", ipv6\n\n\nlet\n  startIpv4 = parseIpv4(\"192.168.0.0\")\n  endIpv4 = parseIpv4(\"192.168.5.100\")\n  cidrs4 = ipv4RangeToCidr(startIpv4, endIpv4)\n\nfor cidr in cidrs4:\n  let (i, e) = cidrToIpv4Range(cidr)\n\n  echo cidr, \" contains IPv4 between \", i, \" - \", e\n\nlet\n  startIpv6 = parseIpv6(\"2607:5300:60:37df::c4f3\")\n  endIpv6 = parseIpv6(\"2607:5300:60:37df::ff:ffff\")\n  cidrs6 = ipv6RangeToCidr(startIpv6, endIpv6)\n\nfor cidr in cidrs6:\n  let (i, e) = cidrToIpv6Range(cidr)\n\n  echo cidr, \" contains IPv6 between \", i, \" - \", e\n```\n\n# Documentation\n[https://rockcavera.github.io/nim-iputils/theindex.html](https://rockcavera.github.io/nim-iputils/theindex.html \"https://rockcavera.github.io/nim-iputils/theindex.html\")","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frockcavera%2Fnim-iputils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frockcavera%2Fnim-iputils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frockcavera%2Fnim-iputils/lists"}