brand

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2026 License: AGPL-3.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const (
	EnvVar      = "VULNETIX_BRAND"
	AliasEnvVar = "VULNESIS_BRAND"
)

EnvVar selects the brand; AliasEnvVar is read when EnvVar is unset or empty.

View Source
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 Host

func Host(h string) string

Host maps a hostname, optionally with a port, for the current brand.

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.

func Text

func Text(s string) string

Text maps every http(s) URL in free text for the current brand.

func URL

func URL(raw string) string

URL maps the host of an absolute URL for the current brand.

Types

type Brand

type Brand int

Brand is one of the brands the CLI can speak for.

const (
	// Vulnetix is vulnetix.com (retired; opt in with VULNETIX_BRAND=vulnetix).
	Vulnetix Brand = iota
	// Vulnesis is vulnes.is.
	Vulnesis
)

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 FromEnv

func FromEnv() Brand

FromEnv is the brand the environment selects, read now.

func Parse

func Parse(s string) (b Brand, ok bool)

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) Domain

func (b Brand) Domain() string

Domain is the brand's apex domain.

func (Brand) Host

func (b Brand) Host(h string) string

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) Name

func (b Brand) Name() string

Name is the display name: "Vulnetix" or "Vulnesis".

func (Brand) String

func (b Brand) String() string

String is the lower-case name VULNETIX_BRAND takes.

func (Brand) Text

func (b Brand) Text(s string) string

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.

func (Brand) URL

func (b Brand) URL(raw string) string

URL maps the host of an absolute (or scheme-relative) URL for b. Scheme, userinfo, port, path, query and fragment are kept byte for byte; only the host changes, and only when it is vulnetix.com or below it. Anything that is not such a URL is returned unchanged.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL