broker

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const MinSaneBrokerCount = 200

MinSaneBrokerCount is the floor below which the main broker database is assumed to be truncated or corrupt rather than legitimately small. Used both by `update-brokers` (before replacing the local copy) and by Validate.

View Source
const MinVerifiedBrokerCount = 20

MinVerifiedBrokerCount is the equivalent floor for the hand-built, registry-sourced verified list (data/brokers-verified.yaml), which is deliberately a fraction of the size of the main list.

Variables

This section is empty.

Functions

func UserBrokersPath

func UserBrokersPath() string

UserBrokersPath is where `eraser update-brokers` writes a refreshed copy of the list; Load() prefers it over the embedded default when it exists.

Types

type Broker

type Broker struct {
	ID        string `yaml:"id"`
	Name      string `yaml:"name"`
	Email     string `yaml:"email"`
	Website   string `yaml:"website,omitempty"`
	OptOutURL string `yaml:"opt_out_url,omitempty"`
	Region    string `yaml:"region"`             // "us", "eu", "global"
	Category  string `yaml:"category,omitempty"` // "people-search", "marketing", "background-check", etc.
	Notes     string `yaml:"notes,omitempty"`
}

type BrokerDatabase

type BrokerDatabase struct {
	Brokers []Broker `yaml:"brokers"`
}

func Load

func Load(overridePath string) (*BrokerDatabase, error)

Load resolves the broker database from, in order: overridePath (the --brokers flag) when set, then ~/.eraser/brokers.yaml when it exists, then the copy embedded in the binary. There is no implicit ./data or <exe-dir>/data scanning any more.

func LoadFromFile

func LoadFromFile(path string) (*BrokerDatabase, error)

LoadFromFile parses a broker YAML file from an explicit path.

func LoadList added in v0.7.0

func LoadList(overridePath, configPath, listName string) (*BrokerDatabase, error)

LoadList resolves the broker database for send-family commands: --brokers, then options.broker_file, then the embedded verified list for "verified", else Load(). audit, guides, update-brokers and reply processing call Load directly.

func Parse

func Parse(raw []byte) (*BrokerDatabase, error)

Parse unmarshals and sanitizes a broker YAML document. Used to validate a freshly downloaded list before it replaces the local copy.

func Validate

func Validate(raw []byte, minCount int) (*BrokerDatabase, error)

Validate checks raw broker YAML (min count, id/name, unique ids, known regions, plausible emails, http(s) URLs) without sanitizing, and reports every problem in one error. CI runs it; the parsed db is returned too.

func (*BrokerDatabase) Add

func (db *BrokerDatabase) Add(broker Broker) error

func (*BrokerDatabase) Filter

func (db *BrokerDatabase) Filter(regions []string, excluded []string, excludedCategories []string) []Broker

Filter returns brokers matching the given regions (empty means "all"), excluding any broker whose ID/name is in excluded or whose category (case-insensitive) is in excludedCategories - e.g. "requires-id" to skip brokers that demand a government ID document before acting on a request.

func (*BrokerDatabase) FindByEmail

func (db *BrokerDatabase) FindByEmail(email string) *Broker

FindByEmail finds a broker by their email address

func (*BrokerDatabase) FindByID

func (db *BrokerDatabase) FindByID(id string) *Broker

func (*BrokerDatabase) MarkEmailUnreachable

func (db *BrokerDatabase) MarkEmailUnreachable(email, reason string) *Broker

MarkEmailUnreachable clears a broker's email (old address and reason go to Notes) instead of deleting it: a bounce usually means a changed address, not a gone company. Returns the broker, or nil if none matched.

func (*BrokerDatabase) RemoveByEmail

func (db *BrokerDatabase) RemoveByEmail(email string) *Broker

RemoveByEmail removes a broker by their email address Returns the removed broker, or nil if not found

func (*BrokerDatabase) RemoveByID

func (db *BrokerDatabase) RemoveByID(id string) *Broker

RemoveByID removes a broker by their ID Returns the removed broker, or nil if not found

func (*BrokerDatabase) Save

func (db *BrokerDatabase) Save(path string) error

func (*BrokerDatabase) SaveWithBackup

func (db *BrokerDatabase) SaveWithBackup(path string) error

SaveWithBackup saves the database to file, creating a backup first

func (*BrokerDatabase) Select added in v0.7.0

func (db *BrokerDatabase) Select(ids, regions, categories, excluded, excludedCategories []string) []Broker

func (*BrokerDatabase) UnknownIDs added in v0.7.0

func (db *BrokerDatabase) UnknownIDs(ids []string) []string

Jump to

Keyboard shortcuts

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