ipio

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dump

func Dump(r format.Reader, w format.Writer) error

Dump is a convenience method to transfer IP data from a reader to a writer. It is equivalent to calling NewStandardDumper(r, w).Dump().

Types

type StandardDumper

type StandardDumper struct {
	format.Reader
	format.Writer
	// contains filtered or unexported fields
}

StandardDumper serves as a standard mechanism to transfer IP database from one format to another.

func NewStandardDumper

func NewStandardDumper(r format.Reader, w format.Writer) *StandardDumper

NewStandardDumper initializes and returns a new StandardDumper.

func (*StandardDumper) Dump

func (d *StandardDumper) Dump() error

Dump transfers IP data from the Reader to the Writer.

func (*StandardDumper) Next

func (d *StandardDumper) Next() bool

Next fetches the next IP information from the Reader.

type StandardReader

type StandardReader struct {
	DBReader     format.Reader
	OperateChain *operate.IPOperateChain
	// contains filtered or unexported fields
}

StandardReader is a Reader designed for IP databases. Unlike the Reader in the format package, this reader processes the IP information it reads, such as filtering fields, rewriting data, supplementing data, etc., controlled by operate.IPOperateChain.

func NewStandardReader

func NewStandardReader(dbReader format.Reader, operateChain *operate.IPOperateChain) *StandardReader

NewStandardReader initializes and returns a new StandardReader.

func (*StandardReader) Close

func (s *StandardReader) Close() error

Close closes the IP database.

func (*StandardReader) Find

func (s *StandardReader) Find(ip net.IP) (*model.IPInfo, error)

Find retrieves IP information based on the given IP address.

func (*StandardReader) Meta

func (s *StandardReader) Meta() *model.Meta

Meta returns the meta-information of the IP database.

func (*StandardReader) SetOption

func (s *StandardReader) SetOption(option interface{}) error

SetOption configures the StandardReader with the provided option.

type StandardReaderOption

type StandardReaderOption struct {
	IPVersion int

	Fields []string
}

Jump to

Keyboard shortcuts

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