Documentation ¶
Index ¶
- Variables
- func AddressCount(network *net.IPNet) uint64
- func AddressRange(network *net.IPNet) (net.IP, net.IP)
- func IPToInt(ip net.IP) (*big.Int, int)
- func IntToIP(ipInt *big.Int, bits int) net.IP
- type DBFileContentType
- type IPv4
- type IPv4Set
- type Location
- type LocationSet
- type Record
- type Service
- type UpdateDBFileRequest
Constants ¶
This section is empty.
Variables ¶
var ( // DBFileContentType_name name map DBFileContentType_name = map[DBFileContentType]string{ IPv4Content: "ipv4", } // DBFileContentType_value value map DBFileContentType_value = map[string]DBFileContentType{ "ipv4": IPv4Content, } )
Functions ¶
func AddressCount ¶
AddressCount returns the number of distinct host addresses within the given CIDR range.
Since the result is a uint64, this function returns meaningful information only for IPv4 ranges and IPv6 ranges with a prefix size of at least 65.
func AddressRange ¶
AddressRange returns the first and last addresses in the given CIDR range.
Types ¶
type DBFileContentType ¶
type DBFileContentType uint
DBFileContentType 数据文件内容类型
const ( // IPv4Content (ipv4) ipv4 文件 IPv4Content DBFileContentType = iota // LocationContent (location) ip 地域信息 LocationContent )
func ParseDBFileContentType ¶
func ParseDBFileContentType(str string) (DBFileContentType, error)
ParseDBFileContentType Parse DBFileContentType from string
func ParseDBFileContentTypeFromString ¶
func ParseDBFileContentTypeFromString(str string) (DBFileContentType, error)
ParseDBFileContentTypeFromString Parse DBFileContentType from string
func (DBFileContentType) Equal ¶
func (t DBFileContentType) Equal(target DBFileContentType) bool
Equal type compare
func (DBFileContentType) IsIn ¶
func (t DBFileContentType) IsIn(targets ...DBFileContentType) bool
IsIn todo
func (DBFileContentType) MarshalJSON ¶
func (t DBFileContentType) MarshalJSON() ([]byte, error)
MarshalJSON todo
func (*DBFileContentType) UnmarshalJSON ¶
func (t *DBFileContentType) UnmarshalJSON(b []byte) error
UnmarshalJSON todo
type IPv4 ¶
type IPv4 struct { Network string `bson:"_id" json:"network"` GeonameID string `bson:"geoname_id" json:"geoname_id"` First string `bson:"fist" json:"first"` Last string `bson:"last" json:"last"` Start uint64 `bson:"start" json:"start"` End uint64 `bson:"end" json:"end"` Count uint64 `bson:"count" json:"count"` Latitude float64 `bson:"latitude" json:"latitude"` Longitude float64 `bson:"longitude" json:"longitude"` AccuracyRadius int64 `bson:"accuracy_radius" json:"accuracy_radius"` IsAnonymousProxy bool `bson:"is_anonymous_proxy" json:"is_anonymous_proxy"` IsSatelliteProvider bool `bson:"is_satellite_provider" json:"is_satellite_provider"` ISP string `bson:"isp" json:"isp"` }
IPv4 todo
func ParseIPv4FromCsvLine ¶
ParseIPv4FromCsvLine todo
func (*IPv4) ParseAccuracyRadius ¶
ParseAccuracyRadius todo
func (*IPv4) ParseIsAnonymousProxy ¶
ParseIsAnonymousProxy todo
func (*IPv4) ParseIsSatelliteProvider ¶
ParseIsSatelliteProvider tood
type Location ¶
type Location struct { GeonameID string `bson:"_id" json:"geoname_id"` LocaleCode string `bson:"locale_code" json:"locale_code"` ContinentCode string `bson:"continent_code" json:"continent_code"` ContinentName string `bson:"continent_name" json:"continent_name"` CountryISOCode string `bson:"country_iso_code" json:"country_iso_code"` CountryName string `bson:"country_name" json:"country_name"` CityName string `bson:"city_name" json:"city_name"` }
Location todo
func ParseLocationFromCsvLine ¶
ParseLocationFromCsvLine todo
type LocationSet ¶
type LocationSet struct {
// contains filtered or unexported fields
}
LocationSet todo
type Service ¶
type Service interface { UpdateDBFile(*UpdateDBFileRequest) error LookupIP(ipAddress net.IP) (*Record, error) }
Service todo
type UpdateDBFileRequest ¶
type UpdateDBFileRequest struct { *session.Session ContentType DBFileContentType // contains filtered or unexported fields }
UpdateDBFileRequest 上传文件请求
func NewUploadFileRequestFromHTTP ¶
func NewUploadFileRequestFromHTTP(r *http.Request) (*UpdateDBFileRequest, error)
NewUploadFileRequestFromHTTP todo
func (*UpdateDBFileRequest) ReadCloser ¶
func (req *UpdateDBFileRequest) ReadCloser() io.ReadCloser
ReadCloser todo
func (*UpdateDBFileRequest) Validate ¶
func (req *UpdateDBFileRequest) Validate() error
Validate 校验参数