Documentation
¶
Overview ¶
Package listing turns the entries of the published lists into the keys their snapshot rows are looked up by: a site's normalised host and path, an address, an E.164 phone number or a SIREN, normalised by the domain value objects. Lists that share entries, such as the AMF and ACPR blacklists, give them the same key, so a check can name both sources.
Index ¶
- Constants
- Variables
- func BlacklistColumns() []string
- func CheckBlacklist(snap domain.Snapshot) error
- func Columns(rest ...string) []string
- func ParseDate(column, s string) (time.Time, error)
- func WhitelistOf(snap domain.Snapshot, header []string, ...) (*domain.Whitelist, error)
- type Key
- type NumberingReader
- type Reader
- type Snapshots
- type WhitelistReader
Constants ¶
const ( // ColumnKind is the kind of the key: "domain", "email", "phone" or // "siren". ColumnKind = "kind" // ColumnKey is the normalised host, address, number or SIREN the entry // is looked up by. ColumnKey = "key" // ColumnPath is the path and query of a site entry that targets one // page, "" when it targets the whole site or the key is not a site. ColumnPath = "path" // ColumnEntry is the value as the publisher lists it. ColumnEntry = "entry" )
Columns every snapshot row of a listing starts with.
const ( // ColumnCategories are the publisher's categories, separated by // CategorySeparator. ColumnCategories = "categories" // ColumnListedOn is the listing date, AAAA-MM-JJ. ColumnListedOn = "listed_on" )
Columns a blacklist row adds to the common ones, for every blacklist.
const CategorySeparator = "|"
CategorySeparator separates the categories of a blacklist row.
Variables ¶
var ErrSnapshot = errors.New("malformed blacklist snapshot")
ErrSnapshot means a blacklist snapshot departs from the rows the connectors write. Errors locate the row, never quote a value: it may hold an address.
Functions ¶
func BlacklistColumns ¶ added in v0.25.0
func BlacklistColumns() []string
BlacklistColumns returns the columns of every blacklist snapshot.
func CheckBlacklist ¶ added in v0.56.1
CheckBlacklist reports why the rows of snap would not index as a blacklist, for domain.SnapshotSpec.Rows: sync and restore then refuse a snapshot the Reader would fail on.
func WhitelistOf ¶ added in v0.26.0
func WhitelistOf(snap domain.Snapshot, header []string, decode func(row []string) (domain.Authorisation, error), platforms domain.Platforms) (*domain.Whitelist, error)
WhitelistOf indexes the rows of snap, whose header must be header, each under the authorisation decode reads from it. A site entry with a path lists its whole site when the page stands for it (PageStandsForSite with platforms): a white list gives the provider's own site, often at its home page in French ("/fr/"). Any other page entry is left out, as a checked domain has no path: a page on a shared platform (linktr.ee/x, sites.google.com/view/x) must not cover the whole platform.
Types ¶
type Key ¶
type Key struct {
Kind string // a domain.Kind name: "domain", "email", "phone" or "siren"
Value string // normalised by the domain value object
Path string // path and query of a site entry that targets one page
Entry string // the value as the publisher lists it
}
Key is what an entry is looked up by: the first four columns of every snapshot row.
func Classify ¶
Classify reads one entry of a blacklist: an address, a site, or a free-text name, which may name a natural person and is not ok.
func Email ¶
Email reads an address. A final dot, as in "prénom.nom@lgt-bp.com.", is a typo of the lists.
type NumberingReader ¶ added in v0.28.0
type NumberingReader struct {
// contains filtered or unexported fields
}
NumberingReader is the app.NumberingReader of a numbering plan. It indexes each snapshot in service once, at the first read after it is swapped in, and is safe for concurrent use.
func NewNumberingReader ¶ added in v0.28.0
func NewNumberingReader(snapshots Snapshots, source domain.Source, build func(domain.Snapshot) (*domain.NumberingPlan, error)) *NumberingReader
NewNumberingReader returns the NumberingReader of the plan of source in snapshots, which build indexes.
func (*NumberingReader) Numbering ¶ added in v0.28.0
func (r *NumberingReader) Numbering() (*domain.NumberingPlan, time.Time, error)
Numbering returns the plan in service and when it was fetched, app.ErrNoSnapshot when none is, or the error of its build.
type Reader ¶ added in v0.25.0
type Reader struct {
// contains filtered or unexported fields
}
Reader is the app.BlacklistReader of one blacklist. It indexes each snapshot in service once, at the first read after it is swapped in, and is safe for concurrent use.
type Snapshots ¶ added in v0.25.0
Snapshots returns the snapshot in service for a source; *app.Sync is one.
type WhitelistReader ¶ added in v0.26.0
type WhitelistReader struct {
// contains filtered or unexported fields
}
WhitelistReader is the app.WhitelistReader of one white list. It indexes each snapshot in service once, at the first read after it is swapped in, and is safe for concurrent use.