Documentation
¶
Overview ¶
Example (ShardedUsage) ¶
helper used in some debugging — kept here so future tests can adopt it.
fmt.Println("kunji validate -f keys.txt --sharded")
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatViolations ¶ added in v1.2.1
FormatViolations renders a human-readable list of violated thresholds for CI logs.
func Match ¶ added in v1.2.1
func Match(exprs []FilterExpr, result *models.ValidationResult) bool
Match reports whether result satisfies every expression. A nil/empty exprs matches everything.
Types ¶
type FilterExpr ¶ added in v1.2.1
FilterExpr is a parsed filter clause.
Syntax: "field=value" or "field!=value". value can be a single string or a comma-separated list ("openai,stripe") which is treated as "any of these". Currently supported fields: provider, is_valid, status_code, error_code, key.
func ParseFilterExprs ¶ added in v1.2.1
func ParseFilterExprs(raw []string) ([]FilterExpr, error)
ParseFilterExprs parses the raw --filter arguments into a slice of expressions. Returns an error for unknown fields or malformed input.
An empty input returns a nil slice, which matches everything (no filter).
type RunStats ¶ added in v1.2.1
RunStats is the aggregate of a finished run, used for CI threshold checks. All counts are absolute; percentages are computed inside Evaluate.
type Runner ¶
type Runner struct {
Threads int
Proxy string
Retries int
Timeout int
OutFile string
ManualProvider string
ManualCategory string
Resume bool
MinKeyLength int
OnlyValid bool
MinBalance float64
DeepScan bool
NoCache bool
SkipMetadata bool
CanaryCheck bool
Password string
Bench bool
Quiet bool
Format string
Factory *validators.ValidatorFactory
Detector *validators.Detector
ProxyRotator *client.ProxyRotator
Sinks []sink.Sink
// FilterExprs is the parsed --filter argument. Empty means "no filter".
FilterExprs []FilterExpr
// Audit is the audit logger. nil disables audit logging.
Audit *audit.Logger
// History is the run history logger. nil disables history persistence.
History *history.Logger
// RunID is the unique identifier stamped on every history record.
RunID string
// Thresholds holds parsed --fail-if conditions. Empty disables CI mode.
Thresholds []Threshold
// Stats tracks aggregate run counters. Populated during runInternal;
// intended for the CI threshold evaluator.
Stats RunStats
// EmitDedupe suppresses duplicate (provider, key, is_valid) emits in the
// JSONL stream. The first emission wins; subsequent identical results
// during the same run are dropped silently.
EmitDedupe bool
// Sharded enables per-provider worker pools. When true, detection happens
// once at the feeder and each provider gets its own small worker pool,
// reducing contention on the proxy rotator and per-provider rate
// limiter. Off by default.
Sharded bool
// contains filtered or unexported fields
}
func NewRunnerWithOptions ¶ added in v1.2.0
func NewRunnerWithOptions(threads int, proxy string, retries int, timeout int, out string, manualProv string, manualCat string, resume bool, onlyValid bool, minBalance float64, skipMetadata bool, canaryCheck bool, factoryOpts validators.FactoryOptions) (*Runner, error)
NewRunnerWithOptions is the configurable constructor. factoryOpts controls the positive-cache layer (persistent on/off) and whether caching is disabled entirely (--no-cache).
func (*Runner) GetKeyStream ¶ added in v1.0.8
func (*Runner) PreflightProxyCheck ¶ added in v1.0.8
func (r *Runner) PreflightProxyCheck()
func (*Runner) RunSource ¶ added in v1.2.0
RunSource pulls keys from a Source plugin and feeds them into the validation pipeline as if they came from a single reader. The Source's Total() is used when non-zero so the progress bar reflects the real key count; otherwise a streaming run is launched (totalKeys=0).
type Threshold ¶ added in v1.2.1
type Threshold struct {
Metric string // "invalid" | "valid" | "error" | "rate_limit" | "skipped" | "total"
Op string // ">" | "<" | ">=" | "<="
Value float64
Percent bool
RawInput string
}
Threshold is one parsed "metric op value" clause from --fail-if.
invalid > 5% (5 percent of total) invalid > 100 (100 absolute invalid keys) valid >= 50 (at least 50 valid keys)
func Evaluate ¶ added in v1.2.1
Evaluate checks every threshold against stats and returns the violations. ok is true when no thresholds were violated.
func ParseThreshold ¶ added in v1.2.1
ParseThreshold parses one --fail-if argument of the form:
metric op value[%] e.g. invalid > 5%, valid >= 10, error < 1%
Whitespace around metric/op/value is optional.
func ParseThresholds ¶ added in v1.2.1
ParseThresholds parses every --fail-if argument.