Documentation
¶
Overview ¶
Package comparison normalises payloads with scripts, then diffs or hashes them.
Index ¶
- type Config
- type Hash
- type Scripts
- func (s *Scripts) Compare(ctx context.Context, typeName Option[schema.TypeRef], reference, candidate any) (differences []string, err error)
- func (s *Scripts) Endpoints() []javascript.Endpoint
- func (s *Scripts) Hash(ctx context.Context, identity string, typeName Option[schema.TypeRef], ...) (Hash, error)
- func (s *Scripts) Schema() *schema.Schema
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// ScriptsDir holds the normaliser scripts, which are all loaded as one set.
ScriptsDir string `` /* 165-byte string literal not displayed */
// Schema types every payload the scripts register for.
Schema schema.Config `embed:""`
// ComparisonTimeout limits one response comparison.
ComparisonTimeout time.Duration `default:"1s" help:"Maximum duration of one response comparison."`
}
Config contains the command-line configuration for scripts and comparison.
type Hash ¶ added in v0.25.0
Hash identifies a payload by its identity and normalised content, so equivalent payloads share a hash.
type Scripts ¶ added in v0.25.0
type Scripts struct {
// contains filtered or unexported fields
}
Scripts is one immutable set of normaliser scripts and the schema they were checked against. It is safe for concurrent use.
func New ¶
New loads every script in the configured directory and checks that each declared endpoint type exists.
func (*Scripts) Compare ¶ added in v0.25.0
func (s *Scripts) Compare(ctx context.Context, typeName Option[schema.TypeRef], reference, candidate any) (differences []string, err error)
Compare normalises both payloads as typeName and returns the paths at which they differ. Untyped payloads are compared without normalisers.
func (*Scripts) Endpoints ¶ added in v0.25.0
func (s *Scripts) Endpoints() []javascript.Endpoint
Endpoints returns every declared endpoint, ingress first, in declaration order.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package javascript evaluates Spectre payload normaliser scripts.
|
Package javascript evaluates Spectre payload normaliser scripts. |