Documentation ¶
Index ¶
- Constants
- Variables
- type ErrInvalidFile
- type LocationInfo
- type Locator
- type LocatorStore
- type Number2Ip
- func (g *Number2Ip) ConfigOptions() []Option
- func (g *Number2Ip) Description() string
- func (g *Number2Ip) Init() error
- func (g *Number2Ip) RawTransform(datas []string) ([]string, error)
- func (g *Number2Ip) SampleConfig() string
- func (g *Number2Ip) SetStats(err string) StatsInfo
- func (g *Number2Ip) Stage() string
- func (g *Number2Ip) Stats() StatsInfo
- func (g *Number2Ip) Transform(datas []Data) ([]Data, error)
- func (g *Number2Ip) Type() string
- type Transformer
- func (t *Transformer) Close() error
- func (*Transformer) ConfigOptions() []Option
- func (*Transformer) Description() string
- func (t *Transformer) Init() error
- func (*Transformer) RawTransform(datas []string) ([]string, error)
- func (*Transformer) SampleConfig() string
- func (t *Transformer) ServerConfig() map[string]interface{}
- func (t *Transformer) SetMapValue(m map[string]interface{}, val interface{}, keys ...string) error
- func (t *Transformer) SetStats(err string) StatsInfo
- func (t *Transformer) Stage() string
- func (t *Transformer) Stats() StatsInfo
- func (t *Transformer) Transform(datas []Data) ([]Data, error)
- func (*Transformer) Type() string
Constants ¶
View Source
const ( Region = "Region" City = "City" Country = "Country" Isp = "Isp" CountryCode = "CountryCode" Latitude = "Latitude" Longitude = "Longitude" DistrictCode = "DistrictCode" )
View Source
const Name = "IP"
View Source
const Null = "N/A"
Variables ¶
View Source
var ErrInvalidIP = errors.New("invalid IP format")
Functions ¶
This section is empty.
Types ¶
type ErrInvalidFile ¶
func (ErrInvalidFile) Error ¶
func (e ErrInvalidFile) Error() string
type LocationInfo ¶
type LocationInfo struct { Country string Region string City string Isp string CountryCode string Latitude string Longitude string DistrictCode string }
LocationInfo stores IP location information.
type Locator ¶
type Locator interface { Find(string) (*LocationInfo, error) Close() error }
Locator represents an IP information loc.
func NewLocator ¶
NewLocator returns a new IP locator based on extension of given data file.
type LocatorStore ¶
type LocatorStore struct {
// contains filtered or unexported fields
}
LocatorStore 按照文件路径保存了对应的 Locator,避免重复实例化浪费内存
func (*LocatorStore) Get ¶
func (s *LocatorStore) Get(fpath string) Locator
Get 返回对应路径的 Locator 并将其引用计数加 1,如果 Locator 不存在则返回 nil
func (*LocatorStore) Remove ¶
func (s *LocatorStore) Remove(fpath string)
Remove 将指定路径的 Locator 引用计数减 1 并在为零时从 Store 中移除
func (*LocatorStore) Set ¶
func (s *LocatorStore) Set(fpath string, loc Locator)
Set 将 Locator 按照指定路径保存到 Store 中
type Number2Ip ¶
type Number2Ip struct { Key string `json:"key"` New string `json:"new"` // contains filtered or unexported fields }
func (*Number2Ip) ConfigOptions ¶
func (g *Number2Ip) ConfigOptions() []Option
func (*Number2Ip) Description ¶
func (*Number2Ip) SampleConfig ¶
type Transformer ¶
type Transformer struct { StageTime string `json:"stage"` Key string `json:"key"` DataPath string `json:"data_path"` TransformAt string `json:"transform_at"` KeyAsPrefix bool `json:"key_as_prefix"` Language string `json:"language"` // contains filtered or unexported fields }
func (*Transformer) Close ¶
func (t *Transformer) Close() error
func (*Transformer) ConfigOptions ¶
func (*Transformer) ConfigOptions() []Option
func (*Transformer) Description ¶
func (*Transformer) Description() string
func (*Transformer) Init ¶
func (t *Transformer) Init() error
func (*Transformer) RawTransform ¶
func (*Transformer) RawTransform(datas []string) ([]string, error)
func (*Transformer) SampleConfig ¶
func (*Transformer) SampleConfig() string
func (*Transformer) ServerConfig ¶
func (t *Transformer) ServerConfig() map[string]interface{}
func (*Transformer) SetMapValue ¶
func (t *Transformer) SetMapValue(m map[string]interface{}, val interface{}, keys ...string) error
通过层级key设置value值, 如果keys不存在则不加前缀,否则加前缀
func (*Transformer) SetStats ¶
func (t *Transformer) SetStats(err string) StatsInfo
func (*Transformer) Stage ¶
func (t *Transformer) Stage() string
func (*Transformer) Stats ¶
func (t *Transformer) Stats() StatsInfo
func (*Transformer) Transform ¶
func (t *Transformer) Transform(datas []Data) ([]Data, error)
func (*Transformer) Type ¶
func (*Transformer) Type() string
Click to show internal directories.
Click to hide internal directories.