registry

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxPathsPerClaim = 8
	MaxPathLength    = 512
)

Variables

View Source
var (
	ErrInvalidPath = errors.New("invalid claim path")
	ErrNotFound    = errors.New("claim not found")
)

Functions

func ValidPath

func ValidPath(path string) bool

Types

type Claim

type Claim struct {
	ID        string     `json:"claim_id"`
	Owner     string     `json:"owner"`
	Paths     []string   `json:"paths"`
	Local     string     `json:"-"`
	Started   time.Time  `json:"started_at"`
	ExpiresAt *time.Time `json:"expires_at,omitempty"`
}

type Conflict

type Conflict struct {
	Owner string
}

func (*Conflict) Error

func (e *Conflict) Error() string

type Memory

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

func NewMemory

func NewMemory(options Options, logger *slog.Logger) *Memory

func (*Memory) Create

func (m *Memory) Create(owner string, paths []string, local string) (Claim, error)

func (*Memory) List

func (m *Memory) List() []Claim

func (*Memory) ListOwner added in v0.5.0

func (m *Memory) ListOwner(owner string) []Claim

func (*Memory) Release

func (m *Memory) Release(owner, id string) error

type NotAllowed

type NotAllowed struct{ Path string }

func (*NotAllowed) Error

func (e *NotAllowed) Error() string

type Options added in v0.5.0

type Options struct {
	MaxClaims            int
	MaxClaimsPerOwner    int
	MinClaimPathSegments int
	MaxClaimDuration     time.Duration
	Allowed              []string
}

type Store

type Store interface {
	Create(owner string, paths []string, local string) (Claim, error)
	Release(owner, id string) error
	List() []Claim
	ListOwner(owner string) []Claim
}

Store contains only claims backed by a live tunnel session. There is no independent lease lifecycle: the tunnel creates the claim and releases it when the connection closes.

type TooManyClaims

type TooManyClaims struct{}

func (*TooManyClaims) Error

func (*TooManyClaims) Error() string

type TooManyOwnerClaims added in v0.5.0

type TooManyOwnerClaims struct{}

func (*TooManyOwnerClaims) Error added in v0.5.0

func (*TooManyOwnerClaims) Error() string

Jump to

Keyboard shortcuts

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