Skip to content

Single file library for Kealper's geoip utility written in Golang without extra dependencies

License

Notifications You must be signed in to change notification settings

JoshuaDoes/goeip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

goeip

Single file library for Kealper's geoip utility written in Golang without extra dependencies

Installing

go get github.com/JoshuaDoes/goeip

Example

package main

import "fmt"
import "github.com/JoshuaDoes/goeip"

func main() {
	result, err := goeip.Lookup("joshuadoes.com")
	if err != nil {
		fmt.Println("Error: " + fmt.Sprintf("%v", err))
		return
	}
	if result.Error > 0 {
		fmt.Println("Lookup error: " + result.Details)
	}

	fmt.Println("City: " + result.City)
	fmt.Println("State: " + result.State)
}

Output

> go run main.go
City: Dallas
State: Texas

About

Single file library for Kealper's geoip utility written in Golang without extra dependencies

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages