Documentation
¶
Overview ¶
Package masking is Settings → Privacy's masking as the gateway's masker (gwmw.Masker): secrets, personal data and the user's own words go to a vendor as placeholders (internal/redact), and come back as they were. It reads the settings on each call. plugins/redact serves it.
Index ¶
- func Fingerprint(st settings.Settings) string
- func ModelBusy() string
- func ModelOn() bool
- func ModelWanted(st settings.Settings) bool
- func Preview(s string) (out string, hits []gwmw.Hit, off bool)
- func Wanted(st settings.Settings) bool
- func WithForced(ctx context.Context) context.Context
- func WithRoute(ctx context.Context, route string) context.Context
- type Masker
- func (Masker) JSON(body []byte) ([]byte, int)
- func (m Masker) JSONHits(body []byte) ([]byte, []gwmw.Hit)
- func (Masker) JSONHitsContext(ctx context.Context, body []byte) ([]byte, []gwmw.Hit)
- func (Masker) Restore(s string, escaped bool) string
- func (Masker) Text(s string) (string, int)
- func (m Masker) TextHits(s string) (string, []gwmw.Hit)
- func (Masker) TextHitsContext(ctx context.Context, s string) (string, []gwmw.Hit)
- func (Masker) Value(p string) (string, bool)
- func (Masker) Writer(w http.ResponseWriter) (http.ResponseWriter, func())
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fingerprint ¶
Fingerprint names what st has a request masked by: every setting that changes what is masked (the kinds, the user's words and rules, what each kind does, what is let through, the local model and its threshold), as a hash, so two magpies can tell they mask alike without either telling the other its words. "" when st masks nothing.
A magpie that passes a request on to another (a Remote magpie) after masking it says so with this; the other masks it again only when its own fingerprint differs: masked twice by the same settings, the second pass finds nothing the first left, and costs the request another run of the rules and of the local model (YeYaka88 on X). It starts no download.
func ModelBusy ¶ added in v0.1.1566
func ModelBusy() string
ModelBusy says what the local model is doing that a request may wait on, for the error of one that waited too long: "" when nothing.
func ModelOn ¶ added in v0.1.1566
func ModelOn() bool
ModelOn says Settings → Privacy's local model masks requests, as the user turned it on: only then is a request held back for a model that fails, and waited for it strictWait (model's strict).
func ModelWanted ¶ added in v0.1.1858
ModelWanted says st has masking ask the local model: the user turned it on, or left it as it is, on by default. One who had a model downloaded, or picked, with it off before it was on by default had turned it off.
func Preview ¶ added in v0.1.1317
Preview is s as the settings would send it, and what was found in it, with nothing remembered: no placeholder is kept for the replies, and none of its values is masked again later as one seen before. With masking off it is as masking would be turned on (Off says so), so the user can try it first.
func WithForced ¶
WithForced is ctx for masking a request a gateway key holds to masking (access.RedactOn) whatever the settings say: where they mask nothing it is masked for secrets and personal data by the defaults.
Types ¶
type Masker ¶
type Masker struct{}
Masker masks as the settings say, read on each call.
func (Masker) JSONHitsContext ¶ added in v0.1.1566
JSONHitsContext is JSONHits, its wait for the model ending with ctx (gwmw.ContextTeller).
func (Masker) TextHitsContext ¶ added in v0.1.1566
TextHitsContext is TextHits, its wait for the model ending with ctx.
func (Masker) Writer ¶
func (Masker) Writer(w http.ResponseWriter) (http.ResponseWriter, func())