Documentation
¶
Overview ¶
Package brand selects which brand the CLI speaks for: Vulnesis (vulnes.is, the default) or Vulnetix (vulnetix.com, retired).
The brand is chosen at run time by the VULNETIX_BRAND environment variable (VULNESIS_BRAND is an alias): "vulnetix" or "vulnesis", in any case. Anything else, or nothing, is Vulnesis: the vulnetix.com hosts are retired (they redirect, and a redirect drops credentials), so Vulnetix is opt-in.
Code that builds or shows a vulnetix.com endpoint or link passes it through URL (or Host for a bare hostname). Under Vulnetix both are the identity. Under Vulnesis a vulnetix.com host maps onto vulnes.is:
vulnetix.com -> vulnes.is www.vulnetix.com -> www.vulnes.is api.vdb.vulnetix.com -> api-vdb.vulnes.is
No other host changes, and nothing but the host changes.
Index ¶
Constants ¶
const ( EnvVar = "VULNETIX_BRAND" AliasEnvVar = "VULNESIS_BRAND" )
EnvVar selects the brand; AliasEnvVar is read when EnvVar is unset or empty.
const Program = "vulnesis"
Program is the name of the CLI binary and its root command, whatever the brand. Stored identifiers (VULNETIX_* variables, .vulnetix/ paths, the vulnetix.com/v1 apiVersion) keep their names.
Variables ¶
This section is empty.
Functions ¶
func Reset ¶
func Reset()
Reset forgets the brand, so the next Current reads the environment again. It exists for tests.
func Set ¶
func Set(b Brand)
Set fixes the brand for the rest of the process, overriding the environment.
Types ¶
type Brand ¶
type Brand int
Brand is one of the brands the CLI can speak for.
func Current ¶
func Current() Brand
Current is the brand of this process. The environment is read once, on the first call; Set and Reset change that.
func Parse ¶
Parse reads a brand name, case-insensitively and ignoring surrounding space. ok is false for anything that is not a brand, and b is then Vulnesis.
func (Brand) Host ¶
Host maps a hostname, optionally with a port, for b. Under Vulnetix, and for any host that is not vulnetix.com or below it, h is returned unchanged.
func (Brand) Text ¶
Text maps the host of every http(s) URL in s for b. Bare hostnames and non-URL identifiers (urn:tei:..., apiVersion vulnetix.com/v1) are untouched.