Documentation
¶
Overview ¶
Package convert transforms a GeoIP2/GeoLite2 CSV to various formats.
Index ¶
- Constants
- func ConvertFile(config *Config, inputFile string, outputFile string) error
- func PrintMemUsage()
- type BaseFieldMapper
- type BooleanFieldMapper
- type Config
- type Converter
- type FieldConfig
- type FieldMapper
- type Float32FieldMapper
- type Float64FieldMapper
- type Int32FieldMapper
- type MapFunc
- type RowMapper
- type StringFieldMapper
- type Uint16FieldMapper
- type Uint32FieldMapper
- type Uint64FieldMapper
Constants ¶
View Source
const ( STR_START_IP string = "start_ip_int" STR_END_IP string = "end_ip_int" )
Variables ¶
This section is empty.
Functions ¶
func ConvertFile ¶
ConvertFile converts the MaxMind GeoIP2 or GeoLite2 CSV file `inputFile` to `outputFile` file using a different representation of the network. The representation can be specified by setting one or more of `cidr`, `ipRange`, `intRange` or `hexRange` to true. If none of these are set to true, it will strip off the network information.
func PrintMemUsage ¶
func PrintMemUsage()
Types ¶
type BaseFieldMapper ¶
type BaseFieldMapper struct {
FieldConfig
// contains filtered or unexported fields
}
func (*BaseFieldMapper) GetConfig ¶
func (m *BaseFieldMapper) GetConfig() *FieldConfig
func (*BaseFieldMapper) GetTargetFieldComponents ¶
func (m *BaseFieldMapper) GetTargetFieldComponents() []string
func (*BaseFieldMapper) Preprocess ¶
func (m *BaseFieldMapper) Preprocess(s string) string
func (*BaseFieldMapper) ShouldOmitRecord ¶
func (m *BaseFieldMapper) ShouldOmitRecord(input string) bool
func (*BaseFieldMapper) ShouldOmitValue ¶
func (m *BaseFieldMapper) ShouldOmitValue(input string) bool
type BooleanFieldMapper ¶
type BooleanFieldMapper struct {
BaseFieldMapper
}
func NewBooleanFieldMapper ¶
func NewBooleanFieldMapper(fc *FieldConfig) *BooleanFieldMapper
type Config ¶
type Config struct {
DatabaseType string `yaml:"databaseType"`
RecordSize uint8 `yaml:"recordSize"`
UseValueCache bool `yaml:"useValueCache"`
Fields []*FieldConfig `yaml:"fields"`
}
type FieldConfig ¶
type FieldConfig struct {
Name string `yaml:"name"`
Target string `yaml:"target"`
Type string `yaml:"type"`
Capitalization string `yaml:"capitalization"`
Translate map[string]string `yaml:"translate"`
IgnoreEmpty bool `yaml:"ignoreEmpty"`
Critical bool `yaml:"critical"`
OmitZeroValue bool `yaml:"omitZeroValue"`
FieldMapper FieldMapper
}
func (*FieldConfig) Validate ¶
func (f *FieldConfig) Validate() error
type FieldMapper ¶
type FieldMapper interface {
Map(string) (mmdbtype.DataType, error)
ShouldOmitRecord(string) bool
ShouldOmitValue(string) bool
GetConfig() *FieldConfig
GetTargetFieldComponents() []string
}
func NewFieldMapper ¶
func NewFieldMapper(f *FieldConfig) (FieldMapper, error)
type Float32FieldMapper ¶
type Float32FieldMapper struct {
BaseFieldMapper
}
func NewFloat32FieldMapper ¶
func NewFloat32FieldMapper(fc *FieldConfig) *Float32FieldMapper
type Float64FieldMapper ¶
type Float64FieldMapper struct {
BaseFieldMapper
}
func NewFloat64FieldMapper ¶
func NewFloat64FieldMapper(fc *FieldConfig) *Float64FieldMapper
type Int32FieldMapper ¶
type Int32FieldMapper struct {
BaseFieldMapper
}
func NewInt32FieldMapper ¶
func NewInt32FieldMapper(fc *FieldConfig) *Int32FieldMapper
type StringFieldMapper ¶
type StringFieldMapper struct {
BaseFieldMapper
// contains filtered or unexported fields
}
func NewStringFieldMapper ¶
func NewStringFieldMapper(fc *FieldConfig) *StringFieldMapper
type Uint16FieldMapper ¶
type Uint16FieldMapper struct {
BaseFieldMapper
}
func NewUint16FieldMapper ¶
func NewUint16FieldMapper(fc *FieldConfig) *Uint16FieldMapper
type Uint32FieldMapper ¶
type Uint32FieldMapper struct {
BaseFieldMapper
}
func NewUint32FieldMapper ¶
func NewUint32FieldMapper(fc *FieldConfig) *Uint32FieldMapper
type Uint64FieldMapper ¶
type Uint64FieldMapper struct {
BaseFieldMapper
}
func NewUint64FieldMapper ¶
func NewUint64FieldMapper(fc *FieldConfig) *Uint64FieldMapper
Click to show internal directories.
Click to hide internal directories.