Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Version = "v0.0.1"
Functions ¶
func GitHubTokenFromEnv ¶
func GitHubTokenFromEnv() string
GitHubTokenFromEnv returns a GitHub token from GITHUB_TOKEN or GH_TOKEN.
func ObjectKey ¶
ObjectKey returns the key in the mirror for rawURL. The key is "<host>/<path>", so that https://example.com/foo/bar.tar.gz is mirrored as example.com/foo/bar.tar.gz.
Types ¶
type Artifact ¶
type Artifact struct {
Tool string
Version string
Backend string
Platform string
URL string
Checksum string
}
Artifact is a downloadable file listed in a mise lock file.
func FilterPlatforms ¶
FilterPlatforms returns the artifacts for the given platforms. If platforms is empty, all artifacts are returned.
func LoadLockFiles ¶
LoadLockFiles reads mise lock files and returns the artifacts deduplicated by URL.
type CLI ¶
type CLI struct {
Destination string `arg:"" help:"Destination directory or S3 URL (e.g. /path/to/dir, s3://bucket/prefix/)"`
LockFiles []string `` /* 138-byte string literal not displayed */
Platforms []string `` /* 170-byte string literal not displayed */
Concurrency int `help:"Number of concurrent downloads." default:"4" env:"MISE_MIRROR_CONCURRENCY"`
Force bool `help:"Overwrite files that already exist in the destination." env:"MISE_MIRROR_FORCE"`
DryRun bool `help:"Show what would be mirrored without downloading." env:"MISE_MIRROR_DRY_RUN"`
Debug bool `help:"Enable debug logging." env:"MISE_MIRROR_DEBUG"`
MirrorURL string `` /* 202-byte string literal not displayed */
Version kong.VersionFlag `short:"v" help:"Show version and exit."`
// contains filtered or unexported fields
}
type LocalStorage ¶
type LocalStorage struct {
// contains filtered or unexported fields
}
LocalStorage stores files under a local directory.
func NewLocalStorage ¶
func NewLocalStorage(dir string) *LocalStorage
func (*LocalStorage) Location ¶
func (s *LocalStorage) Location(key string) string
type Mirror ¶
type Mirror struct {
Storage Storage
HTTPClient *http.Client
Concurrency int
Force bool
DryRun bool
// GitHubToken is sent only to GitHub hosts (see githubHosts).
GitHubToken string
}
Mirror downloads artifacts and stores them into Storage.
type S3Client ¶
type S3Client interface {
HeadObject(ctx context.Context, params *s3.HeadObjectInput, optFns ...func(*s3.Options)) (*s3.HeadObjectOutput, error)
PutObject(ctx context.Context, params *s3.PutObjectInput, optFns ...func(*s3.Options)) (*s3.PutObjectOutput, error)
}
S3Client is a subset of the S3 API used by S3Storage.
type S3Storage ¶
type S3Storage struct {
// contains filtered or unexported fields
}
S3Storage stores files in an S3 bucket.
func NewS3Storage ¶
type Storage ¶
type Storage interface {
// Exists reports whether the object for key exists.
Exists(ctx context.Context, key string) (bool, error)
// Put stores the content of src as key.
Put(ctx context.Context, key string, src *os.File) error
// Location returns a human readable location of key.
Location(key string) string
}
Storage is a destination of mirrored files.