deviations

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: BSD-3-Clause Imports: 6 Imported by: 0 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 deviations reads `testdata/deviations.json`, the register of accepted differences from a FoxIO value.

The register is data of this repository rather than of this library, and two test packages read it: `ja4plus` runs the conformance comparison, and `internal/repocheck` holds the register schema and the changelog counts. A test helper lives in a `_test.go` file, and no package imports another package's test files, so the reader lives here.

The reader stays out of the exported surface of the library. `v1.0.0` freezes that surface, and the register serves the test suite alone.

FR-reference-19 through FR-reference-24, FR-reference-27, FR-reference-28 and FR-reference-31 state the rules this package holds.

Index

Constants

View Source
const RegisterFile = "testdata/deviations.json"

RegisterFile is the path of the register, relative to the repository root.

Variables

View Source
var CaptureSuffixes = []string{".pcap", ".pcapng"}

CaptureSuffixes names the two capture formats the Terms table defines.

View Source
var FieldNames = []string{"key", "capability", "ours", "theirs", "ruling", "reason"}

FieldNames names every field that FR-reference-20 requires.

View Source
var RulingPattern = regexp.MustCompile(`^#[1-9][0-9]*$`)

RulingPattern is the form of a `ruling` value. FR-reference-23 requires the value to name the issue that holds the ruling, and this project names an issue as `#` and a number.

Functions

func CheckKey

func CheckKey(key string) error

CheckKey returns an error when the key does not name the capture, the stream and the method. FR-reference-21 states the three parts, and the port writes them in that order, for example `gre-erspan-vxlan.pcap/0:65174/JA4T.1`.

func CheckReason

func CheckReason(reason string) error

CheckReason returns an error when the reason is not one sentence. FR-reference-24 allows one sentence, so the value ends with a full stop and holds no full stop that a space follows.

The check reads a full stop and a space as a sentence break, so it also declines an abbreviation such as `e.g. `. A register reason states one fact about one comparison, and `.claude/rules/ste.md` rule 10 keeps an undefined abbreviation out of it.

func ContainsField

func ContainsField(name string) bool

ContainsField reports whether the name is a register field.

Types

type Entry

type Entry struct {
	// Key names the capture, the stream and the method.
	Key string
	// Capability is true for a capability decline and false for a value decline.
	Capability bool
	// Ours is the value this library produces.
	Ours string
	// Theirs is the value the reference produces.
	Theirs string
	// Ruling names the issue that holds the ruling.
	Ruling string
	// Reason holds one sentence.
	Reason string
}

Entry is one accepted difference from a FoxIO value.

func Load

func Load() ([]Entry, error)

Load returns the parsed register. It returns an error when the file is absent or when it does not parse. The caller runs from the repository root.

func Parse

func Parse(content []byte) ([]Entry, error)

Parse returns one entry for each element of the register content. It returns an error in five cases.

  • The content is not a JSON array of objects.
  • An entry omits a field.
  • An entry holds a field this project does not define.
  • A field value has the wrong form.
  • Two entries hold one key.

Jump to

Keyboard shortcuts

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