goproxy

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: Apache-2.0 Imports: 12 Imported by: 3 modules, 6 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.

Documentation

Overview

Package goproxy simple client for go modules proxy https://golang.org/cmd/go/#hdr-Module_proxy_protocol https://docs.gomods.io/intro/protocol/ https://go.googlesource.com/proposal/+/master/design/25530-sumdb.md

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int
	Message    string
}

APIError represents an error from the GoProxy.

func (*APIError) Error

func (a *APIError) Error() string

type BasicAuthTransport

type BasicAuthTransport struct {

	// Transport is the underlying HTTP transport to use when making requests.
	// It will default to http.DefaultTransport if nil.
	Transport http.RoundTripper
	// contains filtered or unexported fields
}

BasicAuthTransport HTTP transport for API authentication.

func NewBasicAuthTransport

func NewBasicAuthTransport(username, password string) (*BasicAuthTransport, error)

NewBasicAuthTransport Creates a new BasicAuthTransport.

func (*BasicAuthTransport) Client

func (t *BasicAuthTransport) Client() *http.Client

Client Creates a new HTTP client.

func (*BasicAuthTransport) RoundTrip

func (t *BasicAuthTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip executes a single HTTP transaction.

func (*BasicAuthTransport) Wrap

func (t *BasicAuthTransport) Wrap(client *http.Client) *http.Client

Wrap Wraps an HTTP client Transport with the BasicAuthTransport.

type Client

type Client struct {
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Client is the go modules proxy client.

func NewClient

func NewClient(proxyURL string) *Client

NewClient creates a new Client.

func (*Client) DownloadSources

func (c *Client) DownloadSources(moduleName, version string) (io.ReadCloser, error)

DownloadSources returns an io.ReadCloser that reads the contents of the archive file. It is the caller's responsibility to close the ReadCloser.

func (*Client) DownloadSourcesWithContext added in v0.10.0

func (c *Client) DownloadSourcesWithContext(ctx context.Context, moduleName, version string) (io.ReadCloser, error)

DownloadSourcesWithContext returns an io.ReadCloser that reads the contents of the archive file. It is the caller's responsibility to close the ReadCloser.

func (*Client) GetInfo

func (c *Client) GetInfo(moduleName, version string) (*VersionInfo, error)

GetInfo gets information about a module version.

<proxy URL>/<module name>/@v/<version>.info

func (*Client) GetInfoWithContext added in v0.10.0

func (c *Client) GetInfoWithContext(ctx context.Context, moduleName, version string) (*VersionInfo, error)

GetInfoWithContext gets information about a module version.

<proxy URL>/<module name>/@v/<version>.info

func (*Client) GetLatest

func (c *Client) GetLatest(moduleName string) (*VersionInfo, error)

GetLatest gets information about the latest module version.

<proxy URL>/<module name>/@latest

func (*Client) GetLatestWithContext added in v0.10.0

func (c *Client) GetLatestWithContext(ctx context.Context, moduleName string) (*VersionInfo, error)

GetLatestWithContext gets information about the latest module version.

<proxy URL>/<module name>/@latest

func (*Client) GetModFile

func (c *Client) GetModFile(moduleName, version string) (*modfile.File, error)

GetModFile gets go.mod file.

func (*Client) GetModFileWithContext added in v0.10.0

func (c *Client) GetModFileWithContext(ctx context.Context, moduleName, version string) (*modfile.File, error)

GetModFileWithContext gets go.mod file.

func (*Client) GetSources

func (c *Client) GetSources(moduleName, version string) ([]byte, error)

GetSources gets the contents of the archive file.

func (*Client) GetSourcesWithContext added in v0.10.0

func (c *Client) GetSourcesWithContext(ctx context.Context, moduleName, version string) ([]byte, error)

GetSourcesWithContext gets the contents of the archive file.

func (*Client) GetVersions

func (c *Client) GetVersions(moduleName string) ([]string, error)

GetVersions gets all available module versions.

<proxy URL>/<module name>/@v/list

func (*Client) GetVersionsWithContext added in v0.10.0

func (c *Client) GetVersionsWithContext(ctx context.Context, moduleName string) ([]string, error)

GetVersionsWithContext gets all available module versions.

<proxy URL>/<module name>/@v/list

type VersionInfo

type VersionInfo struct {
	Name    string
	Short   string
	Version string
	Time    time.Time
}

VersionInfo is the representation of a version.

Jump to

Keyboard shortcuts

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