accesslog

package
v0.67.3 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: BSD-3-Clause, AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type L4Entry added in v0.67.0

type L4Entry struct {
	AccountID     types.AccountID
	ServiceID     types.ServiceID
	Protocol      Protocol
	Host          string // SNI hostname or listen address
	SourceIP      netip.Addr
	DurationMs    int64
	BytesUpload   int64
	BytesDownload int64
	// DenyReason, when non-empty, indicates the connection was denied.
	// Values match the HTTP auth mechanism strings: "ip_restricted",
	// "country_restricted", "geo_unavailable".
	DenyReason string
}

L4Entry holds the data for a layer-4 (TCP/UDP) access log entry.

type Logger

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

Logger sends access log entries to the management server via gRPC.

func NewLogger

func NewLogger(client gRPCClient, logger *log.Logger, trustedProxies []netip.Prefix) *Logger

NewLogger creates a new access log Logger. The trustedProxies parameter configures which upstream proxy IP ranges are trusted for extracting the real client IP from X-Forwarded-For headers.

func (*Logger) Close added in v0.66.3

func (l *Logger) Close()

Close stops the cleanup routine. Should be called during graceful shutdown.

func (*Logger) LogL4 added in v0.67.0

func (l *Logger) LogL4(entry L4Entry)

LogL4 sends an access log entry for a layer-4 connection (TCP or UDP). The call is non-blocking: the gRPC send happens in a background goroutine.

func (*Logger) Middleware

func (l *Logger) Middleware(next http.Handler) http.Handler

Middleware wraps an HTTP handler to log access entries and resolve client IPs.

type Protocol added in v0.67.0

type Protocol string

Protocol identifies the transport protocol of an access log entry.

const (
	ProtocolHTTP Protocol = "http"
	ProtocolTCP  Protocol = "tcp"
	ProtocolUDP  Protocol = "udp"
	ProtocolTLS  Protocol = "tls"
)

Jump to

Keyboard shortcuts

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