Giter VIP home page Giter VIP logo

go-geofeed's Introduction

go-geofeed

Generate a RFC8805 compliant geolocation feed using information from the RIPE database.

This information should preferably be gathered from internal databases and not by using an external resource.

Installation

Get the source and do something like this:

$ go mod download
$ go mod verify
$ go build -v -o geofeed

Copy the geofeed binary to a good location, set the environment variables and run it. I don't run this using systemd so I can't provide directions for it :)

Configuration

Configuration is done by setting environment variables.

Required:

  • NETWORKS
    • Comma-separated list of networks to be queried. Example: 192.0.2.0/,2001:db8::/32
  • EMAIL
    • Your e-mail address. It will be sent in the User-Agent-Field so the database operators has a way of contacting you

Optional:

  • LISTEN_ADDRESS (default ":8080")
  • REFRESH_INTERVAL_MIN (default 24)
  • REFRESH_INTERVAL_MAX (default 36)
    • The geofeed will be regenerated on a random hour between these two values
  • KEY (default empty)
    • Set to allow access to regenerate endpoint

Usage

Set the environment variables and start the application. It will immediately start querying the database and generate the geofeed, during which it will return a 503 error to any client. Once the feed is generated it will be regenerated either on-demand using the regenerate endpoint or on a random hour between the REFRESH_INTERVAL_MIN and REFRESH_INTERVAL_MAX values.

It's very much recommended to use a proxy (for instance nginx) in front to provide HTTPS capabilities.

Endpoints

  • /geofeed.csv returns the geofeed
  • /regenerate will regenerate the geofeed immediately if the KEY environment variable is set and the X-Geofeed-Key header is sent
  • Any other URL gives a 301 Moved Permanently to /geofeed.csv

go-geofeed's People

Contributors

johansaf avatar

Watchers

 avatar

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.