Documentation
¶
Overview ¶
Package proxy serves proxy repositories: files are fetched from the repository's upstream on first request, cached content-addressed in the blob store, recorded in proxy_cache_entries (which also backs the repository's package listing) and served from the cache until their TTL expires. When an expired entry cannot be revalidated because the upstream is down, it is served stale for up to the repository's max_stale_seconds.
Index ¶
Constants ¶
const ( // DefaultMaxBody caps any single file fetched from an upstream. DefaultMaxBody int64 = 4 << 30 // 4 GiB )
Variables ¶
This section is empty.
Functions ¶
func CleanPath ¶ added in v0.4.0
CleanPath validates a client-supplied repository-relative path and returns it without the leading slash. Empty paths, directory paths (trailing slash), empty/dot/dot-dot segments, backslashes and control characters are refused: the path is appended to the upstream URL and must not be able to escape it.
Types ¶
type Service ¶ added in v0.4.0
type Service struct {
// contains filtered or unexported fields
}
Service fetches and caches upstream files for proxy repositories.
func NewService ¶ added in v0.4.0
NewService creates the proxy service. Upstream requests use an SSRF-safe client: blocked destination addresses are refused at dial time and on every redirect hop.
func (*Service) Serve ¶ added in v0.4.0
func (s *Service) Serve(w http.ResponseWriter, r *http.Request, repo *models.Repository, relPath string)
Serve answers a GET/HEAD for relPath (the path below the repository root) of proxy repo.