This service checks whether given IPv4 address is a Tor exit node.
API of the service responds:
-
with
HTTP 200 OK
and empty body onHEAD /A.B.C.D
request when provided IP is a Tor exit node -
with
HTTP 404 Not Found
and empty body onHEAD /A.B.C.D
request when provided IP is not a Tor exit node -
with
HTTP 200 OK
and JSON body (exitNode, lastStatus, published, exitAddress
) onGET /A.B.C.D
request when provided IP is a Tor exit node -
with
HTTP 404 Not Found
and empty body onGET /A.B.C.D
request when provided IP is not a Tor exit node
It synchronizes https://check.torproject.org/exit-addresses regularly and stores it in redis cache:
Api is based on express.js. Exit nodes synchronization worker uses node-cron package for scheduling, under the hood it basically forks a child node process. Worker and api processes communicate through redis (node-redis package), which also serves as a cache. You can customize cache expiration time and cron schedule with env variables (both are set to 30 minutes by default).
Run it with docker-compose:
docker compose up
now you can query the api, for example:
curl --head http://localhost:3000/176.10.99.200
unit tests:
npm run test
- end to end testing with mocked https://check.torproject.org/exit-addresses endpoint
- add another endpoint for dnsel lookup