{"id":31111870,"url":"https://github.com/jonathanwthom/hosts","last_synced_at":"2025-09-17T08:27:02.539Z","repository":{"id":82273231,"uuid":"383328475","full_name":"JonathanWThom/hosts","owner":"JonathanWThom","description":"Simple API that gives a 👍 or 👎 to hostnames based on a stored obfuscated list.","archived":false,"fork":false,"pushed_at":"2023-02-25T04:17:45.000Z","size":18,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-06-20T20:44:19.490Z","etag":null,"topics":["api","golang","hostnames"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JonathanWThom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-07-06T03:31:04.000Z","updated_at":"2021-10-16T06:47:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"f1d35987-a6f1-4376-8311-9947945b4b5a","html_url":"https://github.com/JonathanWThom/hosts","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JonathanWThom/hosts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonathanWThom%2Fhosts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonathanWThom%2Fhosts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonathanWThom%2Fhosts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonathanWThom%2Fhosts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JonathanWThom","download_url":"https://codeload.github.com/JonathanWThom/hosts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonathanWThom%2Fhosts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275558362,"owners_count":25486432,"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-09-17T02:00:09.119Z","response_time":84,"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":["api","golang","hostnames"],"created_at":"2025-09-17T08:27:01.447Z","updated_at":"2025-09-17T08:27:02.520Z","avatar_url":"https://github.com/JonathanWThom.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hosts\n\nSimple API that gives a 👍 or 👎 to hostnames based on a stored obfuscated list.\n\n### Usage\n\nHosts are looked up from a SQLite database at `hosts.db`. This database must be\npopulate and shipped with the deployment of this application. To populate it,\nyou need two things:\n\n1) A URL contain a list of hostnames you want to block (ideally one formatted like [this](https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews/hosts)).\n\n2) (Optionally) A key that will be used to hash the values as they are written\nto the database. This key will need to be shared with any clients of the\nservice. `export HASH_KEY=\"your-key-value\"` prior to running the populate task.\n\n[Install Go](https://golang.org/doc/install) and then run `make popc\nh=\u003cyour-hosts-url\u003e`\n\nOn `make start`, a server will be available that responds to one API request:\n`curl 'localhost:8080/allow?url=\u003cyour-hashed-and-encoded-hostname\u003e' -i`\n\n### Clients\n\nClients need to do the following:\n\n1) Strip urls down to just their hosts, e.g. google.com, not\nhttps://google.com?s=foo.\n\n2) Hash the hostname using HMAC SHA256, passing the same key as used above.\n\n3) Base64 encode that value, and include it as the `url` parameter in a `GET`\nrequest to the `/allow` endpoint.\n\nThe response will be JSON of either `{\"allow\":true}` or `{\"allow\":false}.\n\n### Hosting\n\n`make build` and `make push` will build and push a container (including the\nhosts.db file) to a repository of your choice.\n\nFor Heroku deployment:\n\n1) Populate your hosts file locally or on CI with `export HASH_KEY=\"your-hash-key\" \u0026\u0026 make popc h=\"your-hosts-url\"`\n\n2) `heroku container:login`\n\n3) `heroku container:push web`\n\n4) `heroku container:release web`\n\n\n### License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanwthom%2Fhosts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonathanwthom%2Fhosts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanwthom%2Fhosts/lists"}