This is the library implementing the Flightaware API in Go. It just exports the streaming data into JSON, using the FA API.
- 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.
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
git clone https://github.com/keltia/flightaware-go make install
There are two example programs included in
cmd/fa-tail. The former is the main driver and the latter is a
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 -[cv] file Usage of fa-tail: -c Count records. -v Be verbose
file parameter being the file specified by the
fa-tail does not implement most of
tail(1)options, especially not
You start by creating a client instance with your credentials passed as Config
fa-export for a configuration file loading and suff.
client := flightaware.NewClient(Config)
Then you can configure the feed type with
You can also set a timeout time with a value in seconds
You can add one or more different input filters:
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
The default handler is to display all packets. You can change the default handler with
Last action is to start the consuming/producer loop with
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
to properly close the reading channel.
The BSD 2-Clause license.
This project is an open Open Source project, please read
We welcome pull requests, bug fixes and issue reports.
Before proposing a large change, first please discuss your change by raising an issue.