package main

import (
	"flag"
	"fmt"
	"log"

	"github.com/umahmood/geoip"
)

// command line flags.
var ip string

func init() {
	flag.StringVar(&ip, "ip", "", "IP to geo locate can be v4/v6 address or domain name.")
	flag.Parse()
}

func main() {
	loc, err := geoip.Location(ip)
	if err != nil {
		log.Fatalln(err)
	}

	for k, v := range loc {
		fmt.Println(k, ":", v)
	}
}

package main

import (
	"flag"
	"fmt"
	"log"
	"net"

	"github.com/umahmood/geoip"
)

// command line flags.
var ip string

func init() {
	flag.StringVar(&ip, "ip", "", "IP to geo locate can be v4 or v6 address.")
	flag.Parse()

	if ip != "" {
		addr := net.ParseIP(ip)
		if addr == nil {
			log.Fatalln("not a valid IP address.")
		}
	}
}

func main() {
	loc, err := geoip.Location(ip)
	if err != nil {
		log.Fatalln(err)
	}

	for k, v := range loc {
		fmt.Println(k, ":", v)
	}
}

--- 
+++ 
@@ -4,7 +4,6 @@
 	"flag"
 	"fmt"
 	"log"
-	"net"
 
 	"github.com/umahmood/geoip"
 )
@@ -13,15 +12,8 @@
 var ip string
 
 func init() {
-	flag.StringVar(&ip, "ip", "", "IP to geo locate can be v4 or v6 address.")
+	flag.StringVar(&ip, "ip", "", "IP to geo locate can be v4/v6 address or domain name.")
 	flag.Parse()
-
-	if ip != "" {
-		addr := net.ParseIP(ip)
-		if addr == nil {
-			log.Fatalln("not a valid IP address.")
-		}
-	}
 }
 
 func main() {
Remove check to see if -ip flag is valid address format

geoip previously used telize api for lookups, it only accepted ip addresses. Now we have
switched to freegeoip the api can accept domain names as well as ip addresses. geoip now
allows the user to pass in domain names.
