Coder Social home page Coder Social logo

maptail's Introduction

maptail

maptail is a realtime map view of GeoIP data. Attach it to your server to track visitors, tail a log, pipe to its stdin or use it as a library to build your own implementation. Just emit IP addresses to it from any source and you'll automagically get a cool map with yellow dots and stuff like that streamed in with websockets or whatever transport you'd like to use.

Installing

npm install maptail -g

Omit the -g to install as a module.

How to use

The command line tool:

$ maptail -f nohup.out

$ tail -f nohup.out | maptail -h my.host.com -p 3000

In your server:

var maptail = require('maptail')
var express = require('express')
var app = express.createServer()

app.use(maptail.track())
app.use('/map', maptail.static())

maptail.attach(app)

app.listen(8080, 'localhost')

Let me explain what these are doing here a bit. maptail.track() tracks visitors' IPs and emits them to maptail. maptail.static() is an express.static() middleware that points to our static data (maptail.html, css, etc.)

maptail.attach(app) attaches a simpl WebSocket server which makes it possible for our frontend app to easily subscribe to the GeoIP data events sent by maptail and display them on the map.

If for example you don't want to track visitors of the http server but instead you want to send IPs from another source, you can easily remove maptail.track() from the middleware and use maptail.emit('ip', ipAddress[, logMessage]) to feed our map. It will take care the rest for you.

Credits

This is based on mape's wargames.

geoip-lite by Philip Tellis.

Earlier versions used kuno's GeoIP module but since it now uses a C library, I couldn't use it.

MaxMind for their free to use GeoIP data.

Licence

maptail is MIT/X11. The rest of the components are of their respective licences.

maptail's People

Contributors

stagas avatar

Watchers

Levi Stanley avatar James Cloos 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.