internal/

directory
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: Apache-2.0

Directories

Path Synopsis
Package config holds the env-driven service configuration.
Package config holds the env-driven service configuration.
controller
api
Package api is the gRPC implementation of the management API (GuardrailsApi): custom rule CRUD, global settings, data-type discovery and dry-run masking checks.
Package api is the gRPC implementation of the management API (GuardrailsApi): custom rule CRUD, global settings, data-type discovery and dry-run masking checks.
guardrails
Package logging configures the process-wide slog default logger and provides thin context-aware helpers used across the service.
Package logging configures the process-wide slog default logger and provides thin context-aware helpers used across the service.
Package repository defines the persistence abstraction shared by masking state, custom rules, global settings and the masking audit trail.
Package repository defines the persistence abstraction shared by masking state, custom rules, global settings and the masking audit trail.
factory
Package factory builds the configured repository.Store backend.
Package factory builds the configured repository.Store backend.
memory
Package memory implements repository.Store in process memory.
Package memory implements repository.Store in process memory.
postgres
Package postgres implements repository.Store on top of PostgreSQL (pgx).
Package postgres implements repository.Store on top of PostgreSQL (pgx).
redis
Package redis implements repository.Store on top of a Redis server.
Package redis implements repository.Store on top of a Redis server.
repositorytest
Package repositorytest provides a conformance suite that every repository.Store implementation must pass.
Package repositorytest provides a conformance suite that every repository.Store implementation must pass.
statecodec
Package statecodec serializes models.MaskingState for external store backends, optionally encrypting it at rest with AES-256-GCM.
Package statecodec serializes models.MaskingState for external store backends, optionally encrypting it at rest with AES-256-GCM.
service
audit
Package audit records per-request masking audit entries.
Package audit records per-request masking audit entries.
rulesreload
Package rulesreload rebuilds the compiled rule registry from the built-in rules plus the custom/disabled sets persisted in the store, and atomically swaps the snapshot so the data path always reads a complete rule set.
Package rulesreload rebuilds the compiled rule registry from the built-in rules plus the custom/disabled sets persisted in the store, and atomically swaps the snapshot so the data path always reads a complete rule set.
settings
Package settings resolves the global guardrails settings and the per-request narrow-only header override.
Package settings resolves the global guardrails settings and the per-request narrow-only header override.
Package sseproc is the top-level facade for SSE response demasking.
Package sseproc is the top-level facade for SSE response demasking.
chatcompletions
Package sseproc implements SSE stream processing for LLM response demasking.
Package sseproc implements SSE stream processing for LLM response demasking.
messages
Package messages implements SSE stream processing for the Anthropic Messages API (/v1/messages) response demasking.
Package messages implements SSE stream processing for the Anthropic Messages API (/v1/messages) response demasking.
responses
Package responses implements SSE stream processing for OpenAI Responses API (/v1/responses) response demasking.
Package responses implements SSE stream processing for OpenAI Responses API (/v1/responses) response demasking.
usecases
guardrails/scan
Package scan runs a dry-run guardrails scan outside the data path: it reuses the production compile + scan + mask pipeline to report what a sample text would trigger, without persisting MaskingState or calling any upstream.
Package scan runs a dry-run guardrails scan outside the data path: it reuses the production compile + scan + mask pipeline to report what a sample text would trigger, without persisting MaskingState or calling any upstream.
rules
Package rules coordinates the rule-management use cases exposed by the configuration API: create/update/delete a custom rule, enable/disable any rule, and read/list built-in and custom rules.
Package rules coordinates the rule-management use cases exposed by the configuration API: create/update/delete a custom rule, enable/disable any rule, and read/list built-in and custom rules.
rules/builtins
Package builtins provides an immutable index over the built-in rules loaded from the YAML files at startup.
Package builtins provides an immutable index over the built-in rules loaded from the YAML files at startup.
rules/create
Package create implements the "create a custom rule" use case: validate the rule, reject IDs that collide with a built-in or an existing custom rule, persist it, then reload the registry snapshot.
Package create implements the "create a custom rule" use case: validate the rule, reject IDs that collide with a built-in or an existing custom rule, persist it, then reload the registry snapshot.
rules/delete
Package delete implements the "remove a custom rule" use case: reject built-in IDs, delete the custom rule, clear any lingering disabled flag, then reload the registry snapshot.
Package delete implements the "remove a custom rule" use case: reject built-in IDs, delete the custom rule, clear any lingering disabled flag, then reload the registry snapshot.
rules/errors
Package errors holds the domain sentinel errors shared by every rule use case.
Package errors holds the domain sentinel errors shared by every rule use case.
rules/get
Package get implements the "read one rule" use case, resolving whether the ID is built-in or custom and its current enabled state.
Package get implements the "read one rule" use case, resolving whether the ID is built-in or custom and its current enabled state.
rules/list
Package list implements the "list rules" use case, returning built-in and/or custom rules (sorted, custom by ID) each annotated with its source and enabled state.
Package list implements the "list rules" use case, returning built-in and/or custom rules (sorted, custom by ID) each annotated with its source and enabled state.
rules/setenabled
Package setenabled implements the "enable or disable a rule" use case.
Package setenabled implements the "enable or disable a rule" use case.
rules/update
Package update implements the "replace an existing custom rule" use case: reject built-in IDs, validate the new content, require the custom rule to exist, persist it, then reload the registry snapshot.
Package update implements the "replace an existing custom rule" use case: reject built-in IDs, validate the new content, require the custom rule to exist, persist it, then reload the registry snapshot.
rules/validation
Package validation holds the shared rule-content validation used by the create and update use cases.
Package validation holds the shared rule-content validation used by the create and update use cases.
Package version holds the build identity of the binary.
Package version holds the build identity of the binary.

Jump to

Keyboard shortcuts

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