Documentation
¶
Index ¶
- func GenerateHAR(records []*RequestRecord) ([]byte, error)
- type HAR
- type HARContent
- type HARCookie
- type HARCreator
- type HAREntry
- type HARHeader
- type HARLog
- type HARPostData
- type HARQuery
- type HARRequest
- type HARResponse
- type HARTimings
- type RequestRecord
- type StatsSummary
- type Store
- func (s *Store) ClearAll() error
- func (s *Store) Close() error
- func (s *Store) GetRecentFindings(limit int, severity string) ([]*analysis.Finding, error)
- func (s *Store) GetRecentRequests(limit int, query string) ([]*RequestRecord, error)
- func (s *Store) GetRequestByID(id string) (*RequestRecord, error)
- func (s *Store) GetStats() (*StatsSummary, error)
- func (s *Store) PruneOldRecords(keepCount int) error
- func (s *Store) SaveTransaction(event *ringbuffer.TrafficEvent, findings []*analysis.Finding) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateHAR ¶
func GenerateHAR(records []*RequestRecord) ([]byte, error)
GenerateHAR converts stored RequestRecords into a standard HAR 1.2 JSON structure.
Types ¶
type HAR ¶
type HAR struct {
Log HARLog `json:"log"`
}
HAR represents the root HTTP Archive 1.2 container.
type HARContent ¶
type HARCreator ¶
type HAREntry ¶
type HAREntry struct {
StartedDateTime time.Time `json:"startedDateTime"`
Time float64 `json:"time"` // duration in milliseconds
Request HARRequest `json:"request"`
Response HARResponse `json:"response"`
Cache struct{} `json:"cache"`
Timings HARTimings `json:"timings"`
ServerIPAddress string `json:"serverIPAddress,omitempty"`
}
type HARLog ¶
type HARLog struct {
Version string `json:"version"`
Creator HARCreator `json:"creator"`
Entries []HAREntry `json:"entries"`
}
type HARPostData ¶
type HARRequest ¶
type HARRequest struct {
Method string `json:"method"`
URL string `json:"url"`
HTTPVersion string `json:"httpVersion"`
Headers []HARHeader `json:"headers"`
QueryString []HARQuery `json:"queryString"`
Cookies []HARCookie `json:"cookies"`
HeaderSize int `json:"headersSize"`
BodySize int `json:"bodySize"`
PostData *HARPostData `json:"postData,omitempty"`
}
type HARResponse ¶
type HARResponse struct {
Status int `json:"status"`
StatusText string `json:"statusText"`
HTTPVersion string `json:"httpVersion"`
Headers []HARHeader `json:"headers"`
Cookies []HARCookie `json:"cookies"`
Content HARContent `json:"content"`
RedirectURL string `json:"redirectURL"`
HeaderSize int `json:"headersSize"`
BodySize int `json:"bodySize"`
}
type HARTimings ¶
type RequestRecord ¶
type RequestRecord struct {
ID string `json:"id"`
Timestamp time.Time `json:"timestamp"`
DurationMs float64 `json:"duration_ms"`
ClientIP string `json:"client_ip"`
Scheme string `json:"scheme"`
Host string `json:"host"`
Method string `json:"method"`
Path string `json:"path"`
URL string `json:"url"`
Proto string `json:"proto"`
StatusCode int `json:"status_code"`
ReqHeaders map[string][]string `json:"req_headers"`
ReqBody string `json:"req_body"`
RespHeaders map[string][]string `json:"resp_headers"`
RespBody string `json:"resp_body"`
TLS bool `json:"tls"`
FindingCount int `json:"finding_count"`
Findings []*analysis.Finding `json:"findings,omitempty"`
}
RequestRecord represents stored HTTP transaction metadata.
type StatsSummary ¶
type StatsSummary struct {
TotalRequests int64 `json:"total_requests"`
TotalFindings int64 `json:"total_findings"`
SeverityCounts map[string]int64 `json:"severity_counts"`
AvgLatencyMs float64 `json:"avg_latency_ms"`
TotalBytesTrans int64 `json:"total_bytes"`
}
StatsSummary contains high-level metrics for the dashboard.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store provides an ephemeral in-memory SQLite database for captured requests and security findings.
func (*Store) GetRecentFindings ¶
GetRecentFindings returns latest security findings.
func (*Store) GetRecentRequests ¶
func (s *Store) GetRecentRequests(limit int, query string) ([]*RequestRecord, error)
GetRecentRequests retrieves the latest requests up to limit.
func (*Store) GetRequestByID ¶
func (s *Store) GetRequestByID(id string) (*RequestRecord, error)
GetRequestByID retrieves full request and response pair along with any findings.
func (*Store) GetStats ¶
func (s *Store) GetStats() (*StatsSummary, error)
GetStats returns summary metrics for the dashboard.
func (*Store) PruneOldRecords ¶
PruneOldRecords deletes records exceeding keepCount to prevent memory growth in long sessions.
func (*Store) SaveTransaction ¶
func (s *Store) SaveTransaction(event *ringbuffer.TrafficEvent, findings []*analysis.Finding) error
SaveTransaction inserts a request event along with any findings into SQLite.