{"id":13508704,"url":"https://github.com/ephe-meral/asn","last_synced_at":"2026-02-21T01:31:01.885Z","repository":{"id":57479047,"uuid":"62555646","full_name":"ephe-meral/asn","owner":"ephe-meral","description":"IP-to-AS-to-ASname lookup for Elixir ","archived":false,"fork":false,"pushed_at":"2016-08-10T11:08:39.000Z","size":5111,"stargazers_count":16,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-19T04:04:50.376Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ephe-meral.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-04T11:01:02.000Z","updated_at":"2025-08-07T03:04:05.000Z","dependencies_parsed_at":"2022-09-17T04:31:53.356Z","dependency_job_id":null,"html_url":"https://github.com/ephe-meral/asn","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/ephe-meral/asn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ephe-meral%2Fasn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ephe-meral%2Fasn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ephe-meral%2Fasn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ephe-meral%2Fasn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ephe-meral","download_url":"https://codeload.github.com/ephe-meral/asn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ephe-meral%2Fasn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29670124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T00:11:43.526Z","status":"ssl_error","status_checked_at":"2026-02-20T23:52:33.807Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-08-01T02:00:57.222Z","updated_at":"2026-02-21T01:31:01.741Z","avatar_url":"https://github.com/ephe-meral.png","language":"Elixir","funding_links":[],"categories":["Networking"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/ephe-meral/asn.svg?branch=master)](https://travis-ci.org/ephe-meral/asn)\n[![Hex.pm](https://img.shields.io/hexpm/l/asn.svg \"WTFPL Licensed\")](https://github.com/ephe-meral/asn/blob/master/LICENSE)\n[![Hex version](https://img.shields.io/hexpm/v/asn.svg \"Hex version\")](https://hex.pm/packages/asn)\n[![Documentation](https://img.shields.io/badge/docs-hexpm-blue.svg)](http://hexdocs.pm/asn/)\n\n# IP-to-AS-to-ASname lookup\n\nUses approximately the algorithm and resources described here: https://quaxio.com/bgp/\n\n**We support only IPv4 at this point** (Until someone wants IPv6 and dares to update this :D)\n\n## ASN databases\n\nWe use the APNIC files:\n\n- IP-to-AS: http://thyme.apnic.net/current/data-raw-table\n- AS-to-ASN: http://thyme.apnic.net/current/data-used-autnums\n\n## setup\n\nIn your `mix.exs` file:\n\n```elixir\ndef application do\n  [applications: [:asn]] # simply add asn to your loaded applications\nend\n\ndef deps do\n  [{:asn, \"\u003e= 0.1.0\"}]\nend\n```\n\nNote that the initial compilation might take a few more seconds since it compiles the lookup table.\n\nIn case you **don't want the application single process solution**, you can also start `ASN.Matcher.start_link` processes by hand and use them through a similat API like the ASN module, just that you will need to pass the matcher process as the first value before the function args.\n\n## usage\n\nDue to the sheer size of the table, the compiler refuses to statically put it into the matcher module within a reasonable amount of time, and with a reasonable usage of memory. That's why we pre-compile the data into erlang-terms in external format and store that, and load it again on demand into a process.\n\n**BEWARE** of wrongly formatted IP addresses! This accepts strings and tuples for IPs and integers for AS IDs, where IP-Strings need to be formatted like 'a.b.c.d' where a-d are integers between 0-255.\n\n```elixir\n# standard usage:\nASN.ip_to_asn(\"8.8.8.8\")\n# =\u003e {:ok, \"Google Inc.\"}\nASN.ip_to_asn({8, 8, 8, 8})\n# =\u003e {:ok, \"Google Inc.\"}\n\nASN.ip_to_as(\"8.8.8.8\")\n# =\u003e {:ok, 15169}\nASN.ip_to_as({8, 8, 8, 8})\n# =\u003e {:ok, 15169}\n\nASN.as_to_asn(15169)\n# =\u003e {:ok, \"Google Inc.\"}\n```\n\n## is it any good?\n\nbien sûr.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fephe-meral%2Fasn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fephe-meral%2Fasn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fephe-meral%2Fasn/lists"}