diff --git a/cmd/echoip/main.go b/cmd/echoip/main.go index 0ad6e72..1f64543 100644 --- a/cmd/echoip/main.go +++ b/cmd/echoip/main.go @@ -10,9 +10,9 @@ import ( "github.com/mpolden/echoip/http" "github.com/mpolden/echoip/iputil" "github.com/mpolden/echoip/iputil/geo" + "github.com/mpolden/echoip/iputil/ipstack" parser "github.com/mpolden/echoip/iputil/paser" - "github.com/mpolden/echoip/iputil/stack" - "github.com/qioalice/ipstack" + ipstackApi "github.com/qioalice/ipstack" ) type multiValueFlag []string @@ -33,7 +33,7 @@ func init() { func main() { var ipstackApiKey string - database := flag.String("d", "geoip", "Which database to use, 'ipstack' or 'geoip'") + service := flag.String("d", "geoip", "Which database to use, 'ipstack' or 'geoip'") flag.StringVar(&ipstackApiKey, "S", "", "IP Stack API Key") countryFile := flag.String("f", "", "Path to GeoIP country database") cityFile := flag.String("c", "", "Path to GeoIP city database") @@ -55,7 +55,7 @@ func main() { } var parser parser.Parser - if (*database == "geoip") { + if (*service == "geoip") { geo, err := geo.Open(*countryFile, *cityFile, *asnFile) if err != nil { log.Fatal(err) @@ -63,11 +63,11 @@ func main() { parser = &geo } - if (*database == "ipstack") { - if err := ipstack.Init(ipstackApiKey); err != nil { + if (*service == "ipstack") { + if err := ipstackApi.Init(ipstackApiKey); err != nil { log.Fatal(err) } - ips := stack.IPstackParser{} + ips := ipstack.IPStack{} parser = &ips } diff --git a/html/index.html b/html/index.html index 9557084..f669309 100644 --- a/html/index.html +++ b/html/index.html @@ -168,13 +168,18 @@ {{ end }} {{ end }} - {{ if .Country }} + {{ if .Country }} {{ if .Service == "geoip" }}
This information is provided from the GeoLite2 database created by MaxMind, available from www.maxmind.com
- {{ end }} {{ if .Latitude }} + {{ end}} {{ if .Service == "ipstack" }} ++ This information is provided from + www.ipstack.com +
+ {{ end}} {{ end }} {{ if .Latitude }}