Documentation
¶
Overview ¶
Package conf contains methods and structures for configuration.
Index ¶
- type Cfg
- func (c *Cfg) Addr() string
- func (c *Cfg) Close() error
- func (c *Cfg) GetCity(host string) (*geoip2.City, error)
- func (c *Cfg) GetHeaders(r *http.Request) []StrParam
- func (c *Cfg) GetIP(r *http.Request) (string, error)
- func (c *Cfg) GetParams(r *http.Request) []StrParam
- func (c *Cfg) Info(r *http.Request) (*IPInfo, error)
- type IPInfo
- type StrParam
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cfg ¶
type Cfg struct { Host string `json:"host"` Port uint `json:"port"` Db string `json:"db"` IgnoreHeaders []string `json:"ignore_headers"` IPHeader string `json:"ip_header"` CacheSize int `json:"cache_size"` // contains filtered or unexported fields }
Cfg is configuration settings struct.
func (*Cfg) GetHeaders ¶ added in v1.0.0
GetHeaders returns sorted request headers excluding ignored values.
type IPInfo ¶ added in v1.4.0
type IPInfo struct { IP string `xml:"ip" json:"ip"` Country string `xml:"country" json:"country"` City string `xml:"city" json:"city"` Longitude float64 `xml:"longitude" json:"longitude"` Latitude float64 `xml:"latitude" json:"latitude"` UTCTime string `xml:"utc_time" json:"utc_time"` TimeZone string `xml:"time_zone" json:"time_zone"` Language string `xml:"language" json:"language"` Timestamp time.Time `xml:"-" json:"-"` }
IPInfo is IP and related info for response.
func (*IPInfo) LocalDateTime ¶ added in v1.7.0
LocalDateTime returns separated local date and time strings or "-" if error.
Click to show internal directories.
Click to hide internal directories.