engine

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortItems

func SortItems(items []BatchItem, sortBy string) error

func ValidateFilterMode

func ValidateFilterMode(filter string) error

func ValidateSortMode

func ValidateSortMode(sortBy string) error

Types

type BatchEngine

type BatchEngine struct {
	Workers   int
	Timeout   time.Duration
	Providers []abuse.Provider
	Abuse     bool
	Checker   CheckFunc
	SortBy    string
	Filter    string
	Progress  ProgressFunc
}

func (*BatchEngine) Run

func (e *BatchEngine) Run(ctx context.Context, endpoints []endpoint.Endpoint) (*BatchResult, error)

type BatchItem

type BatchItem struct {
	Endpoint     endpoint.Endpoint `json:"endpoint"`
	Reachable    bool              `json:"reachable"`
	LatencyMs    int64             `json:"latency_ms"`
	AbuseScore   int               `json:"abuse_score"`
	Purity       string            `json:"purity"`
	ProviderErrs []string          `json:"provider_errors,omitempty"`
}

func FilterItems

func FilterItems(items []BatchItem, filter string) ([]BatchItem, error)

type BatchResult

type BatchResult struct {
	Items   []BatchItem  `json:"items"`
	Summary BatchSummary `json:"summary"`
}

type BatchSummary

type BatchSummary struct {
	Total       int   `json:"total"`
	Processed   int   `json:"processed"`
	Reachable   int   `json:"reachable"`
	Unreachable int   `json:"unreachable"`
	Abusive     int   `json:"abusive"`
	Suspicious  int   `json:"suspicious"`
	Clean       int   `json:"clean"`
	AvgLatency  int64 `json:"avg_latency_ms"`
	Errors      int   `json:"errors"`
}

func Summarize

func Summarize(items []BatchItem) BatchSummary

type CollisionSource

type CollisionSource struct {
	File string `json:"file"`
	Line int    `json:"line"`
}

type DedupeResult

type DedupeResult struct {
	Unique      []endpoint.Endpoint          `json:"unique"`
	Collisions  map[string][]CollisionSource `json:"collisions,omitempty"`
	UniqueCount int                          `json:"unique_count"`
	TotalCount  int                          `json:"total_count"`
}

func Dedupe

func Dedupe(inputs []SourceEndpoint) DedupeResult

func DedupeFiles

func DedupeFiles(paths []string) (DedupeResult, error)

type ProgressFunc

type ProgressFunc func(processed, total int)

type SourceEndpoint

type SourceEndpoint struct {
	Endpoint endpoint.Endpoint
	Source   CollisionSource
}

func ParseFile

func ParseFile(path string) ([]SourceEndpoint, error)

func ParseReader

func ParseReader(r io.Reader, sourceName string) ([]SourceEndpoint, error)

Jump to

Keyboard shortcuts

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