datx

package
v0.0.0-...-c9d3cd3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2019 License: Apache-2.0, Apache-2.0 Imports: 6 Imported by: 0

README

datx-go

IPIP.net官方支持datx格式的解析代码

安装

go get github.com/ipipdotnet/datx-go

示例


package main

import "github.com/ipipdotnet/datx-go"
import "fmt"

func main(){

    city, err := datx.NewCity("/path/to/17monipdb.datx")
    if err == nil {
        fmt.Println(city.Find("8.8.8.8"))
        fmt.Println(city.Find("128.8.8.8"))
        fmt.Println(city.Find("255.255.255.255"))
    }
    dis, err := datx.NewDistrict("/path/to/quxian.datx")
    if err == nil {
        fmt.Println(dis.Find("1.12.46.0"))
        fmt.Println(dis.Find("223.255.127.0"))
    }
    bst, err := datx.NewBaseStation("/path/to/station_ip.datx")
    if err == nil {
        fmt.Println(bst.Find("1.30.6.0"))
        fmt.Println(bst.Find("223.221.121.0"))
        fmt.Println(bst.Find("223.221.121.255"))
    }    
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseStation

type BaseStation struct {
	// contains filtered or unexported fields
}

BaseStation ...

func NewBaseStation

func NewBaseStation(fn string) (*BaseStation, error)

NewBaseStation ...

func (*BaseStation) Find

func (db *BaseStation) Find(s string) ([]string, error)

Find ...

type City

type City struct {
	// contains filtered or unexported fields
}

City ...

func NewCity

func NewCity(name string) (*City, error)

NewCity ...

func (*City) Find

func (db *City) Find(s string) ([]string, error)

Find ...

type District

type District struct {
	// contains filtered or unexported fields
}

District ...

func NewDistrict

func NewDistrict(fn string) (*District, error)

NewDistrict ...

func (*District) Find

func (db *District) Find(s string) ([]string, error)

Find ...

Jump to

Keyboard shortcuts

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