writer

package
v0.0.0-...-c4aabd3 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithProofOfConceptEnabled

func WithProofOfConceptEnabled(enabled bool) func(WithOptions)

WithProofOfConceptEnabled is a [ConsoleOption] that enables the proof-of-concept mode. When enabled, the console will print the matches in a copy & paste friendlier format.

Types

type Console

type Console struct {
	// contains filtered or unexported fields
}

Console is a gbounty.Writer implementation that writes the output to the given io.Writer, following console/terminal standards in a human-friendly fashion.

func NewConsole

func NewConsole(writer io.Writer, opts ...Option) *Console

NewConsole creates a new instance of Console with the given io.Writer.

func (*Console) SetProofOfConcept

func (c *Console) SetProofOfConcept(enabled bool)

func (*Console) WriteConfig

func (c *Console) WriteConfig(_ context.Context, cfg gbounty.Config) error

WriteConfig writes the gbounty.Config to the console.

func (*Console) WriteError

func (c *Console) WriteError(_ context.Context, scanError gbounty.Error) error

WriteError writes the gbounty.Error to the console.

func (*Console) WriteErrors

func (c *Console) WriteErrors(ctx context.Context, fs gbounty.FileSystem) error

WriteErrors writes the gbounty.Error instances to the console.

func (*Console) WriteMatch

func (c *Console) WriteMatch(_ context.Context, m gbounty.Match, _ bool) error

WriteMatch writes the gbounty.Match to the console.

func (*Console) WriteMatches

func (c *Console) WriteMatches(ctx context.Context, fs gbounty.FileSystem, _ bool) error

WriteMatches writes the gbounty.Match instances found during the scan, to the console.

func (*Console) WriteMatchesSummary

func (c *Console) WriteMatchesSummary(ctx context.Context, fs gbounty.FileSystem) error

WriteMatchesSummary writes a summary of the gbounty.Match instances found during the scan, to the console.

func (*Console) WriteStats

func (c *Console) WriteStats(ctx context.Context, fs gbounty.FileSystem) error

WriteStats writes the gbounty.Stats to the console.

func (*Console) WriteTasks

func (c *Console) WriteTasks(ctx context.Context, fs gbounty.FileSystem, allRequests, allResponses bool) error

WriteTasks writes the gbounty.TaskSummary instances to the console.

type JSON

type JSON struct {
	// contains filtered or unexported fields
}

JSON is a gbounty.Writer implementation that writes the output to the given io.Writer, in a machine-readable format (JSON).

func NewJSON

func NewJSON(writer io.Writer) JSON

NewJSON creates a new instance of JSON with the given io.Writer.

func (JSON) WriteConfig

func (j JSON) WriteConfig(_ context.Context, cfg gbounty.Config) error

WriteConfig writes the gbounty.Config to the io.Writer as a JSON object.

func (JSON) WriteError

func (j JSON) WriteError(_ context.Context, scanError gbounty.Error) error

WriteError writes a gbounty.Error to the io.Writer as a JSON object.

func (JSON) WriteErrors

func (j JSON) WriteErrors(ctx context.Context, fs gbounty.FileSystem) error

WriteErrors writes the gbounty.Error instances to the io.Writer as a JSON array of JSON objects.

func (JSON) WriteMatch

func (j JSON) WriteMatch(_ context.Context, m gbounty.Match, includeResponse bool) error

WriteMatch writes a gbounty.Match to the io.Writer as a JSON object.

func (JSON) WriteMatches

func (j JSON) WriteMatches(ctx context.Context, fs gbounty.FileSystem, includeResponses bool) error

WriteMatches writes the gbounty.Match instances found during the [scan], as a JSON array of JSON objects.

func (JSON) WriteMatchesSummary

func (j JSON) WriteMatchesSummary(ctx context.Context, fs gbounty.FileSystem) error

WriteMatchesSummary writes a summary of the gbounty.Match instances found during the [scan], to the io.Writer as a JSON array of JSON objects.

func (JSON) WriteStats

func (j JSON) WriteStats(ctx context.Context, fs gbounty.FileSystem) error

WriteStats writes the gbounty.Stats to the io.Writer as a JSON object.

func (JSON) WriteTasks

func (j JSON) WriteTasks(ctx context.Context, fs gbounty.FileSystem, allRequests, allResponses bool) error

WriteTasks writes the gbounty.TaskSummary instances to the io.Writer as a JSON array of JSON objects.

type Markdown

type Markdown struct {
	// contains filtered or unexported fields
}

Markdown is a gbounty.Writer implementation that writes the output to the given io.Writer, in a styled human-readable format (Markdown).

func NewMarkdown

func NewMarkdown(writer io.Writer) Markdown

NewMarkdown creates a new instance of Markdown with the given io.Writer.

func (Markdown) WriteConfig

func (md Markdown) WriteConfig(_ context.Context, cfg gbounty.Config) error

WriteConfig writes the gbounty.Config to the io.Writer in the Markdown format.

func (Markdown) WriteError

func (md Markdown) WriteError(_ context.Context, scanError gbounty.Error) error

WriteError writes a gbounty.Error to the io.Writer in the Markdown format.

func (Markdown) WriteErrors

func (md Markdown) WriteErrors(ctx context.Context, fs gbounty.FileSystem) error

WriteErrors writes the gbounty.Error instances to the io.Writer in the Markdown format.

func (Markdown) WriteMatch

func (md Markdown) WriteMatch(_ context.Context, m gbounty.Match, includeResponse bool) error

WriteMatch writes a gbounty.Match to the io.Writer in the Markdown format.

func (Markdown) WriteMatches

func (md Markdown) WriteMatches(ctx context.Context, fs gbounty.FileSystem, includeResponses bool) error

WriteMatches writes the gbounty.Match instances found during the [scan], in the Markdown format.

func (Markdown) WriteMatchesSummary

func (md Markdown) WriteMatchesSummary(ctx context.Context, fs gbounty.FileSystem) error

WriteMatchesSummary writes a summary of the gbounty.Match instances found during the [scan], to the io.Writer in the Markdown format.

func (Markdown) WriteStats

func (md Markdown) WriteStats(ctx context.Context, fs gbounty.FileSystem) error

WriteStats writes the gbounty.Stats to the io.Writer in the Markdown format.

func (Markdown) WriteTasks

func (md Markdown) WriteTasks(ctx context.Context, fs gbounty.FileSystem, allRequests, allResponses bool) error

WriteTasks writes the gbounty.TaskSummary instances to the io.Writer in the Markdown format.

type Option

type Option func(WithOptions)

Option is a function that can be used to configure a WithOptions implementation.

type Plain

type Plain struct {
	// contains filtered or unexported fields
}

Plain is a gbounty.Writer implementation that writes the output to the given io.Writer, as plain text. The format is quite similar to Console but without colors.

func NewPlain

func NewPlain(writer io.Writer, opts ...Option) *Plain

NewPlain creates a new instance of Plain with the given io.Writer.

func (*Plain) SetProofOfConcept

func (p *Plain) SetProofOfConcept(enabled bool)

func (*Plain) WriteConfig

func (p *Plain) WriteConfig(_ context.Context, cfg gbounty.Config) error

WriteConfig writes the gbounty.Config to the io.Writer as plain text.

func (*Plain) WriteError

func (p *Plain) WriteError(_ context.Context, scanError gbounty.Error) error

WriteError writes a gbounty.Error to the io.Writer as plain text.

func (*Plain) WriteErrors

func (p *Plain) WriteErrors(ctx context.Context, fs gbounty.FileSystem) error

WriteErrors writes the gbounty.Error instances to the io.Writer as plain text.

func (*Plain) WriteMatch

func (p *Plain) WriteMatch(_ context.Context, m gbounty.Match, includeResponse bool) error

WriteMatch writes a gbounty.Match to the io.Writer as plain text.

func (*Plain) WriteMatches

func (p *Plain) WriteMatches(ctx context.Context, fs gbounty.FileSystem, includeResponses bool) error

WriteMatches writes the gbounty.Match instances found during the [scan], as plain text.

func (*Plain) WriteMatchesSummary

func (p *Plain) WriteMatchesSummary(ctx context.Context, fs gbounty.FileSystem) error

WriteMatchesSummary writes a summary of the gbounty.Match instances found during the [scan], to the io.Writer as plain text.

func (*Plain) WriteStats

func (p *Plain) WriteStats(ctx context.Context, fs gbounty.FileSystem) error

WriteStats writes the gbounty.Stats to the io.Writer as plain text.

func (*Plain) WriteTasks

func (p *Plain) WriteTasks(ctx context.Context, fs gbounty.FileSystem, allRequests, allResponses bool) error

WriteTasks writes the gbounty.TaskSummary instances to the io.Writer as plain text.

type WithOptions

type WithOptions interface {
	WithProofOfConcept
}

WithOptions is an interface that defines the expected behavior for gbounty.Writer implementations on this package that can be configured with Option. It's mostly a composition of all the concrete interfaces.

type WithProofOfConcept

type WithProofOfConcept interface {
	SetProofOfConcept(enabled bool)
}

WithProofOfConcept is an interface that defines the expected behavior for gbounty.Writer implementations on this package that can be configured with WithProofOfConceptEnabled.

Jump to

Keyboard shortcuts

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