Documentation
¶
Index ¶
Constants ¶
const ( // HybridComparisonMode is used in scenarios where the goal is to compare data // across multiple IP database readers. In this mode, the output includes data // from all readers, facilitating a comprehensive comparison of the differences // between each data source. This mode is particularly useful for analyzing // discrepancies and inconsistencies across various IP databases. HybridComparisonMode = "comparison" // HybridAggregationMode is designed for situations where a unified view of data // is needed. In this mode, the output is a single, aggregated set of data that // combines information from all the IP database readers. If a particular field is // missing from one reader, it is supplemented by another, ensuring a more // complete and cohesive dataset. This mode is ideal for creating a comprehensive // and enriched view of IP information by leveraging the strengths of multiple databases. HybridAggregationMode = "aggregation" )
const ChannelBufferSize = 1000
ChannelBufferSize why 1000? I don't know :)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HybridReader ¶ added in v0.3.0
type HybridReader struct { OperateChain *operate.IPOperateChain // Chain of operations to be applied to IP information. // contains filtered or unexported fields }
HybridReader integrates multiple IP database readers into a single entity. It supports various operational modes (like comparison and aggregation) for querying and combining results from different IP databases.
func NewHybridReader ¶ added in v0.3.0
func NewHybridReader(operateChain *operate.IPOperateChain, dbReaders ...format.Reader) (*HybridReader, error)
NewHybridReader constructs a new HybridReader with the provided IP operation chain and database readers. It initializes the reader's metadata by merging metadata from all provided readers.
func (*HybridReader) Close ¶ added in v0.3.0
func (h *HybridReader) Close() error
Close method ensures that all underlying database readers are properly closed.
func (*HybridReader) Find ¶ added in v0.3.0
Find performs parallel queries across all underlying database readers using the specified IP address. It combines the results based on the operational mode of the HybridReader: either comparing data or aggregating it.
func (*HybridReader) Meta ¶ added in v0.3.0
func (h *HybridReader) Meta() *model.Meta
Meta returns the combined metadata of the IP databases attached to the HybridReader.
func (*HybridReader) SetOption ¶ added in v0.3.0
func (h *HybridReader) SetOption(option interface{}) error
SetOption configures the HybridReader with the provided option, particularly the operational mode.
type HybridReaderOption ¶ added in v0.3.0
type HybridReaderOption struct {
Mode string
}
type SimpleDumper ¶ added in v0.3.1
SimpleDumper is a structure that facilitates the extraction of IP information within a specified range.
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(readerJobs int) error
Dump transfers IP data from the Reader to the Writer.
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) 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.