Moving contents from cmd/freegeoip/main.go to apiserver package for
better test coverage.
This change updates the -addr command line flag and its behavior,
and is backwards incomplatible. People using -addr must switch over
to using -http now. In order to enable HTTPS, one must use -https
and the server might listen on both HTTP and HTTPS.
The -pprof flag changed to -internal-server and serves not only pprof
but also metrics for prometheus (http://prometheus.io). These are
under /debug/pprof (https://golang.org/pkg/net/http/pprof/) and
/metrics accordingly.
Bringing back the -read-timeout and -write-timeout command line flags
for server tuning.
Fixed a race condition bug in the redis quota algorithm, at the
exchange of 1 redis incr per request following advice from
pattern #2 from http://redis.io/commands/incr.
Also added rate limit response headers for all HTTP and HTTPS requests,
inspired by GitHub's API:
X-RateLimit-Limit: number of requests allowed per interval (def. 1h)
X-RateLimit-Remaining: number of requests remaining, per user
X-RateLimit-Reset: time in seconds before resetting the limit
Added the -logtostdout command line flag to close #146.
Minor fix to the background database download back off algorithm,
added -api-prefix and -cors-origin command line flags, and tests.