Help us shape the future of Go! Take the 2026 Go Developer Survey

registry

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

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

Registry manages the list of allowed directories.

func New

func New(dirs []string, logger *slog.Logger) *Registry

New creates a new Registry with the given directories.

func (*Registry) Get

func (r *Registry) Get() []string

Get returns a copy of the allowed directories.

func (*Registry) GetResolved

func (r *Registry) GetResolved() []string

GetResolved returns a copy of the symlink-resolved allowed directories. These are computed once at initialization or when Set() is called.

func (*Registry) IsEmpty

func (r *Registry) IsEmpty() bool

IsEmpty returns true if no directories are registered.

func (*Registry) Set

func (r *Registry) Set(dirs []string)

Set replaces the allowed directories with a new set.

func (*Registry) Validate

func (r *Registry) Validate(path string) (string, error)

Validate checks if a path is within allowed directories. Returns the resolved path if valid, or an error if not.

func (*Registry) ValidateForCreation

func (r *Registry) ValidateForCreation(path string) (string, error)

ValidateForCreation validates a path for file/directory creation.

type Validator

type Validator interface {
	Validate(path string) (string, error)
	ValidateForCreation(path string) (string, error)
}

Validator defines path validation methods used by the registry.

Jump to

Keyboard shortcuts

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