GithubHelp home page GithubHelp logo

challenge's Introduction

Challenge

GraphQL application which utilizes the ORM ent and gqlgen to query SpamhausRBL for blacklisted IPs and stores in an SQLite datastore.

Mutations

  • enqueue(ip: ["ip1", "ip2"])
    • Kicks off a background job to do the DNS lookup and store it in the database for each IP passed in for future lookups
    • If the lookup has already happened, enqueue queues it up again and updates the response and updated_at fields

Queries

  • getIPDetails(ip: "ip address here")
    • Looks up the IP Address in the database
    • Response format:
      • uuid ID
      • created_at time
      • updated_at time
      • response_code string
      • ip_address string

Getting Started

Dependencies

  • Docker
  • Go 1.18

External Packages used

  • Ent
    • Used as an ORM to manage the schema for the IP address CRUD actions and interactions with SQLite
  • Ajnasz/dnsbl-check
    • This fork included in the repo changes the command line tool to have exported functions that can be used as a dependency to look up DNSBL using a provided provider (e.g. zen.spamhaus.org).

Installing and Executing

  • Clone repo
git clone github.com/hannahapuan/challenge && cd challenge
  • Build docker image
docker build -t challenge .
  • Run image, specify environment variables (port), and expose port
 docker run  -p 8081:8081 -e port=8081 -it challenge

  • note that the port environment variable if not specified will default to 8081
  • Querying is avaliable on the localhost:8081/graphql endpoint

challenge's People

Contributors

hannahapuan avatar

Watchers

James Cloos avatar  avatar

Forkers

hews

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.