gomod

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 10 Imported by: 0 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.

Documentation

Overview

Package gomod implements the Go module proxy (GOPROXY protocol) backend.

Index

Constants

View Source
const DefaultSpeedDuration = 10 * time.Second

DefaultSpeedDuration bounds a speed-test download.

Variables

This section is empty.

Functions

This section is empty.

Types

type Detail

type Detail struct {
	Versions []string `json:"versions,omitempty"`
	Info     *ModInfo `json:"info,omitempty"`
}

Detail is gomod's PackageResult.Detail payload.

type ModInfo

type ModInfo struct {
	Version string    `json:"Version"`
	Time    time.Time `json:"Time"`
}

ModInfo mirrors the GOPROXY .info document.

type ResolveOptions

type ResolveOptions struct {
	// File is "zip" (default) or "mod".
	File string
}

ResolveOptions selects which GOPROXY artifact Resolve returns.

type Service

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

Service implements core.Prober for GOPROXY-style mirrors.

func New

func New(cfg core.Config) *Service

New builds a gomod Service.

func (*Service) Package

func (s *Service) Package(ctx context.Context, mirror string, q core.PackageQuery) (core.PackageResult, error)

Package lists versions and resolves the latest via @v/list + @v/latest.info.

func (*Service) Resolve

func (s *Service) Resolve(ctx context.Context, mirror string, q core.PackageQuery) (core.DownloadResult, error)

Resolve returns the direct .zip (or .mod with Options) URL.

func (*Service) Speed

func (s *Service) Speed(ctx context.Context, mirror string, o core.SpeedOptions) (core.SpeedResult, error)

Speed measures throughput by downloading a module .zip (e.g. golang.org/x/mod's latest zip, a few hundred KB).

func (*Service) Status

func (s *Service) Status(ctx context.Context, mirror string) (core.StatusResult, error)

Status probes @v/list of a well-known module.

Jump to

Keyboard shortcuts

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