pack

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 19 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 pack loads product packs (folders of journeys, stresses and targets for one kind of product), detects which pack fits a target, and installs a pack's files into a project.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Detect

type Detect struct {
	Paths       []string          `yaml:"paths"`
	OpenAPITags []string          `yaml:"openapiTags"`
	HTMLMeta    []string          `yaml:"htmlMeta"`
	Headers     map[string]string `yaml:"headers"`
}

Detect lists evidence that a target is this kind of product.

type Entry

type Entry struct {
	Name      string   `yaml:"name" json:"name"`
	Title     string   `yaml:"title" json:"title"`
	Status    string   `yaml:"status" json:"status"`
	Signature string   `yaml:"signature" json:"signature"`
	Drivers   []string `yaml:"drivers" json:"drivers"`
}

Entry is one line of the catalogue.

func Catalog

func Catalog() ([]Entry, error)

Catalog reads the built-in catalogue.

type Evidence

type Evidence struct {
	OpenAPI bool
	// OIDC is set when the target publishes OpenID Connect discovery.
	OIDC        bool
	Paths       []string
	OpenAPITags []string
	HTML        string
	Headers     http.Header
}

Evidence is what detection found about a target.

func Probe

func Probe(ctx context.Context, base *url.URL, hc *http.Client) (*Evidence, error)

Probe gathers evidence about a target: its OpenAPI document if it publishes one at a common path, response headers and the home page.

type JourneyResult

type JourneyResult struct {
	File    string
	Journey string
	OK      bool
	// Problem describes the first failure.
	Problem string
}

JourneyResult is the outcome of running one journey once.

func DryRun

func DryRun(ctx context.Context, file string, s *scenario.Scenario, env map[string]string, allow func(*url.URL) bool) ([]JourneyResult, error)

DryRun runs every journey in a scenario exactly once with one user and reports which ones work end to end against the target.

type Match

type Match struct {
	Pack    *Pack
	Score   int
	Reasons []string
}

Match is a pack's detection score.

func Score

func Score(ev *Evidence, ps []*Pack) []Match

Score ranks packs against the evidence, best first.

type Pack

type Pack struct {
	Name         string   `yaml:"name"`
	Title        string   `yaml:"title"`
	Description  string   `yaml:"description"`
	Status       string   `yaml:"status"`
	Protocols    []string `yaml:"protocols"`
	ReferenceApp string   `yaml:"referenceApp"`
	Detect       Detect   `yaml:"detect"`
	Variables    map[string]struct {
		Description string `yaml:"description"`
	} `yaml:"variables"`
	// contains filtered or unexported fields
}

Pack is a pack's manifest.

func Load

func Load(nameOrDir string) (*Pack, error)

Load reads a built-in pack by name, or a pack directory on disk.

func Shipped

func Shipped() ([]*Pack, error)

Shipped loads every shipped built-in pack.

func (*Pack) Files

func (p *Pack) Files() ([]string, error)

Files lists the pack's scenario files (journeys and stresses), relative to the pack root.

func (*Pack) Install

func (p *Pack) Install(dir string, force bool) ([]string, error)

Install copies the pack into dir/<pack name>, keeping its layout so relative data paths keep working. Existing files are not overwritten unless force is set. It returns the files written.

func (*Pack) ReadFile

func (p *Pack) ReadFile(rel string) ([]byte, error)

ReadFile reads a file from the pack.

Jump to

Keyboard shortcuts

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