block

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Ecosystem string    `json:"ecosystem"`
	Name      string    `json:"name"`
	Version   string    `json:"version"` // empty = all versions of this package
	Reason    string    `json:"reason"`
	AddedBy   string    `json:"added_by"`
	AddedAt   time.Time `json:"added_at"`
}

type List

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

func New

func New(path string) (*List, error)

New creates a List, loading existing entries from path if the file exists. Pass empty string for in-memory-only operation.

func (*List) Add

func (l *List) Add(e Entry) error

Add appends an entry and persists if a path is set.

func (*List) Entries

func (l *List) Entries() []Entry

Entries returns a snapshot of all entries.

func (*List) IsBlocked

func (l *List) IsBlocked(ecosystem, name, version string) (bool, Entry)

IsBlocked returns true if ecosystem+name+version is on the blocklist, along with the matching entry. A wildcard entry (empty Version) matches any version of the package.

func (*List) Remove

func (l *List) Remove(ecosystem, name, version string) error

Remove deletes all entries matching ecosystem+name. If version is non-empty, only the exact version entry is removed; otherwise all versions are removed.

Jump to

Keyboard shortcuts

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