remote

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CachePath

func CachePath(cacheDir string, key string) string

func DefaultCacheDir

func DefaultCacheDir() (string, error)

func IsPathInsideAny

func IsPathInsideAny(targetPath string, roots []string) (bool, string, error)

func NewCacheKey

func NewCacheKey(request Request) (string, error)

func NormalizeGitRepoCacheURL

func NormalizeGitRepoCacheURL(raw string) (string, error)

func NormalizeGitRepoURL

func NormalizeGitRepoURL(raw string) (string, error)

func NormalizeURL

func NormalizeURL(raw string) (string, error)

func RedactCredentialError

func RedactCredentialError(message string, credentials Credentials, gitCredentials GitCredentials) string

func RedactGitRepoURL

func RedactGitRepoURL(raw string) string

func RedactURL

func RedactURL(raw string) string

func ResolveCacheDir

func ResolveCacheDir(cacheDir string, forbiddenRoots []string) (string, error)

Types

type Acquirer

type Acquirer interface {
	Acquire(ctx context.Context, request Request, opts Options) (Result, error)
}

type Credentials

type Credentials struct {
	Username    string
	Password    string
	BearerToken string
}

type DefaultAcquirer

type DefaultAcquirer struct {
	Client   *http.Client
	MaxBytes int64
}

func (DefaultAcquirer) Acquire

func (acquirer DefaultAcquirer) Acquire(ctx context.Context, request Request, opts Options) (Result, error)

type GitCredentials

type GitCredentials struct {
	Username          string
	Password          string
	BearerToken       string
	SSHPrivateKeyPath string
	SSHPrivateKey     string
	SSHPassphrase     string
	SSHKnownHostsPath string
}

type Options

type Options struct {
	CacheDir       string
	Offline        bool
	Refresh        bool
	ForbiddenRoots []string
	Credentials    Credentials
	GitCredentials GitCredentials
}

type Request

type Request struct {
	URL      string
	Kind     RequestKind
	RepoURL  string
	Revision string
}

type RequestKind

type RequestKind string
const (
	RequestHTTPFile RequestKind = "http-file"
	RequestGitRepo  RequestKind = "git-repo"
)

type Result

type Result struct {
	Path      string
	URL       string
	Revision  string
	FromCache bool
	// Release releases any read lock or temporary resource associated with Path.
	// Callers that receive a non-nil Release must call it exactly once after they
	// finish copying from Path. Release implementations must be idempotent so
	// defensive double-calls are harmless.
	Release func()
}

Jump to

Keyboard shortcuts

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