ip17mon

package module
v1.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2020 License: MIT Imports: 6 Imported by: 24

README

17mon IP location data for Golang

Circle CI

特性

  • dat/datx 只支持 ipv4
  • ipdb 支持 ipv4/ipv6

安装

go get github.com/wangtuanjie/ip17mon@latest

使用

import (
	"fmt"
	"github.com/wangtuanjie/ip17mon"
)

func init() {
	ip17mon.Init("your data file")
}

func main() {
	loc, err := ip17mon.Find("116.228.111.18")
	if err != nil {
		fmt.Println("err:", err)
		return
	}
	fmt.Println(loc)
}

更多请参考example

许可证

基于 MIT 协议发布

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(dataFile string)

func InitWithDatx added in v1.5.0

func InitWithDatx(b []byte)

func InitWithIpdb added in v1.5.0

func InitWithIpdb(b []byte)

Types

type LocationInfo

type LocationInfo = proto.LocationInfo

func Find

func Find(ipstr string) (*LocationInfo, error)

type Locator

type Locator = proto.Locator

func New added in v1.5.0

func New(dataFile string) (loc Locator, err error)

Directories

Path Synopsis
cmd
qip
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL