ipdb-go: github.com/ipipdotnet/ipdb-go Index | Files

package ipdb

import "github.com/ipipdotnet/ipdb-go"

Index

Package Files

base_station.go city.go district.go idc.go reader.go

Constants

const IPv4 = 0x01
const IPv6 = 0x02

Variables

var (
    ErrFileSize = errors.New("IP Database file size error.")
    ErrMetaData = errors.New("IP Database metadata error.")
    ErrReadFull = errors.New("IP Database ReadFull error.")

    ErrDatabaseError = errors.New("database error")

    ErrIPFormat = errors.New("Query IP Format error.")

    ErrNoSupportLanguage = errors.New("language not support")
    ErrNoSupportIPv4     = errors.New("IPv4 not support")
    ErrNoSupportIPv6     = errors.New("IPv6 not support")

    ErrDataNotExists = errors.New("data is not exists")
)

type BaseStation Uses

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

func NewBaseStation Uses

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

func (*BaseStation) BuildTime Uses

func (db *BaseStation) BuildTime() time.Time

func (*BaseStation) Fields Uses

func (db *BaseStation) Fields() []string

func (*BaseStation) Find Uses

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

func (*BaseStation) FindInfo Uses

func (db *BaseStation) FindInfo(addr, language string) (*BaseStationInfo, error)

func (*BaseStation) FindMap Uses

func (db *BaseStation) FindMap(addr, language string) (map[string]string, error)

func (*BaseStation) IsIPv4 Uses

func (db *BaseStation) IsIPv4() bool

func (*BaseStation) IsIPv6 Uses

func (db *BaseStation) IsIPv6() bool

func (*BaseStation) Languages Uses

func (db *BaseStation) Languages() []string

func (*BaseStation) Reload Uses

func (db *BaseStation) Reload(name string) error

type BaseStationInfo Uses

type BaseStationInfo struct {
    CountryName string `json:"country_name"`
    RegionName  string `json:"region_name"`
    CityName    string `json:"city_name"`
    OwnerDomain string `json:"owner_domain"`
    IspDomain   string `json:"isp_domain"`
    BaseStation string `json:"base_station"`
}

type City Uses

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

City struct

func NewCity Uses

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

NewCity initialize

func (*City) BuildTime Uses

func (db *City) BuildTime() time.Time

BuildTime return database build Time

func (*City) Fields Uses

func (db *City) Fields() []string

Fields return support fields

func (*City) Find Uses

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

Find query with addr

func (*City) FindInfo Uses

func (db *City) FindInfo(addr, language string) (*CityInfo, error)

FindInfo query with addr

func (*City) FindMap Uses

func (db *City) FindMap(addr, language string) (map[string]string, error)

FindMap query with addr

func (*City) IsIPv4 Uses

func (db *City) IsIPv4() bool

IsIPv4 whether support ipv4

func (*City) IsIPv6 Uses

func (db *City) IsIPv6() bool

IsIPv6 whether support ipv6

func (*City) Languages Uses

func (db *City) Languages() []string

Languages return support languages

func (*City) Reload Uses

func (db *City) Reload(name string) error

Reload the database

type CityInfo Uses

type CityInfo struct {
    CountryName    string `json:"country_name"`
    RegionName     string `json:"region_name"`
    CityName       string `json:"city_name"`
    OwnerDomain    string `json:"owner_domain"`
    IspDomain      string `json:"isp_domain"`
    Latitude       string `json:"latitude"`
    Longitude      string `json:"longitude"`
    Timezone       string `json:"timezone"`
    UtcOffset      string `json:"utc_offset"`
    ChinaAdminCode string `json:"china_admin_code"`
    IddCode        string `json:"idd_code"`
    CountryCode    string `json:"country_code"`
    ContinentCode  string `json:"continent_code"`
    IDC            string `json:"idc"`
    BaseStation    string `json:"base_station"`
    CountryCode3   string `json:"country_code3"`
    EuropeanUnion  string `json:"european_union"`
    CurrencyCode   string `json:"currency_code"`
    CurrencyName   string `json:"currency_name"`
    Anycast        string `json:"anycast"`
}

CityInfo is City Database Content

type District Uses

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

func NewDistrict Uses

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

func (*District) BuildTime Uses

func (db *District) BuildTime() time.Time

func (*District) Fields Uses

func (db *District) Fields() []string

func (*District) Find Uses

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

func (*District) FindInfo Uses

func (db *District) FindInfo(addr, language string) (*DistrictInfo, error)

func (*District) FindMap Uses

func (db *District) FindMap(addr, language string) (map[string]string, error)

func (*District) IsIPv4 Uses

func (db *District) IsIPv4() bool

func (*District) IsIPv6 Uses

func (db *District) IsIPv6() bool

func (*District) Languages Uses

func (db *District) Languages() []string

func (*District) Reload Uses

func (db *District) Reload(name string) error

type DistrictInfo Uses

type DistrictInfo struct {
    CountryName    string `json:"country_name"`
    RegionName     string `json:"region_name"`
    CityName       string `json:"city_name"`
    DistrictName   string `json:"district_name"`
    ChinaAdminCode string `json:"china_admin_code"`
    CoveringRadius string `json:"covering_radius"`
    Latitude       string `json:"latitude"`
    Longitude      string `json:"longitude"`
}

type IDC Uses

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

func NewIDC Uses

func NewIDC(name string) (*IDC, error)

func (*IDC) BuildTime Uses

func (db *IDC) BuildTime() time.Time

func (*IDC) Fields Uses

func (db *IDC) Fields() []string

func (*IDC) Find Uses

func (db *IDC) Find(addr, language string) ([]string, error)

func (*IDC) FindInfo Uses

func (db *IDC) FindInfo(addr, language string) (*IDCInfo, error)

func (*IDC) FindMap Uses

func (db *IDC) FindMap(addr, language string) (map[string]string, error)

func (*IDC) IsIPv4 Uses

func (db *IDC) IsIPv4() bool

func (*IDC) IsIPv6 Uses

func (db *IDC) IsIPv6() bool

func (*IDC) Languages Uses

func (db *IDC) Languages() []string

func (*IDC) Reload Uses

func (db *IDC) Reload(name string) error

type IDCInfo Uses

type IDCInfo struct {
    CountryName string `json:"country_name"`
    RegionName  string `json:"region_name"`
    CityName    string `json:"city_name"`
    OwnerDomain string `json:"owner_domain"`
    IspDomain   string `json:"isp_domain"`
    IDC         string `json:"idc"`
}

type MetaData Uses

type MetaData struct {
    Build     int64          `json:"build"`
    IPVersion uint16         `json:"ip_version"`
    Languages map[string]int `json:"languages"`
    NodeCount int            `json:"node_count"`
    TotalSize int            `json:"total_size"`
    Fields    []string       `json:"fields"`
}

Package ipdb imports 10 packages (graph). Updated 2018-12-05. Refresh now. Tools for package owners.