tooloption

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 3 Imported by: 2 modules, 1 package

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 tooloption is the shared vocabulary of tool execution options: the few knobs almost every scan tool has (per-request timeout, request rate, concurrency, retries), defined once so that every tool, the sensor SDK and the platform mean the same thing by each name.

A tool declares its options in the configuration schema of its tool manifest (tool.yaml "config", the closed JSON Schema subset of the settings contract). A property that is one of the common options says so with "x-octm-common": "<name>"; its type must be the common option's type and its bounds must lie inside the common bounds (CheckProperty). Every other property is specific to the tool.

Narrowing. Settings are layered: platform defaults, tenant policy, the sensor's configuration, the scan or workflow step, and the platform's decision for one job. For an option that narrows down (rate, concurrency, retries), a layer closer to the job may only lower the value an earlier layer set, never raise it (NarrowValue). The sensor's local policy can lower it again. Timeout does not narrow: a scan may wait longer for a slow target, within the common bounds and the task's own budget.

Reserved names. How a tool's traffic leaves the sensor (proxy) and how its requests identify themselves (user agent, extra headers) are set by the platform's egress and HTTP policy, never by a tool option, so a tool may not declare a property with one of these names (Reserved).

The package is part of the CTIS contract (standard library only): the platform and the sensor SDK both import it, so neither depends on the other for what an option means.

Index

Constants

View Source
const (
	// NarrowNone: any layer may set any value within the bounds.
	NarrowNone = ""
	// NarrowDown: a later layer may only lower the value an earlier layer
	// set.
	NarrowDown = "down"
)

Narrowing directions.

View Source
const (
	UnitSeconds   = "seconds"
	UnitPerSecond = "per_second"
	UnitCount     = "count"
)

Units of an option's value.

Variables

This section is empty.

Functions

func Reserved

func Reserved(name string) (string, bool)

Reserved reports whether name may not be a tool option, and why.

Types

type Option

type Option struct {
	// Name is the property name a tool uses ("rate").
	Name string `json:"name"`
	// Type is the JSON Schema type of the value; every common option is an
	// integer.
	Type string `json:"type"`
	// Unit of the value.
	Unit string `json:"unit"`
	// Minimum and Maximum bound the value (inclusive). A tool may only
	// narrow them.
	Minimum int64 `json:"minimum"`
	Maximum int64 `json:"maximum"`
	// Narrow is NarrowNone or NarrowDown.
	Narrow string `json:"narrow,omitempty"`
	// Title and Description are the English text; user interfaces look up
	// their own translation by name.
	Title       string `json:"title"`
	Description string `json:"description"`
}

Option is one common option.

func All

func All() []Option

All returns the common options, sorted by name.

func Lookup

func Lookup(name string) (Option, bool)

Lookup returns the common option named name.

func (Option) CheckProperty

func (o Option) CheckProperty(typ string, minimum, maximum *float64) error

CheckProperty checks that a tool's property declared as this option is compatible with it: the same type, and bounds (when given) inside the common bounds. A property without bounds takes the common ones.

func (Option) InBounds

func (o Option) InBounds(v float64) bool

InBounds reports whether v is a whole number inside the common bounds.

func (Option) NarrowValue

func (o Option) NarrowValue(earlier, later float64) (value float64, ok bool)

NarrowValue returns the value a later layer's value comes to, given the value an earlier layer set: for an option that narrows down, the lower of the two; otherwise the later value. ok is false when the later value had to be lowered (callers that validate refuse it; callers that run clamp to the returned value).

Jump to

Keyboard shortcuts

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