Documentation
¶
Overview ¶
Package input replaces the old file_helper grab-bag with a small, error-honest set of helpers for the two things automation modules actually need from disk: reading a list file (proxies, emails, combos, names) and consuming it safely across worker goroutines.
The three layers, smallest to largest:
- Lines / NonEmptyLines / Files — plain readers that return errors instead of swallowing them (the old file_helper printed the error and kept going with a nil scanner).
- Queue[T] — a thread-safe consumer: Next() hands each item to exactly one worker, Random() samples with replacement.
- Combo / ParseCombo — the "user:pass" convenience on top.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CSV ¶
CSV parses path as RFC-4180 CSV and returns every row. Ragged rows are allowed (FieldsPerRecord = -1) so partially-filled files still load, and leading whitespace is trimmed. Header handling, if any, is left to the module.
func Columns ¶
Columns splits each non-empty line of path on sep into trimmed fields. It's the generic delimited-list loader: the kit does not decide what the columns mean — credentials, tokens, coordinates, proxy+label pairs — that is entirely the module's call.
rows, _ := input.Columns("list.txt", ":")
// rows[0] == []string{"a@b.com", "hunter2"} // module decides the meaning
func Files ¶
Files returns the base names of the regular files directly under dir (non-recursive, subdirectories skipped). A missing directory yields an empty slice and a nil error so callers can treat "no files yet" and "no dir yet" identically.
func Lines ¶
Lines reads every line of the file at path (newline-stripped) and returns them in order. Unlike the old ReadFileLineArray it surfaces open/scan errors instead of printing and continuing.
func NonEmptyLines ¶
NonEmptyLines is Lines with blank / whitespace-only lines dropped and each surviving line trimmed. This is what most list files want.
Types ¶
type Queue ¶
type Queue[T any] struct { // contains filtered or unexported fields }
Queue is a thread-safe consumer over a fixed slice of items. It is the canonical work source for a multi-threaded module: build one from a list file, then have every worker pull from it.
Two consumption styles:
- Next() drains the queue in order, handing each item to exactly one worker (the "process every account once" pattern). When empty it returns ("", false) / (zero, false).
- Random() samples with replacement and never empties (the "pick a random proxy / name" pattern).
A zero Queue is not usable; always construct via NewQueue or the Load* helpers. All methods are safe for concurrent use.
func LineQueue ¶
LineQueue loads the non-empty, trimmed lines of a file into a string Queue — the common case for name/email/token lists.
func NewQueue ¶
NewQueue wraps items in a Queue. The slice is copied so later mutation of the caller's slice does not affect the queue.
func (*Queue[T]) Next ¶
Next returns the next unconsumed item and advances the cursor. The bool is false once every item has been handed out.
func (*Queue[T]) Random ¶
Random returns a uniformly random item (with replacement). The bool is false only when the queue is empty. Random ignores the Next cursor, so it keeps working after the queue has been fully drained by Next.