gitlabgoproxy

package module
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 26 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

gitlab-goproxy

codecov

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGitlabFetcher

func NewGitlabFetcher(conf GitlabFetcherConfig) (goproxy.Fetcher, error)

func NewS3Cache added in v0.1.5

func NewS3Cache(conf S3Config) (goproxy.Cacher, error)

func Save

func Save(ctx context.Context, input io.Reader) (io.ReadSeekCloser, int64, error)

func UnzipArchiveFromGitlab

func UnzipArchiveFromGitlab(workspace string, depth int, archive string) error

Types

type Config

type Config struct {
	Masks    []GitlabFetcherConfig `json:"masks" yaml:"masks" toml:"masks"`
	Upstream UpstreamConfig        `json:"upstream" yaml:"upstream" toml:"upstream"`
	S3       S3Config              `json:"s3" yaml:"s3" toml:"s3"`
}

type GitLab

type GitLab interface {
	ListTags(ctx context.Context, repository string, prefix string) ([]*Info, error)
	GetTag(ctx context.Context, repository, tag string) (*Info, error)
	GetFile(ctx context.Context, repository, path, ref string) ([]byte, error)
	Download(ctx context.Context, repository, dir, ref string) (io.Reader, error) // https://go.dev/ref/mod#zip-files, TODO: The zip file of the main module does not contain any submodules, and the zip file of the submodule only contains its own files
	IsProject(context.Context, string) (bool, error)
}

type GitlabFetcher

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

func (*GitlabFetcher) Archive

func (gf *GitlabFetcher) Archive(fetchCtx, fileCtx context.Context, loc *Locator, path, version string) (io.ReadSeekCloser, error)

func (*GitlabFetcher) Download

func (gf *GitlabFetcher) Download(ctx context.Context, path, version string) (info, mod, zip io.ReadSeekCloser, err error)

Download ..

func (*GitlabFetcher) Extract

func (gf *GitlabFetcher) Extract(ctx context.Context, path, query string) (*Locator, error)

func (*GitlabFetcher) ExtractSubPath

func (gf *GitlabFetcher) ExtractSubPath(ctx context.Context, path string) (string, []string, string, error)

func (*GitlabFetcher) List

func (gf *GitlabFetcher) List(ctx context.Context, path string) ([]string, error)

List returns query results via Git Repository Tag list

gitlab/wongidle/foobar -> [v0.1.0, v0.1.1]
gitlab/wongidle/foobar/internal -> error
gitlab/wongidle/foobar/pkg -> [v0.2.0, v0.2.1] -> [pkg/v0.2.0, pkg/v0.2.1]

func (*GitlabFetcher) NeedFetch

func (gf *GitlabFetcher) NeedFetch(path string) bool

func (*GitlabFetcher) Query

func (gf *GitlabFetcher) Query(ctx context.Context, path, query string) (string, time.Time, error)

Query: - gitlab.com/wongidle/foobar v0.1.1 -> wongidle/foobar v0.1.1 - gitlab.com/wongidle/foobar/internal v0.1.1

  • good: wongidle/foobar | internal | internal/v0.1.1
  • bad: wongidle/foobar |

func (*GitlabFetcher) SaveGoMod

func (gf *GitlabFetcher) SaveGoMod(fetchCtx, fileCtx context.Context, loc *Locator) (io.ReadSeekCloser, error)

func (*GitlabFetcher) SaveInfo

func (gf *GitlabFetcher) SaveInfo(fetchCtx, fileCtx context.Context, loc *Locator) (io.ReadSeekCloser, error)

type GitlabFetcherConfig

type GitlabFetcherConfig struct {
	Endpoint    string `json:"endpoint" yaml:"endpoint" toml:"endpoint"`
	AccessToken string `json:"access_token" yaml:"access_token" toml:"access_token"`
	Mask        string `json:"mask" yaml:"mask" toml:"mask"`
}

type GitlabHost

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

func NewGitlabHost

func NewGitlabHost(conf GitlabFetcherConfig) (*GitlabHost, error)

func (*GitlabHost) Download

func (gh *GitlabHost) Download(ctx context.Context, repo, dir, ref string) (io.Reader, error)

func (*GitlabHost) GetFile

func (gh *GitlabHost) GetFile(ctx context.Context, repo, path, ref string) ([]byte, error)

func (*GitlabHost) GetTag

func (gh *GitlabHost) GetTag(ctx context.Context, repo, tag string) (*Info, error)

func (*GitlabHost) IsProject

func (gh *GitlabHost) IsProject(ctx context.Context, repo string) (bool, error)

func (*GitlabHost) ListTags

func (gh *GitlabHost) ListTags(ctx context.Context, repo string, prefix string) ([]*Info, error)

type Info

type Info struct {
	Version string
	Time    time.Time // commit time
}

type Locator

type Locator struct {
	Repository string
	SubPath    string
	Ref        string
}

type MixedFetcher

type MixedFetcher struct {
	Masks    []*GitlabFetcher
	Upstream goproxy.Fetcher
}

func NewMixedFetcher

func NewMixedFetcher(conf Config) (*MixedFetcher, error)

func (*MixedFetcher) Download

func (*MixedFetcher) List

func (mf *MixedFetcher) List(ctx context.Context, path string) ([]string, error)

func (*MixedFetcher) Query

func (mf *MixedFetcher) Query(ctx context.Context, path string, query string) (string, time.Time, error)

type S3Cache added in v0.1.5

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

func (*S3Cache) Get added in v0.1.5

func (s3 *S3Cache) Get(ctx context.Context, name string) (io.ReadCloser, error)

func (*S3Cache) Put added in v0.1.5

func (s3 *S3Cache) Put(ctx context.Context, name string, content io.ReadSeeker) error

type S3Config added in v0.1.5

type S3Config struct {
	AccessKeyID        string `json:"access_key_id" toml:"access_key_id" yaml:"access_key_id"`
	SecretAccessKey    string `json:"secret_access_key" toml:"secret_access_key" yaml:"secret_access_key"`
	Endpoint           string `json:"endpoint" toml:"endpoint" yaml:"endpoint"`
	DisableTLS         bool   `json:"disable_tls" toml:"disable_tls" yaml:"disable_tls"`
	InsecureSkipVerify bool   `json:"insecure_skip_verify" toml:"insecure_skip_verify" yaml:"insecure_skip_verify"`
	Bucket             string `json:"bucket" toml:"bucket" yaml:"bucket"`
	Enable             bool   `json:"enable" toml:"enable" yaml:"enable"`
}

type SmartFile

type SmartFile struct {
	*os.File
	Ctx context.Context
	// contains filtered or unexported fields
}

func Create

func Create(ctx context.Context) (*SmartFile, error)

func (*SmartFile) Close

func (cf *SmartFile) Close() error

type UpstreamConfig

type UpstreamConfig struct {
	Proxy string `json:"proxy" yaml:"proxy" toml:"proxy"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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