Skip to content

Commit

Permalink
Set v3.0.2 and add -version command line flag
Browse files Browse the repository at this point in the history
  • Loading branch information
fiorix committed Nov 21, 2014
1 parent 228f699 commit f164eaa
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/freegeoip/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package main

import (
"flag"
"fmt"
"log"
"net"
"net/http"
Expand All @@ -20,6 +21,7 @@ import (
"github.com/gorilla/context"
)

var VERSION = "3.0.2"
var maxmindFile = "http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz"

func main() {
Expand All @@ -35,8 +37,14 @@ func main() {
redisAddr := flag.String("redis", "127.0.0.1:6379", "Redis address in form of ip:port for quota")
quotaMax := flag.Int("quota-max", 0, "Max requests per source IP per interval; Set 0 to turn off")
quotaIntvl := flag.Duration("quota-interval", time.Hour, "Quota expiration interval")
version := flag.Bool("version", false, "Show version and exit")
flag.Parse()

if *version {
fmt.Printf("freegeoip v%s\n", VERSION)
return
}

rc, err := redis.Dial(*redisAddr)
if err != nil {
log.Fatal(err)
Expand Down

0 comments on commit f164eaa

Please sign in to comment.