moduleproxy

package
v0.0.0-...-abfb1be Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2023 License: Unlicense Imports: 13 Imported by: 0

Documentation

Overview

Package moduleproxy provides a Go module proxy client and server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	URL url.URL

	// DisableModuleFetch controls whether to set the
	// non-standard Disable-Module-Fetch: true header.
	DisableModuleFetch bool
}

Client is a low-level module proxy client that targets the proxy at URL.

func (Client) GoMod

func (c Client) GoMod(ctx context.Context, mod module.Version) ([]byte, error)

GoMod fetches the go.mod file for the given module version. It returns os.ErrNotExist if it doesn't exist.

func (Client) Info

func (c Client) Info(ctx context.Context, mod module.Version) (Info, error)

Info fetches the .info file for the given module version. It returns os.ErrNotExist if it doesn't exist.

func (Client) Latest

func (c Client) Latest(ctx context.Context, modulePath string) (Info, error)

Latest fetches the optional /@latest endpoint for the given module. It returns os.ErrNotExist if the module doesn't exist, or if the optional /@latest endpoint isn't implemented by the server.

func (Client) List

func (c Client) List(ctx context.Context, modulePath string) ([]string, error)

List fetches the list of versions for the given module. It returns os.ErrNotExist if it doesn't exist.

func (Client) Zip

func (c Client) Zip(ctx context.Context, mod module.Version) ([]byte, error)

Zip fetches the .zip file for the given module version. It returns os.ErrNotExist if it doesn't exist.

type Info

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

Info describes a module version.

type Server

type Server struct {
	URL url.URL
}

Server implements the module proxy protocol by proxying off another module proxy at URL.

func (Server) ServeHTTP

func (s Server) ServeHTTP(w http.ResponseWriter, req *http.Request) error

Directories

Path Synopsis
Package std provides a Go module proxy server augmentation that adds the module std, containing the Go standard library.
Package std provides a Go module proxy server augmentation that adds the module std, containing the Go standard library.

Jump to

Keyboard shortcuts

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