Gather info for a given IP or domain name.
docker-compose up
curl \
-X POST \
-H "Content-Type: application/json" \
--data '{ "query": "{ newDnLookup(dn: "github.com", methods: [echo]) }" }' \
http://0.0.0.0:4000
... or http://0.0.0.0:4000
- docker 17.12.0+
- docker-compose
docker-compose up
Adjust the scale:
docker-compose up --scale worker-gather-information=4 -d
- Node 10.14.1
- yarn 1.12
- redis 5.0.2
cd services/service-gateway && yarn start
cd services/worker-gather-information && yarn start
The service-gateway
creates tasks
into a redis
server. Each lookup method has its own queue.
The instances of worker-gather-information
consumes those tasks, according to their configuration. Meaning, we can spawn new instances that will only deal with certain queues.
Defining new methods is quite simple:
- create a new class and its handler in
worker-gather-information/src/consumers/
- whitelist the method in
service-gateway/src/lookup-methods.ts
This is a monorepo. Each directory under services/
is an independent part of the application we are building.
- For now, the lookup methods available are hard coded, and their respective
Task
classes (cfservice-gateway
) are generated from that. It would be cool 😎 to manage them dynamically, like, updating them according to a list broadcast-ed by the workers alive. - Have some fun:
- look for dbs/websites/whatever-scrapper;
- create some kind of subscription service to get ping-ed with reports;
- Tests. Sorry, too much back and forth for now, did not have time to do that 😢
To do it correctly, I think we should mock the redis connection or theQueue
class from packagebee-queue
.
# available methods:
echo
geoIp
rdap
whois
curl \
-X POST \
-H "Content-Type: application/json" \
--data '{ "query": "{ newDnLookup(dn: "github.com", methods: [echo, geoIp]) }" }' \
http://0.0.0.0:4000
curl \
-X POST \
-H "Content-Type: application/json" \
--data '{ "query": "{ newIpLookup(ip: "192.30.255.112", methods: [geoIp]) }" }' \
http://0.0.0.0:4000