Expand description
Small, allocation-light helpers for operator-configured URLs: showing them without credentials, and comparing where they point.
A URL such as https://user:token@collector.example/v1/traces carries a
credential in its userinfo. Hosts print URLs in startup lines, errors and
Debug output, so they pass them through redact_userinfo first. The
parsing here is deliberately simple (scheme, authority, rest): it is for
display and same-host checks of http(s) URLs, not a full RFC 3986 parser.
Constants§
- REDACTED_
USERINFO - Replacement shown for a URL’s userinfo.
Functions§
- host
- The host of an
http(s)URL: lowercase, without userinfo, port or IPv6 brackets. - is_
cleartext_ remote - Whether
urlis plainhttp://to a host other than this machine, where credentials would cross the network in clear text. - is_
loopback_ host - Whether
hostnames this machine:localhostor a loopback IP address. - origin
scheme://host:portof anhttp(s)URL, lowercase, with the default port filled in, sohttps://A.exampleandhttps://a.example:443/xcompare equal.- redact_
userinfo urlwith anyuser:password@replaced by***@.