Help us shape the future of Go! Take the 2026 Go Developer Survey

gomodproxy

package
v1.125.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package gomodproxy serves the Go module proxy protocol on loopback so the Dependency Firewall can check module zips without a MITM certificate: go and git on macOS trust only the system store, and installing the firewall's CA there needs sudo.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

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

Backend serves allowed module proxy requests through goproxy and owns the temp tree goproxy fetches into.

func NewBackend

func NewBackend(goBin string, proxiedSumDBs []string, envOverrides map[string]string) (*Backend, error)

NewBackend builds a goproxy handler that shells out to goBin for direct fetches. proxiedSumDBs names the checksum databases served under /sumdb/. envOverrides replaces the fetcher environment's value for each key it sets, except the isolation pins, which always win.

func (*Backend) Close

func (b *Backend) Close()

Close removes the temp tree, including modules fetched while resolving a request that was later blocked.

func (*Backend) ServeHTTP

func (b *Backend) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Server

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

Server serves the Go module proxy protocol on loopback and gates module zip downloads against the Dependency Firewall.

The backend's fetcher carries the user's version-control credentials, so only a client that knows the per-run path token and addresses the listener by its own address reaches it: that excludes other local processes and DNS-rebinding web pages.

func New

func New(checker policy.Checker, projectID string, backend http.Handler) *Server

func (*Server) BaseURL

func (s *Server) BaseURL() string

BaseURL is the value to hand the child as GOPROXY. It is empty before Start.

func (*Server) CheckedZips

func (s *Server) CheckedZips() int

CheckedZips reports how many module zips got a policy decision.

func (*Server) Start

func (s *Server) Start() error

Start listens on an ephemeral loopback port and begins serving.

func (*Server) Stop

func (s *Server) Stop()

Stop cancels in-flight policy checks and fetches, waits up to drainTimeout for their handlers to return, then force-closes what is left. Waiting matters because the caller removes the backend's temp tree next. Stop is idempotent.

func (*Server) Verdicts

func (s *Server) Verdicts() []verdict.Entry

Verdicts returns a copy of the blocked and warned verdicts recorded so far.

Jump to

Keyboard shortcuts

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