Documentation
¶
Index ¶
- Constants
- func DefaultAddresses() (netip.Addr, netip.Addr)
- func InternalAddresses() (netip.Addr, netip.Addr)
- type Anonymizer
- func (a *Anonymizer) AnonymizeDNSLogLine(logEntry string) string
- func (a *Anonymizer) AnonymizeDomain(domain string) string
- func (a *Anonymizer) AnonymizeIP(ip netip.Addr) netip.Addr
- func (a *Anonymizer) AnonymizeIPString(ip string) string
- func (a *Anonymizer) AnonymizeMAC(mac string) string
- func (a *Anonymizer) AnonymizeRoute(route string) string
- func (a *Anonymizer) AnonymizeSchemeURI(text string) string
- func (a *Anonymizer) AnonymizeString(str string) string
- func (a *Anonymizer) AnonymizeUDPAddr(addr net.UDPAddr) net.UDPAddr
- func (a *Anonymizer) AnonymizeURI(uri string) string
- func (a *Anonymizer) AnonymizeWGKey(key string) string
- func (a *Anonymizer) SetLevel(level Level)
- type Level
Constants ¶
const ( LevelDefaultString = "default" LevelStrictString = "strict" )
LevelDefaultString and LevelStrictString are the wire forms of the levels, for boundaries that pass levels as strings (flags, protos, mobile bindings).
Variables ¶
This section is empty.
Functions ¶
func InternalAddresses ¶ added in v0.77.0
InternalAddresses returns the pool starts used in strict mode for internal ranges. Both are reserved ranges that cannot collide with real addressing: 198.18.0.0 (RFC 2544 benchmarking), 2001:db8:1:: (RFC 3849 documentation).
Types ¶
type Anonymizer ¶
type Anonymizer struct {
// contains filtered or unexported fields
}
func NewAnonymizer ¶
func NewAnonymizer(startIPv4, startIPv6 netip.Addr) *Anonymizer
func (*Anonymizer) AnonymizeDNSLogLine ¶
func (a *Anonymizer) AnonymizeDNSLogLine(logEntry string) string
func (*Anonymizer) AnonymizeDomain ¶
func (a *Anonymizer) AnonymizeDomain(domain string) string
func (*Anonymizer) AnonymizeIP ¶
func (a *Anonymizer) AnonymizeIP(ip netip.Addr) netip.Addr
func (*Anonymizer) AnonymizeIPString ¶
func (a *Anonymizer) AnonymizeIPString(ip string) string
func (*Anonymizer) AnonymizeMAC ¶ added in v0.77.0
func (a *Anonymizer) AnonymizeMAC(mac string) string
AnonymizeMAC replaces a MAC address with a consistent placeholder from the locally administered range starting at 02:00:00:00:00:01, at every anonymization level. Broadcast, multicast, all-zero, and already assigned placeholder addresses are preserved. The colon and dash spellings of the same address share one placeholder; the output keeps the input's separator.
func (*Anonymizer) AnonymizeRoute ¶ added in v0.28.7
func (a *Anonymizer) AnonymizeRoute(route string) string
AnonymizeRoute anonymizes a route string by replacing IP addresses with anonymized versions and domain names with random strings.
func (*Anonymizer) AnonymizeSchemeURI ¶
func (a *Anonymizer) AnonymizeSchemeURI(text string) string
AnonymizeSchemeURI finds and anonymizes URIs with ws, wss, rel, rels, stun, stuns, turn, and turns schemes.
func (*Anonymizer) AnonymizeString ¶
func (a *Anonymizer) AnonymizeString(str string) string
func (*Anonymizer) AnonymizeUDPAddr ¶ added in v0.46.0
func (a *Anonymizer) AnonymizeUDPAddr(addr net.UDPAddr) net.UDPAddr
func (*Anonymizer) AnonymizeURI ¶
func (a *Anonymizer) AnonymizeURI(uri string) string
func (*Anonymizer) AnonymizeWGKey ¶ added in v0.77.0
func (a *Anonymizer) AnonymizeWGKey(key string) string
AnonymizeWGKey replaces a WireGuard public key with a consistent random placeholder of the same shape. Keys are only anonymized at LevelStrict; placeholders already handed out pass through unchanged.
func (*Anonymizer) SetLevel ¶ added in v0.77.0
func (a *Anonymizer) SetLevel(level Level)
SetLevel selects the anonymization level. The zero value of a new Anonymizer is LevelDefault.
type Level ¶ added in v0.77.0
type Level int
Level selects how much the anonymizer redacts. Levels are ordered: a higher level redacts strictly more. On the wire (protos, flags) levels travel as their string form.
const ( // LevelDefault anonymizes public IP addresses, IPv6 ULA, domains, and MAC // addresses. Internal IPv4 ranges (RFC 1918, CGNAT, link-local) are // preserved so support can reason about the real topology. LevelDefault Level = iota // LevelStrict additionally anonymizes internal IP ranges, peer names, and // WireGuard public keys. LevelStrict )
func ParseLevel ¶ added in v0.77.0
ParseLevel maps s to a Level. Empty means LevelDefault; anything unrecognized maps to LevelStrict so an unknown request never yields less anonymization than intended.