lib

package
v0.0.0-...-6d422a6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2024 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MetadataStartMarker = "\xAB\xCD\xEFMaxMind.com"
)

Variables

View Source
var CmdImportFlagsDefaults = CmdImportFlags{
	Help:                false,
	In:                  "",
	Out:                 "",
	Csv:                 false,
	Tsv:                 false,
	Json:                false,
	Fields:              nil,
	FieldsFromHdr:       false,
	RangeMultiCol:       false,
	JoinKeyCol:          false,
	NoFields:            false,
	NoNetwork:           false,
	Ip:                  6,
	Size:                32,
	Merge:               "none",
	IgnoreEmptyVals:     false,
	DisallowReserved:    false,
	Alias6to4:           false,
	DisableMetadataPtrs: true,
}

Functions

func AppendCSVRecord

func AppendCSVRecord(f CmdImportFlags, dataColStart int, delim rune, parts []string, tree *mmdbwriter.Tree) error

func CmdDiff

func CmdDiff(f CmdDiffFlags, args []string, printHelp func()) error

func CmdExport

func CmdExport(f CmdExportFlags, args []string, printHelp func()) error

func CmdImport

func CmdImport(f CmdImportFlags, args []string, printHelp func()) error

func CmdMetadata

func CmdMetadata(f CmdMetadataFlags, args []string, printHelp func()) error

func CmdRead

func CmdRead(f CmdReadFlags, args []string, printHelp func()) error

func CmdVerify

func CmdVerify(f CmdVerifyFlags, args []string, printHelp func()) error

func ConvertToMMDBType

func ConvertToMMDBType(value interface{}) (mmdbtype.DataType, error)

func ParseCSVHeaders

func ParseCSVHeaders(parts []string, f *CmdImportFlags, dataColStart *int)

func Preprocess

func Preprocess(f CmdImportFlags, tree *mmdbwriter.Tree) error

func ProcessJsonData

func ProcessJsonData(
	data map[string]interface{},
	subMap *mmdbtype.Map,
) error

Types

type CmdDiffFlags

type CmdDiffFlags struct {
	Help    bool
	Subnets bool
	Records bool
}

CmdDiffFlags are flags expected by CmdDiff.

func (*CmdDiffFlags) Init

func (f *CmdDiffFlags) Init()

Init initializes the common flags available to CmdDiff with sensible defaults.

pflag.Parse() must be called to actually use the final flag values.

type CmdExportFlags

type CmdExportFlags struct {
	Help   bool
	NoHdr  bool
	Format string
	Out    string
}

CmdExportFlags are flags expected by CmdExport.

func (*CmdExportFlags) Init

func (f *CmdExportFlags) Init()

Init initializes the common flags available to CmdExport with sensible defaults.

pflag.Parse() must be called to actually use the final flag values.

type CmdImportFlags

type CmdImportFlags struct {
	Help                bool
	In                  string
	Out                 string
	Csv                 bool
	Tsv                 bool
	Json                bool
	Fields              []string
	FieldsFromHdr       bool
	RangeMultiCol       bool
	JoinKeyCol          bool
	NoFields            bool
	NoNetwork           bool
	Ip                  int
	Size                int
	Merge               string
	IgnoreEmptyVals     bool
	DisallowReserved    bool
	Alias6to4           bool
	DisableMetadataPtrs bool
}

CmdImportFlags are flags expected by CmdImport.

func (*CmdImportFlags) Init

func (f *CmdImportFlags) Init()

Init initializes the common flags available to CmdImport with sensible defaults.

pflag.Parse() must be called to actually use the final flag values.

type CmdMetadataFlags

type CmdMetadataFlags struct {
	Help      bool
	NoColor   bool
	Format    string
	DataTypes bool
}

CmdMetadataFlags are flags expected by CmdMetadata.

func (*CmdMetadataFlags) Init

func (f *CmdMetadataFlags) Init()

Init initializes the common flags available to CmdMetadata with sensible defaults.

pflag.Parse() must be called to actually use the final flag values.

type CmdReadFlags

type CmdReadFlags struct {
	Help    bool
	NoColor bool
	Format  string
}

CmdReadFlags are flags expected by CmdRead.

func (*CmdReadFlags) Init

func (f *CmdReadFlags) Init()

Init initializes the common flags available to CmdRead with sensible defaults.

pflag.Parse() must be called to actually use the final flag values.

type CmdVerifyFlags

type CmdVerifyFlags struct {
	Help bool
}

CmdVerifyFlags are flags expected by CmdVerify.

func (*CmdVerifyFlags) Init

func (f *CmdVerifyFlags) Init()

Init initializes the common flags available to CmdVerify with sensible defaults.

pflag.Parse() must be called to actually use the final flag values.

type TsvReader

type TsvReader struct {
	// contains filtered or unexported fields
}

func NewTsvReader

func NewTsvReader(r io.Reader) *TsvReader

func (*TsvReader) Read

func (r *TsvReader) Read() (record []string, err error)

type TsvWriter

type TsvWriter struct {
	// contains filtered or unexported fields
}

func NewTsvWriter

func NewTsvWriter(w io.Writer) *TsvWriter

func (*TsvWriter) Error

func (w *TsvWriter) Error() error

func (*TsvWriter) Flush

func (w *TsvWriter) Flush()

func (*TsvWriter) Write

func (w *TsvWriter) Write(record []string) error

type TypeSizes

type TypeSizes struct {
	PointerSize           int64 `json:"pointer_size"`
	Utf8StringSize        int64 `json:"utf8_string_size"`
	DoubleSize            int64 `json:"double_size"`
	BytesSize             int64 `json:"bytes_size"`
	Unsigned16bitIntSize  int64 `json:"unsigned_16bit_int_size"`
	Unsigned32bitIntSize  int64 `json:"unsigned_32bit_int_size"`
	Signed32bitIntSize    int64 `json:"signed_32bit_int_size"`
	Unsigned64bitIntSize  int64 `json:"unsigned_64bit_int_size"`
	Unsigned128bitIntSize int64 `json:"unsigned_128bit_int_size"`
	MapKeyValueCount      int64 `json:"map_key_value_pair_count"`
	ArrayLength           int64 `json:"array_length"`
	FloatSize             int64 `json:"float_size"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL