Documentation ¶
Overview ¶
Package goproxy provides Go modules proxy API client.
Index ¶
- Constants
- type ArchiveReadCloser
- type Client
- func (c *Client) GetLatestVersion(ctx context.Context, pkgUrl string) (*VersionInfo, error)
- func (c *Client) GetModuleFile(ctx context.Context, pkgUrl, version string) ([]byte, error)
- func (c *Client) GetModuleSource(ctx context.Context, pkgUrl, version string) (*ArchiveReadCloser, error)
- func (c *Client) GetVersionInfo(ctx context.Context, pkgUrl, version string) (*VersionInfo, error)
- func (c *Client) GetVersions(ctx context.Context, pkgUrl string) ([]string, error)
- func (c *Client) SetBaseURL(baseURL string)
- type HTTPError
- type VersionInfo
Constants ¶
const (
DefaultProxyURL = "https://proxy.golang.org"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArchiveReadCloser ¶
type ArchiveReadCloser struct { io.ReadCloser // Size is content length in bytes. Size int64 // ContentType is archive content type. ContentType string }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientFromEnv ¶
func NewClientFromEnv() *Client
NewClientFromEnv returns a new client with address from GOPROXY environment variable.
Attention: only first address is respected. "direct" value is also ignored.
The default Go proxy URL is returned in case of error.
func NewClientWithDefaults ¶
func NewClientWithDefaults() *Client
NewClientWithDefaults returns a new go modules proxy client with default http client and official Go Modules proxy server.
func (*Client) GetLatestVersion ¶
GetLatestVersion returns information about a latest module version.
func (*Client) GetModuleFile ¶
GetModuleFile returns go.mod file of specific version of a module.
func (*Client) GetModuleSource ¶
func (c *Client) GetModuleSource(ctx context.Context, pkgUrl, version string) (*ArchiveReadCloser, error)
GetModuleSource returns zip archive stream for that version of the given module.
Returns a io.ReadCloser-compatible struct with size and content type information.
func (*Client) GetVersionInfo ¶
GetVersionInfo returns information about module version.
func (*Client) GetVersions ¶
GetVersions returns a list of module versions.
func (*Client) SetBaseURL ¶
SetBaseURL updates proxy base URL