Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiHandler ¶
type ApiHandler struct {
// contains filtered or unexported fields
}
type ContinentRecord ¶
type CountryRecord ¶
type CountryRecord struct { Code string `json:"code"` CIOC string `json:"cioc"` CCN3 string `json:"ccn3"` CallCode []string `json:"call_code"` InternationalPrefix string `json:"international_prefix"` Capital string `json:"capital"` Name string `json:"name"` FullName string `json:"full_name"` Area float64 `json:"area"` Borders []string `json:"borders"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` MaxLatitude float64 `json:"max_latitude"` MaxLongitude float64 `json:"max_longitude"` MinLatitude float64 `json:"min_latitude"` MinLongitude float64 `json:"min_longitude"` Currency []*CurrencyRecord `json:"currency"` Continent *ContinentRecord `json:"continent"` }
type CurrencyRecord ¶
type GeoIpQuery ¶
type GeoIpQuery struct { i2ldb.ProxyDefaultQuery mmdb.DefaultQuery mmdb.ASNDefaultQuery mmdb.TorDefaultQuery }
func (*GeoIpQuery) Record ¶
func (q *GeoIpQuery) Record(ip net.IP, lang string, request *http.Request) *ResponseRecord
func (*GeoIpQuery) Translate ¶
func (q *GeoIpQuery) Translate(names map[string]string, lang string) string
func (*GeoIpQuery) TranslateCountry ¶
type LanguageRecord ¶
type LocationRecord ¶
type LocationRecord struct { RegionCode string `json:"region_code"` RegionName string `json:"region_name"` City string `json:"city"` ZipCode string `json:"zip_code"` TimeZone string `json:"time_zone"` Longitude float64 `json:"longitude"` Latitude float64 `json:"latitude"` AccuracyRadius uint `json:"accuracy_radius"` MetroCode uint `json:"metro_code"` Country *CountryRecord `json:"country"` }
type NetworkRecord ¶
type NetworkRecord struct { IP string `json:"ip"` AS *ASRecord `json:"as"` Isp string `json:"isp"` Domain string `json:"domain"` Tld []string `json:"tld"` Bot bool `json:"bot"` Tor bool `json:"tor"` Proxy bool `json:"proxy"` ProxyType string `json:"proxy_type"` LastSeen uint `json:"last_seen"` UsageType string `json:"usage_type"` }
type RateLimit ¶
type RateLimit struct { Limit rate.Limit Burst int Interval time.Duration Mutex *sync.RWMutex Visitors map[string]*Visitor }
type ResponseRecord ¶
type ResponseRecord struct { XMLName xml.Name `xml:"Response" json:"-"` Network *NetworkRecord `json:"network"` Location *LocationRecord `json:"location"` System *SystemRecord `json:"system,omitempty"` User *UserRecord `json:"user,omitempty"` }
func (*ResponseRecord) String ¶
func (rr *ResponseRecord) String() string
type Server ¶
type Server struct { Config *config.Config Host string Port int RateLimit *RateLimit Visitors map[string]*Visitor Mutex sync.Mutex Api *ApiHandler }
func NewServerConfig ¶
func (*Server) IpLookUp ¶
func (s *Server) IpLookUp(writer writerFunc) http.HandlerFunc
func (*Server) NewHandler ¶
NewHandler creates an http handler for the geoip server that can be embedded in other servers.
type SystemRecord ¶
type UserRecord ¶
type UserRecord struct {
Language *LanguageRecord `json:"language"`
}
Click to show internal directories.
Click to hide internal directories.