{"id":16161438,"url":"https://github.com/gamemann/ip-asn-list","last_synced_at":"2025-10-23T20:26:56.728Z","repository":{"id":92735668,"uuid":"268906179","full_name":"gamemann/IP-ASN-List","owner":"gamemann","description":"A Go application that outputs prefixes to a text file and supports ASN lookups.","archived":false,"fork":false,"pushed_at":"2022-12-09T12:22:15.000Z","size":23,"stargazers_count":23,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-16T23:51:21.819Z","etag":null,"topics":["asn","go","golang","ip","list"],"latest_commit_sha":null,"homepage":"https://moddingcommunity.com/","language":"Go","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/gamemann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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-06-02T20:53:52.000Z","updated_at":"2025-02-16T12:56:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"fa8577e9-5104-4ac7-bd86-c5beddcff784","html_url":"https://github.com/gamemann/IP-ASN-List","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gamemann%2FIP-ASN-List","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gamemann%2FIP-ASN-List/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gamemann%2FIP-ASN-List/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gamemann%2FIP-ASN-List/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gamemann","download_url":"https://codeload.github.com/gamemann/IP-ASN-List/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244318287,"owners_count":20433870,"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","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":["asn","go","golang","ip","list"],"created_at":"2024-10-10T02:25:15.721Z","updated_at":"2025-10-23T20:26:56.628Z","avatar_url":"https://github.com/gamemann.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IP/ASN List\n## Description\nA Go program that acts as a web server. This program loops through all `.json` files in the `lists/` directory and parses each list. Each list can contain an array of prefixes and ASNs. There are lookups performed on the ASNs via [BGPView](https://bgpview.docs.apiary.io/#reference/0/asn-prefixes/view-asn-prefixes)'s API. Afterwards, it outputs all prefixes to a file in the `public/` directory where clients can view them assuming they have the correct authorization header set from the config.\n\n## Why Did I Make This?\nAfter implementing my own custom filters into [Compressor V1](https://github.com/Dreae/compressor/) to mitigate (D)DoS attacks against GFL's Anycast network, I decided to implement whitelisting functionality for specific services. However, I didn't want to update these files locally on each POP every time I had to add a prefix. Therefore, I decided to create this program and have each POP cURL each list for specific services (with the correct authorization header set) and save them locally every five - ten minutes.\n\n## Config\nYou can change settings in the `settings.conf` file which is in JSON format. Here's the default config:\n\n```\n{\"token\": \"CHANGEME\", \"port\": 7030, \"updatetime\": 10, \"maxitems\": 10, \"ignorefailure\": false, \"debug\": false, \"random\": true}\n```\n\n* `token` =\u003e The authorization header that must be set when accessing the list publicly.\n* `port` =\u003e The port the web server binds to.\n* `updatetime` =\u003e How often to update all lists.\n* `maxitems` =\u003e The maximum amount of lists to update at once.\n* `ignorefailure` =\u003e If false, if an ASN lookup fails on a specific list, the list will not be written to. This is useful if you're facing rate limiting with BGPView.\n* `debug` =\u003e Whether to enable debugging.\n* `random` =\u003e If true, when scanning the `lists/` directory, will randomize the order of the lists to update.\n\n## Lists\nEach list config needs to have a file with the format `lists/\u003cname\u003e.json`. Here's an example of the test list (`lists/test.json`):\n\n```\n{\n    \"ASN\": [\n        398129,\n        32590\n    ],\n    \"Prefix\": [\n        \"192.168.90.1/32\",\n        \"192.168.90.2/32\"\n    ]\n}\n```\n\nThe above configuration will output all prefixes from ASN's 398129 and 32590 along with the additional prefixes `192.168.90.1/32` and `192.168.90.2/32` to `public/test.txt`.\n\n## REST API\nThis application supports a simple REST API for adding/removing prefixes/ASNs from specific lists.\n\nFor adding/removing a prefix, use the route `/prefix` (e.g. `https://api.example.com/prefix`). If you're adding a prefix, use the method type `PUT`. Otherwise, use the method type `DELETE`. Form values include `list` which is the list name without the file extension (e.g. `test` mapping to `lists/test.json`) and `prefix` which is a string containing the prefix you'd like to add/remove (e.g. `192.168.90.1/32`).\n\nFor adding/removing an ASN, use the route `/asn` (e.g. `https://api.example.com/asn`). If you're adding an ASN, use the method type `PUT`. Otherwise, use the method type `DELETE`. Form values include `list` which is the list name without the file extension (e.g. `test` mapping to `lists/test.json`) and `asn` which is an integer of the ASN you'd like to add/remove (e.g. `398129`).\n\n**Note** - In order to use this API, the request must send an authorization header with a value equal to the `token` value in the `settings.conf` file. In the future, I may look into implementing a separate authorization key for using the REST API so you can separate read/write operations within the application. However, this suits my network's needs for now.\n\n## Building\nYou may use the following commands to build this project.\n\n```\ncd src/\ngo build -o ../iplist\n```\n\n## Credits\n* [Christian Deacon](https://www.linkedin.com/in/christian-deacon-902042186/) - Creator.\n* [BGPView](https://bgpview.docs.apiary.io/#reference/0/asn-prefixes/view-asn-prefixes) - ASN lookup API.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgamemann%2Fip-asn-list","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgamemann%2Fip-asn-list","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgamemann%2Fip-asn-list/lists"}