Documentation
¶
Overview ¶
Package accesslog provides local, bounded access history. Its writer accepts typed metadata only; it has no field for request headers, bodies or URLs.
Index ¶
- Constants
- func CoarseRemote(remote string) string
- func PathForMode(p, mode string) string
- func SafePath(p string) string
- func ValidatePathMode(mode string) error
- type AppTraffic
- type AuditResult
- type Count
- type Event
- type Filter
- type Grant
- type GuestDecision
- type HTTPTraffic
- type Health
- type HistoryWindow
- type Identity
- type Lifecycle
- type MCPAudit
- type MCPCapabilities
- type MCPIdentity
- type Options
- type Result
- type Store
- type SubjectAppTraffic
- type Summary
- type TCPTraffic
- type TrafficSummary
- type Writer
Constants ¶
const SchemaVersion = 1
Variables ¶
This section is empty.
Functions ¶
func CoarseRemote ¶
CoarseRemote retains a /24 IPv4 or /48 IPv6 prefix, never a port.
func PathForMode ¶
func SafePath ¶
SafePath is the full-mode sanitizer. Decode before splitting so escaped separators have the same conservative meaning as literal separators. Nested escaping is bounded; malformed or deeply escaped input is redacted entirely.
func ValidatePathMode ¶
Types ¶
type AppTraffic ¶ added in v0.3.0
type AppTraffic struct {
App string `json:"app"`
HTTPTraffic
}
type AuditResult ¶
type Event ¶
type Event struct {
Via string `json:"via,omitempty"`
Surface string `json:"surface,omitempty"`
Changes []mcpaudit.Change `json:"changes,omitempty"`
SchemaVersion int `json:"schema_version"`
Time time.Time `json:"time"`
Kind string `json:"kind"` // http, tcp_open, tcp_close, mcp, guest
App string `json:"app"`
Identity Identity `json:"identity"`
Method string `json:"method,omitempty"`
Path string `json:"path,omitempty"`
Status int `json:"status"`
BytesIn int64 `json:"bytes_in"`
BytesOut int64 `json:"bytes_out"`
DurationMS float64 `json:"duration_ms"`
Decision string `json:"decision"`
Reason string `json:"reason,omitempty"`
ErrorClass string `json:"error_class,omitempty"` // backend failure class; never a URL or address
Grant *Grant `json:"grant,omitempty"`
Connection string `json:"connection,omitempty"`
MCP *MCPAudit `json:"mcp,omitempty"`
Guest *GuestDecision `json:"guest,omitempty"`
PathMode string `json:"-"` // selected per-service policy; not HTTP metadata
}
type Filter ¶
type Filter struct {
// AllowedApps is an authority filter applied before counts and truncation.
// nil is unrestricted; an empty non-nil list authorizes no records.
AllowedApps []string `json:"-"`
App string `json:"app,omitempty"`
Who string `json:"who,omitempty"`
Since *time.Time `json:"since,omitempty"`
Until *time.Time `json:"until,omitempty"`
Decision string `json:"decision,omitempty"`
Limit int `json:"limit,omitempty"`
}
type GuestDecision ¶
type GuestDecision struct {
LinkID string `json:"link_id"`
App string `json:"app"`
Decision string `json:"decision"`
Reason string `json:"reason"`
}
GuestDecision contains the non-secret ledger ID, never the bearer token. Reason must be a stable code rather than request data or a raw error.
type HTTPTraffic ¶ added in v0.3.0
type Health ¶
type Health struct {
Current bool `json:"current"`
MissingHistory []HistoryWindow `json:"missing_history,omitempty"`
Enabled bool `json:"enabled"`
LastWrite *time.Time `json:"last_write"`
Drops uint64 `json:"drops"`
Size int64 `json:"size_bytes"`
Error string `json:"error,omitempty"`
UpdatedAt time.Time `json:"updated_at"`
}
func ReadHealth ¶
ReadHealth is strictly read-only. Missing state is reported explicitly; no directory, lock or permission change is made by CLI/MCP queries.
type HistoryWindow ¶
type Lifecycle ¶
type Lifecycle struct {
// contains filtered or unexported fields
}
Lifecycle is the daemon-owned writer handle retained by existing listeners. Initialization and retry I/O run outside its recording lock. Failed starts count drops and retain the exact missing-history window in runtime state, even when the access-log directory cannot be written.
func (*Lifecycle) RecordResolved ¶
type MCPAudit ¶
type MCPAudit struct {
Identity *MCPIdentity `json:"identity,omitempty"`
Role string `json:"role,omitempty"`
ID string `json:"id"`
Principal string `json:"principal"` // F6 Principal (legacy Who): login, tag or local OS user
Scope string `json:"scope,omitempty"`
Capabilities MCPCapabilities `json:"capabilities"`
ScopeExpiresAt *time.Time `json:"scope_expires_at,omitempty"`
Tool string `json:"tool"`
Apps []string `json:"apps"`
Result AuditResult `json:"result"`
Phase string `json:"phase,omitempty"` // intent/completion; started supports the older F6 journal
}
type MCPCapabilities ¶
type MCPCapabilities struct {
Role string `json:"role"`
Apps []string `json:"apps,omitempty"`
Inventory bool `json:"inventory,omitempty"`
MaxDuration string `json:"max_duration,omitempty"`
}
MCPCapabilities mirrors F6's mcpscope.Scope without importing its authority.
type MCPIdentity ¶
type Options ¶
type Options struct {
Enabled *bool `json:"enabled,omitempty"`
RecordPath *bool `json:"record_path,omitempty"`
PathMode string `json:"path_mode,omitempty"`
RetentionDays int `json:"retention_days,omitempty"`
MaxBytes int64 `json:"max_bytes,omitempty"`
QueueSize int `json:"queue_size,omitempty"`
}
func (Options) ModeFor ¶
Legacy true inherits the safe default; false remains a hard opt-out. A service may opt into full unless global recording is explicitly off.
func (Options) PathsEnabled ¶
type Result ¶
type Result struct {
Events []Event `json:"events"`
Summary Summary `json:"summary"`
Truncated bool `json:"truncated"`
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
type SubjectAppTraffic ¶ added in v0.3.0
type SubjectAppTraffic struct {
SubjectKind string `json:"subject_kind"` // human, tagged, public, unknown
Login string `json:"login,omitempty"`
Subject string `json:"subject,omitempty"` // non-human bucket, never an inferred login
App string `json:"app"`
HTTPTraffic
}
type TCPTraffic ¶ added in v0.3.0
type TCPTraffic struct {
Connections int `json:"connections"` // opens, excluding gateway gate drops
Allowed int `json:"allowed"`
Denied int `json:"denied"`
Closed int `json:"closed"`
BytesIn int64 `json:"bytes_in"` // close events only
BytesOut int64 `json:"bytes_out"`
GateDrops int `json:"gate_drops"` // recorded, rate-limited diagnostics
}
type TrafficSummary ¶ added in v0.3.0
type TrafficSummary struct {
HTTP HTTPTraffic `json:"http"`
PeopleApps []SubjectAppTraffic `json:"people_apps"`
Apps []AppTraffic `json:"apps"`
TCP TCPTraffic `json:"tcp"`
}
TrafficSummary counts retained, matching traffic independently of audit receipts and the returned-event limit. It does not consult current routes.