engine

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCleanItem added in v1.1.0

func IsCleanItem(item BatchItem) bool

func SortItems

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

func ValidateFilterMode

func ValidateFilterMode(filter string) error

func ValidateSortMode

func ValidateSortMode(sortBy string) error

func WriteExport added in v1.1.0

func WriteExport(w io.Writer, items []BatchItem, format 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
	ResultProgress ResultProgressFunc
	RetryProgress  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"`
	Protocol string            `json:"protocol,omitempty"`
	// RawURI stores an original proxy share link only for explicit share-link
	// exports. It is excluded from JSON to avoid leaking embedded credentials.
	RawURI                  string                 `json:"-"`
	Country                 string                 `json:"country,omitempty"`
	CountryCode             string                 `json:"country_code,omitempty"`
	Reachable               bool                   `json:"reachable"`
	LatencyMs               int64                  `json:"latency_ms"`
	AbuseScore              int                    `json:"abuse_score"`
	Purity                  string                 `json:"purity"`
	SpeedMbps               float64                `json:"speed_mbps,omitempty"`
	ProviderSuccesses       int                    `json:"provider_successes,omitempty"`
	ProviderTotal           int                    `json:"provider_total,omitempty"`
	ProviderErrs            []string               `json:"provider_errors,omitempty"`
	ProviderResults         []abuse.ProviderResult `json:"-"`
	PendingProviderRetries  []string               `json:"-"`
	ProviderResolvedAddress string                 `json:"-"`
}

func CleanItems added in v1.1.0

func CleanItems(items []BatchItem) []BatchItem

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"`
	SpeedMbps   float64 `json:"speed_mbps,omitempty"`
	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 ExportFile added in v1.1.0

type ExportFile struct {
	Group string
	Path  string
	Count int
}

type ProgressFunc

type ProgressFunc func(processed, total int)

type ResultProgressFunc added in v1.1.0

type ResultProgressFunc func(item BatchItem, 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)

type SplitExportResult added in v1.1.0

type SplitExportResult struct {
	Directory string
	Count     int
	Files     []ExportFile
}

func WriteSplitExport added in v1.1.0

func WriteSplitExport(directory string, items []BatchItem, groupBy string, format string) (SplitExportResult, error)

Jump to

Keyboard shortcuts

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