caps

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: LGPL-2.1, LGPL-2.1-or-later Imports: 7 Imported by: 0

Documentation

Overview

Package caps answers one question about a parsed profile: what does it ask for that this client cannot honour?

It is a static preflight. Inspect never opens a socket, never reads a file and never touches credential material. It classifies the directives the parser recorded on profile.Profile against a registry of what the client is known to do, and reports the result as diag.Gap values.

The registry is deliberately closed. A directive that is not in it classifies as diag.SeverityFatal with an "unrecognised" detail, so a profile using a feature nobody has considered fails loudly during preflight instead of obscurely in the middle of a handshake. Widening the registry is a deliberate act: add the row, and say honestly what the client does today.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter

func Filter(gaps []diag.Gap, min diag.Severity) []diag.Gap

Filter returns the gaps whose severity is min or worse, preserving order. Filter(gaps, diag.SeverityDegraded) is "everything that will not behave as the profile asks".

func Inspect

func Inspect(p *profile.Profile) []diag.Gap

Inspect classifies everything a parsed profile asks for, without touching the network.

It returns one diag.Gap per directive line and per inline block the parser recorded, in file order, including the ones the client honours fully — the severity distinguishes them, and Filter narrows the list to problems. A directive with no registry row yields diag.SeverityFatal, so a profile asking for something nobody has classified fails here rather than obscurely later. An absent directive gets no gap, with one exception: a CBC cipher with no auth directive asks for OpenVPN's SHA1 default, reported on "auth" with an "(implied default)" value.

Gaps carry no hostnames, paths, user names or credential material.

func Known

func Known() []string

Known returns every directive keyword the registry classifies, sorted. It is the row set for the coverage matrix.

func KnownBlocks

func KnownBlocks() []string

KnownBlocks returns every inline block tag the registry classifies, sorted.

func Worst

func Worst(gaps []diag.Gap) diag.Severity

Worst returns the highest severity among gaps, or diag.SeveritySupported when there are none.

Types

type Support

type Support struct {
	// Severity ranks the departure, from SeveritySupported to SeverityFatal.
	Severity diag.Severity
	// Detail is a single line naming what the client actually does.
	Detail string
}

Support is the registry's verdict on one directive: how far the client's behaviour departs from what the directive asks for, and a one-line explanation of what happens instead.

func Lookup

func Lookup(directive string) (Support, bool)

Lookup returns the registry's verdict for a directive keyword, ignoring case. The second result is false when the directive is unrecognised.

The verdict returned is the row's base classification. Some directives — cipher and auth among them — are refined from their arguments and the surrounding profile; Inspect reports the refined result, and this reports what the keyword alone says.

func LookupBlock

func LookupBlock(tag string) (Support, bool)

LookupBlock returns the registry's verdict for an inline block tag such as "tls-auth", ignoring case. The second result is false when the tag is unrecognised.

Jump to

Keyboard shortcuts

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