binarycache

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCacheName              = ".genmcp"
	DefaultBinaryPrefix           = "genmcp-server"
	DefaultGitHubReleasesURL      = "https://github.com/genmcp/gen-mcp/releases/download"
	DefaultGitHubAPIURL           = "https://api.github.com/repos/genmcp/gen-mcp/releases/latest"
	DefaultSigstoreIdentityRegexp = "https://github.com/genmcp/gen-mcp/.*"
	DefaultSigstoreOIDCIssuer     = "https://token.actions.githubusercontent.com"
	DefaultVerbose                = false
)
View Source
const (
	CacheKeepVersionsCount = 3 // Number of versions to keep per platform in cache
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryCache

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

BinaryCache manages cached server binaries

func NewBinaryCache

func NewBinaryCache(cfg *Config) (*BinaryCache, error)

NewBinaryCache creates a new binary cache manager using the default user cache dir and the provided name for the cache

func NewBinaryCacheWithDir

func NewBinaryCacheWithDir(cacheDir, prefix string) (*BinaryCache, error)

NewBinaryCacheWithDir creates a new binary cache manager with a custom cache directory

func (*BinaryCache) Add

func (bc *BinaryCache) Add(version, platform, sourcePath string) (string, error)

Add adds a binary zip file to the cache

func (*BinaryCache) Clean

func (bc *BinaryCache) Clean(keepVersions int) error

Clean removes old cached binaries (keeps last N versions)

func (*BinaryCache) Get

func (bc *BinaryCache) Get(version, platform string) (string, bool)

Get retrieves a cached binary path for a version and platform

func (*BinaryCache) GetLatestCached

func (bc *BinaryCache) GetLatestCached(platform string) (string, string)

GetLatestCached returns the most recently cached version for a platform

type BinaryCacheEntry

type BinaryCacheEntry struct {
	Version      string `json:"version"`
	Platform     string `json:"platform"`      // e.g., "linux-amd64"
	ZipPath      string `json:"zip_path"`      // absolute path to verified zip file
	SHA256       string `json:"sha256"`        // checksum of zip file
	DownloadedAt string `json:"downloaded_at"` // timestamp
}

BinaryCacheEntry represents a cached binary

type BinaryDownloader

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

BinaryDownloader handles downloading server binaries from GitHub releases

func NewBinaryDownloader

func NewBinaryDownloader(cfg *Config) (*BinaryDownloader, error)

NewBinaryDownloader creates a new binary downloader

func (*BinaryDownloader) CleanOldBinaries

func (bd *BinaryDownloader) CleanOldBinaries(keepVersions int) error

CleanOldBinaries removes old cached binaries (keeps last N versions)

func (*BinaryDownloader) GetBinary

func (bd *BinaryDownloader) GetBinary(version, goos, goarch string) (string, error)

GetBinary retrieves a server binary for the specified version and platform Returns the path to the binary file

func (*BinaryDownloader) GetCurrentBinary

func (bd *BinaryDownloader) GetCurrentBinary(version string) (string, error)

GetCurrentBinary gets the binary for the current platform and a specific version

type Config

type Config struct {
	CacheName              string // e.g. ".genmcp"
	BinaryPrefix           string // e.g. "genmcp-server"
	GitHubReleasesURL      string
	GitHubAPIURL           string
	SigstoreIdentityRegexp string
	SigstoreOIDCIssuer     string
	Verbose                bool // whether to log out verbose outputs
}

func DefaultConfig

func DefaultConfig() *Config

func (*Config) GetBinaryPrefix

func (cfg *Config) GetBinaryPrefix() string

func (*Config) GetCacheName

func (cfg *Config) GetCacheName() string

func (*Config) GetGitHubAPIURL

func (cfg *Config) GetGitHubAPIURL() string

func (*Config) GetGitHubReleasesURL

func (cfg *Config) GetGitHubReleasesURL() string

func (*Config) GetSanitizedCacheName added in v0.2.2

func (cfg *Config) GetSanitizedCacheName() string

GetSanitizedCacheName returns the cache name with path separators replaced, making it safe for use in temp directory prefixes and filenames.

func (*Config) GetSigstoreIdentityRegexp

func (cfg *Config) GetSigstoreIdentityRegexp() string

func (*Config) GetSigstoreOIDCIssuer

func (cfg *Config) GetSigstoreOIDCIssuer() string

func (*Config) GetVerbose

func (cfg *Config) GetVerbose() bool

type SigstoreVerifier

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

SigstoreVerifier verifies binaries using sigstore-go library

func NewSigstoreVerifier

func NewSigstoreVerifier(cfg *Config) (*SigstoreVerifier, error)

NewSigstoreVerifier creates a new sigstore verifier using the public good instance

func (*SigstoreVerifier) VerifyBlob

func (sv *SigstoreVerifier) VerifyBlob(blobPath, bundlePath string) error

VerifyBlob verifies a blob (file) using a sigstore bundle

Jump to

Keyboard shortcuts

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