capture

package
v2.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 12 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"`
	TLS       *TLSInfo          `json:"tls,omitempty"`
	WebSocket *WebSocketCapture `json:"websocket,omitempty"`
	GRPC      *GRPCCapture      `json:"grpc,omitempty"`
	SSE       *SSECapture       `json:"sse,omitempty"`
	GraphQL   *GraphQLCapture   `json:"graphql,omitempty"`
}

type GRPCCapture

type GRPCCapture struct {
	ServiceMethod   string          `json:"method,omitempty"`
	Frames          []GRPCFrame     `json:"frames,omitempty"`
	DecodedRequest  json.RawMessage `json:"decoded_request,omitempty"`
	DecodedResponse json.RawMessage `json:"decoded_response,omitempty"`
}

type GRPCFrame

type GRPCFrame struct {
	Direction  string    `json:"direction"`
	Compressed bool      `json:"compressed,omitempty"`
	Data       BodyBytes `json:"data"`
}

type GraphQLCapture added in v2.1.0

type GraphQLCapture struct {
	OperationName string          `json:"operation_name,omitempty"`
	OperationType string          `json:"operation_type,omitempty"`
	Variables     json.RawMessage `json:"variables,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 SSECapture added in v2.1.0

type SSECapture struct {
	Frames []SSEFrame `json:"frames,omitempty"`
}

type SSEFrame added in v2.1.0

type SSEFrame struct {
	Timestamp time.Time `json:"timestamp"`
	ID        string    `json:"id,omitempty"`
	Event     string    `json:"event,omitempty"`
	Data      string    `json:"data"`
}

type Store

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

func NewSQLiteStore added in v2.6.0

func NewSQLiteStore(maxCaptures int, dbPath string) (*Store, error)

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

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

func (*Store) Clear

func (s *Store) Clear(deleteFiles bool)

func (*Store) Count added in v2.6.0

func (s *Store) Count() int

func (*Store) DeleteByID

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

func (*Store) ListPage added in v2.6.0

func (s *Store) ListPage(pageSize, offset int) []*Capture

type TLSInfo added in v2.5.0

type TLSInfo struct {
	Version string    `json:"version"`
	Cipher  string    `json:"cipher"`
	Subject string    `json:"subject,omitempty"`
	SANs    []string  `json:"sans,omitempty"`
	Expiry  time.Time `json:"expiry,omitempty"`
}

type WSFrame

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

type WebSocketCapture

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