capture

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BodyBytes

type BodyBytes []byte

func (BodyBytes) MarshalJSON

func (b BodyBytes) MarshalJSON() ([]byte, error)

func (*BodyBytes) UnmarshalJSON

func (b *BodyBytes) UnmarshalJSON(data []byte) error

type Capture

type Capture struct {
	ID        string            `json:"id"`
	Timestamp time.Time         `json:"timestamp"`
	Protocol  string            `json:"protocol,omitempty"`
	Request   RequestSnapshot   `json:"request"`
	Response  *ResponseSnapshot `json:"response,omitempty"`
	Duration  time.Duration     `json:"duration_ns,omitempty"`
	Error     string            `json:"error,omitempty"`
	WebSocket *WebSocketCapture `json:"websocket,omitempty"`
}

type RequestSnapshot

type RequestSnapshot struct {
	Method  string      `json:"method"`
	URL     string      `json:"url"`
	Headers http.Header `json:"headers"`
	Body    BodyBytes   `json:"body,omitempty"`
}

type ResponseSnapshot

type ResponseSnapshot struct {
	StatusCode int         `json:"status_code"`
	Headers    http.Header `json:"headers"`
	Body       BodyBytes   `json:"body,omitempty"`
}

type Store

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

func NewStore

func NewStore(maxCaptures int, persistDir string) *Store

func (*Store) Add

func (s *Store) Add(c *Capture)

func (*Store) All

func (s *Store) All() []*Capture

func (*Store) AllFromDisk added in v1.2.0

func (s *Store) AllFromDisk() []*Capture

func (*Store) Clear

func (s *Store) Clear(deleteFiles bool)

func (*Store) DeleteByID added in v1.1.0

func (s *Store) DeleteByID(id string) error

func (*Store) Get

func (s *Store) Get(id string) *Capture

func (*Store) GetByPrefix

func (s *Store) GetByPrefix(prefix string) *Capture

func (*Store) List

func (s *Store) List(n int) []*Capture

func (*Store) ListFromDisk

func (s *Store) ListFromDisk(n int) []*Capture

type WSFrame added in v1.7.0

type WSFrame struct {
	Timestamp time.Time `json:"timestamp"`
	Direction string    `json:"direction"`
	Opcode    int       `json:"opcode"`
	Payload   BodyBytes `json:"payload,omitempty"`
}

type WebSocketCapture added in v1.7.0

type WebSocketCapture struct {
	Frames []WSFrame `json:"frames,omitempty"`
}

Jump to

Keyboard shortcuts

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