Liu Song’s Projects


~/Projects/qqwry-go

git clone https://code.lsong.org/qqwry-go

qqwry

🌎 A lightweight native Golang implementation of GeoIP API

Example

package main

import (
	"fmt"

	"github.com/song940/qqwry-go/qqwry"
)

func main() {
	q, err := qqwry.NewQQwry("qqwry.dat")
	if err != nil {
		panic(err)
	}
	result, err := q.Find("1.1.1.1")
	if err != nil {
		panic(err)
	}
	fmt.Println(result.IP)
	fmt.Println(result.Country, result.City)
}

License

This project is licensed under the MIT license.