debugger

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

nolint // this is debugger code, not for prod and 100% vibe-coded

nolint // this is debugger code, not for prod and 100% vibe-coded

nolint // this is debugger code, not for prod and 100% vibe-coded

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIResponse

type APIResponse struct {
	Success bool        `json:"success"`
	Data    interface{} `json:"data,omitempty"`
	Error   string      `json:"error,omitempty"`
}

APIResponse represents a standard API response structure

type ParsedRequest

type ParsedRequest struct {
	Metadata    RequestMetadata   `json:"metadata"`
	QueryParams map[string]string `json:"query_params"`
	Headers     map[string]string `json:"headers"`
}

ParsedRequest represents a parsed HTTP request in structured format

type RemoteFetcher

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

RemoteFetcher implements RawLogReader interface for fetching rawlog data from remote HTTP endpoints

func NewRemoteFetcher

func NewRemoteFetcher(baseURL string) *RemoteFetcher

NewRemoteFetcher creates a new RemoteFetcher instance

func (*RemoteFetcher) ClearCache

func (f *RemoteFetcher) ClearCache()

ClearCache clears all cached data

func (*RemoteFetcher) GetContent

func (f *RemoteFetcher) GetContent(itemID string) ([]byte, error)

GetContent implements receiver.RawLogReader interface

func (*RemoteFetcher) ListItems

func (f *RemoteFetcher) ListItems() ([]receiver.RawLogItem, error)

ListItems implements receiver.RawLogReader interface

func (*RemoteFetcher) SetCacheTTL

func (f *RemoteFetcher) SetCacheTTL(itemsTTL, contentTTL time.Duration)

SetCacheTTL allows configuring cache TTL values

type RequestItem

type RequestItem struct {
	ID            string        `json:"id"`             // Unique ID: {rawlogID}_{requestIndex}
	RawlogID      string        `json:"rawlog_id"`      // Original rawlog file ID
	RequestIndex  int           `json:"request_index"`  // Index within the rawlog file (0-based)
	Timestamp     time.Time     `json:"timestamp"`      // Timestamp of the rawlog file
	FormattedTime string        `json:"formatted_time"` // Human-readable timestamp
	Request       ParsedRequest `json:"request"`        // Parsed request data
}

RequestItem represents an individual request within a rawlog file

type RequestMetadata

type RequestMetadata struct {
	Timestamp string `json:"timestamp"`
	Method    string `json:"method"`
	Path      string `json:"path"`
}

RequestMetadata contains metadata about the HTTP request

type RequestParser

type RequestParser struct{}

RequestParser handles parsing of raw HTTP requests from rawlog content

func NewRequestParser

func NewRequestParser() *RequestParser

NewRequestParser creates a new RequestParser instance

func (*RequestParser) ConvertToJSON

func (p *RequestParser) ConvertToJSON(requests []ParsedRequest) ([]byte, error)

ConvertToJSON converts parsed requests to JSON format

func (*RequestParser) ExtractTimestampFromHeaders

func (p *RequestParser) ExtractTimestampFromHeaders(parsed *ParsedRequest)

ExtractTimestampFromHeaders attempts to extract timestamp from request headers or query params

func (*RequestParser) NormalizeHeaders

func (p *RequestParser) NormalizeHeaders(headers map[string]string) map[string]string

NormalizeHeaders applies case normalization to headers (already done in parseHTTPRequest)

func (*RequestParser) ParseAndConvert

func (p *RequestParser) ParseAndConvert(content []byte) ([]byte, error)

ParseAndConvert is a convenience method that parses rawlog content and converts to JSON

func (*RequestParser) ParseRawlogContent

func (p *RequestParser) ParseRawlogContent(content []byte) ([]ParsedRequest, error)

ParseRawlogContent parses raw HTTP request(s) from rawlog content and converts to structured JSON

func (*RequestParser) SetTimestamp

func (p *RequestParser) SetTimestamp(parsed *ParsedRequest, timestamp time.Time)

SetTimestamp updates the timestamp in parsed request metadata

func (*RequestParser) ValidateRequest

func (p *RequestParser) ValidateRequest(parsed ParsedRequest) error

ValidateRequest performs basic validation on a parsed request

type Server

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

Server represents the debugger HTTP server

func NewServer

func NewServer(port int, storageURL string) *Server

NewServer creates a new debugger server instance

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start starts the HTTP server

func (*Server) Stop

func (s *Server) Stop() error

Stop stops the HTTP server

Jump to

Keyboard shortcuts

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