Documentation
¶
Index ¶
- type City
- type Country
- type FileReader
- type FileWriter
- type Meta
- func (this *Meta) CityWithId(cityId int64) *City
- func (this *Meta) CountryWithId(countryId int64) *Country
- func (this *Meta) Init()
- func (this *Meta) ProviderWithId(providerId int64) *Provider
- func (this *Meta) ProvinceWithId(provinceId int64) *Province
- func (this *Meta) TownWithId(townId int64) *Town
- type Parser
- type ParserConfig
- type Provider
- type Province
- type QueryResult
- func (this *QueryResult) CityId() int64
- func (this *QueryResult) CityName() string
- func (this *QueryResult) CountryId() int64
- func (this *QueryResult) CountryName() string
- func (this *QueryResult) IsOk() bool
- func (this *QueryResult) ProviderId() int64
- func (this *QueryResult) ProviderName() string
- func (this *QueryResult) ProvinceId() int64
- func (this *QueryResult) ProvinceName() string
- func (this *QueryResult) TownId() int64
- func (this *QueryResult) TownName() string
- type Reader
- type ReaderParser
- type Template
- type Town
- type Version
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileReader ¶
type FileReader struct {
// contains filtered or unexported fields
}
func NewFileReader ¶
func NewFileReader(path string) (*FileReader, error)
func (*FileReader) Lookup ¶
func (this *FileReader) Lookup(ip net.IP) *QueryResult
func (*FileReader) Meta ¶
func (this *FileReader) Meta() *Meta
type FileWriter ¶
type FileWriter struct {
// contains filtered or unexported fields
}
func NewFileWriter ¶
func NewFileWriter(path string, meta *Meta) (*FileWriter, error)
func (*FileWriter) Close ¶
func (this *FileWriter) Close() error
func (*FileWriter) Sum ¶
func (this *FileWriter) Sum() string
func (*FileWriter) WriteMeta ¶
func (this *FileWriter) WriteMeta() error
type Meta ¶
type Meta struct { Version int `json:"version"` // IP库版本 Author string `json:"author"` Countries []*Country `json:"countries"` Provinces []*Province `json:"provinces"` Cities []*City `json:"cities"` Towns []*Town `json:"towns"` Providers []*Provider `json:"providers"` CreatedAt int64 `json:"createdAt"` // contains filtered or unexported fields }
func (*Meta) CityWithId ¶
func (*Meta) CountryWithId ¶
func (*Meta) ProviderWithId ¶
func (*Meta) ProvinceWithId ¶
func (*Meta) TownWithId ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
func NewParser ¶
func NewParser(config *ParserConfig) (*Parser, error)
type ParserConfig ¶
type QueryResult ¶
type QueryResult struct {
// contains filtered or unexported fields
}
func (*QueryResult) CityId ¶
func (this *QueryResult) CityId() int64
func (*QueryResult) CityName ¶
func (this *QueryResult) CityName() string
func (*QueryResult) CountryId ¶
func (this *QueryResult) CountryId() int64
func (*QueryResult) CountryName ¶
func (this *QueryResult) CountryName() string
func (*QueryResult) IsOk ¶
func (this *QueryResult) IsOk() bool
func (*QueryResult) ProviderId ¶
func (this *QueryResult) ProviderId() int64
func (*QueryResult) ProviderName ¶
func (this *QueryResult) ProviderName() string
func (*QueryResult) ProvinceId ¶
func (this *QueryResult) ProvinceId() int64
func (*QueryResult) ProvinceName ¶
func (this *QueryResult) ProvinceName() string
func (*QueryResult) TownId ¶
func (this *QueryResult) TownId() int64
func (*QueryResult) TownName ¶
func (this *QueryResult) TownName() string
type ReaderParser ¶
type ReaderParser struct {
// contains filtered or unexported fields
}
func NewReaderParser ¶
func NewReaderParser(reader io.Reader, config *ParserConfig) (*ReaderParser, error)
func (*ReaderParser) Parse ¶
func (this *ReaderParser) Parse() error
type Template ¶
type Template struct {
// contains filtered or unexported fields
}
func NewTemplate ¶
Click to show internal directories.
Click to hide internal directories.