Giter Club home page Giter Club logo

flightaware-go's Introduction

flightaware-go

Description

This is the library implementing the Flightaware API in Go. It just exports the streaming data into JSON, using the FA API.

Used by FA Export and FA Tail utilities.

Build status

GitHub release GitHub issues Go Version GoDoc SemVer License Go Report Card

Branch: develop โ€” develop|Build Status Branch: master โ€” master|Build Status

Requirements

  • Go >= 1.10

github.com/keltia/flightaware-go is a Go module (you can use either Go 1.10 with vgo or 1.11+). The API exposed follows the Semantic Versioning scheme to guarantee a consistent API compatibility.

Installation

Like many Go utilities & libraries, it is very easy to install:

go get ithub.com/keltia/flightaware-go/cmd/...

that way, you get both the library and its two bundled utilities.

You can also clone the repository and use make install

git clone https://github.com/keltia/flightaware-go
make install

USAGE

There are two example programs included in cmd/fa-export and cmd/fa-tail. The former is the main driver and the latter is a tail(1)-like utility.

fa-export

fa-export -[AOpv] [options...]

Usage of fa-export:
  -A	Autorotate output file
  -B string
    	Begin time for -f pitr|range
  -D string
    	Default destination (NOT IMPL)
  -E string
    	End time for -f range
  -F string
    	Airline filter
  -I string
    	Aircraft Ident filter
  -L string
    	Lat/Long filter
  -O	Overwrite existing file?
  -P string
    	Airport filter
  -X string
    	Hexid output filter
  -d string
    	Stop after N s/mn/h/days
  -e string
    	Events to stream
  -f string
    	Specify which feed we want (default "live")
  -o string
    	Specify output FILE.
  -p	Enable profiling
  -u string
    	Username to connect with
  -v	Set verbose flag.

fa-tail

fa-tail -[cv] file

Usage of fa-tail:
  -c	Count records.
  -v	Be verbose

The file parameter being the file specified by the -ooption of fa-export.

XXX fa-tail does not implement most of tail(1)options, especially not -f.

API Usage

You start by creating a client instance with your credentials passed as Config struct. See fa-export for a configuration file loading and suff.

client := flightaware.NewClient(Config)

Then you can configure the feed type with

client.SetFeed(string, []time.Time)

You can also set a timeout time with a value in seconds

client.SetTimeout(int64)

You can add one or more different input filters:

client.AddInputFilter(<type>, <value>)

where type can be one of

 FILTER_EVENT
 FILTER_AIRLINE
 FILTER_IDENT
 FILTER_AIRPORT
 FILTER_LATLONG

The filters you specify will be checked remotely by FlightAware according to the documentation available at https://fr.flightaware.com/commercial/firehose/firehose_documentation.rvt

You can specify output filters with using client.AddOutputFilter(string)

The default handler is to display all packets. You can change the default handler with

client.AddHandler(func([]byte)

Last action is to start the consuming/producer loop with

client.Start()

Reading will be closed either though getting an EOF from FA or being will killed either manually or through the timeout value.

You can then use

client.Close()

to properly close the reading channel.

License

The BSD 2-Clause license.

Contributing

This project is an open Open Source project, please read CONTRIBUTING.md.

Feedback

We welcome pull requests, bug fixes and issue reports.

Before proposing a large change, first please discuss your change by raising an issue.

flightaware-go's People

Contributors

keltia avatar

Stargazers

 avatar Ivan Vanderbyl avatar Torsten Curdt avatar

Watchers

 avatar James Cloos avatar  avatar

flightaware-go's Issues

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.