Documentation
¶
Index ¶
- func DefaultStringLimit() int
- type Proxy
- type ProxyOption
- type VerboseWriter
- func (v *VerboseWriter) RequestAfterPolicy(body []byte, rule string)
- func (v *VerboseWriter) RequestAllowed()
- func (v *VerboseWriter) RequestDenied(rule, message string)
- func (v *VerboseWriter) RequestRaw(body []byte)
- func (v *VerboseWriter) ResponseAfterPolicy(body []byte, rule string)
- func (v *VerboseWriter) ResponseAllowed()
- func (v *VerboseWriter) ResponseDenied(rule, message string)
- func (v *VerboseWriter) ResponseRaw(body []byte)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultStringLimit ¶
func DefaultStringLimit() int
DefaultStringLimit returns the default string truncation length for verbose output.
Types ¶
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy is the LLM gateway HTTP handler.
type ProxyOption ¶
type ProxyOption func(*Proxy)
ProxyOption configures optional Proxy behavior.
func WithDebugLogger ¶
func WithDebugLogger(l *slog.Logger) ProxyOption
WithDebugLogger enables debug logging to the given slog.Logger.
func WithVerboseWriter ¶
func WithVerboseWriter(v *VerboseWriter) ProxyOption
WithVerboseWriter enables verbose packet logging.
type VerboseWriter ¶
type VerboseWriter struct {
// contains filtered or unexported fields
}
VerboseWriter writes human-readable packet dumps to an io.Writer (typically stderr). WARNING: Verbose output may contain sensitive data (API keys, tokens, PII). Only enable in development/debugging. Never enable in production.
func NewVerboseWriter ¶
func NewVerboseWriter(w io.Writer, stringLimit int) *VerboseWriter
NewVerboseWriter creates a verbose writer. If stringLimit > 0, individual string values in JSON are truncated to that length. Pass 0 for no truncation.
func (*VerboseWriter) RequestAfterPolicy ¶
func (v *VerboseWriter) RequestAfterPolicy(body []byte, rule string)
RequestAfterPolicy logs the request after policy mutations.
func (*VerboseWriter) RequestAllowed ¶
func (v *VerboseWriter) RequestAllowed()
RequestAllowed logs that the request passed policy unchanged.
func (*VerboseWriter) RequestDenied ¶
func (v *VerboseWriter) RequestDenied(rule, message string)
RequestDenied logs that a request was denied by policy.
func (*VerboseWriter) RequestRaw ¶
func (v *VerboseWriter) RequestRaw(body []byte)
RequestRaw logs the inbound request, showing metadata as a header and messages pretty-printed.
func (*VerboseWriter) ResponseAfterPolicy ¶
func (v *VerboseWriter) ResponseAfterPolicy(body []byte, rule string)
ResponseAfterPolicy logs the response after policy mutations.
func (*VerboseWriter) ResponseAllowed ¶
func (v *VerboseWriter) ResponseAllowed()
ResponseAllowed logs that the response passed policy unchanged.
func (*VerboseWriter) ResponseDenied ¶
func (v *VerboseWriter) ResponseDenied(rule, message string)
ResponseDenied logs that a response was denied by policy.
func (*VerboseWriter) ResponseRaw ¶
func (v *VerboseWriter) ResponseRaw(body []byte)
ResponseRaw logs the upstream response, showing metadata as a header and content pretty-printed.