wiretap

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package wiretap manages the optional pb33f/wiretap sidecar process.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToDiagnostics

func ToDiagnostics(findings []WiretapFinding, idx *openapi.Index, uri string) []protocol.Diagnostic

ToDiagnostics converts wiretap findings into LSP diagnostics.

Types

type Sidecar

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

Sidecar is a managed wiretap subprocess.

func Start

func Start(ctx context.Context, opts SidecarOpts) (*Sidecar, error)

Start launches wiretap as a subprocess. Call WaitReady before using ProxyURL.

func (*Sidecar) CollectReport

func (s *Sidecar) CollectReport() ([]WiretapFinding, error)

CollectReport reads the wiretap JSONL report file and returns normalized findings.

func (*Sidecar) MonitorURL

func (s *Sidecar) MonitorURL() string

MonitorURL returns the monitor UI URL.

func (*Sidecar) ProxyURL

func (s *Sidecar) ProxyURL() string

ProxyURL returns the proxy endpoint clients should use.

func (*Sidecar) Stop

func (s *Sidecar) Stop() error

Stop terminates the wiretap process and cleans up the report file.

func (*Sidecar) WaitReady

func (s *Sidecar) WaitReady(ctx context.Context) error

WaitReady blocks until the proxy port starts accepting connections.

type SidecarOpts

type SidecarOpts struct {
	BinaryPath  string
	SpecPath    string
	UpstreamURL string
	ProxyPort   int
	MonitorPort int
	ExtraArgs   []string
	Logger      *slog.Logger
}

SidecarOpts configures a wiretap subprocess.

type WiretapFinding

type WiretapFinding struct {
	Method            string `json:"method,omitempty"`
	Path              string `json:"path,omitempty"`
	StatusCode        int    `json:"statusCode,omitempty"`
	Direction         string `json:"direction,omitempty"`
	Message           string `json:"message,omitempty"`
	RuleID            string `json:"ruleId,omitempty"`
	Severity          string `json:"severity,omitempty"`
	SpecName          string `json:"specName,omitempty"`
	ValidationType    string `json:"validationType,omitempty"`
	ValidationSubType string `json:"validationSubType,omitempty"`
	FieldPath         string `json:"fieldPath,omitempty"`
	HowToFix          string `json:"howToFix,omitempty"`
	SpecLine          int    `json:"specLine,omitempty"`
	SpecColumn        int    `json:"specColumn,omitempty"`
}

WiretapFinding is the normalized Telescope-side view of one wiretap validation finding.

Jump to

Keyboard shortcuts

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