proxy

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package proxy contains a Go proxy that serves modules from S3.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Copier

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

Copier copies a module to S3. Use NewCopier to initiate one.

func NewCopier

func NewCopier(s *session.Session, bucket string) *Copier

func (*Copier) Copy

func (c *Copier) Copy(m module.Version) error

Copy will run go mod download locally for the given module and upload artifacts to S3. Copy will ensure all transient dependencies are copied.

func (*Copier) ServeHTTP

func (c *Copier) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Downloader

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

Downloader reads a Go module from an S3 bucket. Use NewDownloader to initialize one.

func NewDownloader

func NewDownloader(s *session.Session, bucket string) *Downloader

func (*Downloader) Download

func (d *Downloader) Download(modulePath string, name string) (io.ReadCloser, error)

Download downloads a module from an S3 bucket. modulePath is the import path of the module, e.g. golang.org/x/text. name is the asset's name such as v0.3.0.info, v0.3.0.mod, v0.3.0.ziphash, or v0.3.0.zip.

type ProxyHandler

type ProxyHandler struct {
	Downloader *Downloader
}

func (*ProxyHandler) GoMod

GoMod returns the module .mod for the specified version.

func (*ProxyHandler) Info

Info returns the module .info for the specified version.

func (*ProxyHandler) List

func (h *ProxyHandler) List(ctx context.Context, modulePath string) (io.ReadCloser, error)

List returns the module listing. Module path is in the format of golang.org/x/text.

func (*ProxyHandler) ServeHTTP

func (h *ProxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implement a Go proxy server handler.

func (*ProxyHandler) Zip

Zip returns the module .zip for the specified version.

Jump to

Keyboard shortcuts

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