@@ -237,6 +237,7 @@ Each upstream used by a built-in package route can be set in YAML or JSON under
237237| `upstream.cargo_download` | `PROXY_UPSTREAM_CARGO_DOWNLOAD` | `https://static.crates.io/crates` |
238238| `upstream.gem` | `PROXY_UPSTREAM_GEM` | `https://rubygems.org` |
239239| `upstream.go` | `PROXY_UPSTREAM_GO` | `https://proxy.golang.org` |
240+ | `upstream.go_sumdbs_offline` | `PROXY_UPSTREAM_GO_SUMDBS_OFFLINE` | `false` |
240241| `upstream.hex` | `PROXY_UPSTREAM_HEX` | `https://repo.hex.pm` |
241242| `upstream.hex_api` | `PROXY_UPSTREAM_HEX_API` | `https://hex.pm` |
242243| `upstream.pub` | `PROXY_UPSTREAM_PUB` | `https://pub.dev` |
@@ -495,6 +496,63 @@ When `upstream.arch` is empty, a single repository named `archlinux` pointing at
495496that default. Arch Linux ARM has no default : pick a regional HTTPS mirror, not
496497the `mirror.archlinuxarm.org` redirector.
497498
499+ # ## Go checksum database
500+
501+ ` ` ` yaml
502+ upstream:
503+
504+ # Named Go checksum databases, served at /go/sumdb/{name}/.
505+ go_sumdbs:
506+ sum.golang.org: "https://sum.golang.org"
507+
508+ # Keep answering for a database from its cached tree, however old, when
509+ # the database cannot be reached. For networks where clients have no
510+ # route to the database of their own. Requires cache_metadata.
511+ go_sumdbs_offline: false
512+ ` ` `
513+
514+ The `go` command asks `GOPROXY` for the checksum database before contacting it
515+ directly. The proxy answers for every name listed here and fetches lookups and
516+ tiles from the database's URL, not from `upstream.go`. Unknown names get 404,
517+ so the `go` command falls back to contacting that database itself. When
518+ ` upstream.go_sumdbs` is empty, `sum.golang.org` is served; configuring any
519+ entry replaces that default.
520+
521+ Once the proxy says it serves a database, the `go` command no longer contacts
522+ that database directly. The proxy therefore only says so when it can fetch the
523+ database's latest signed tree, or has a fresh one cached (fetched within
524+ ` metadata_ttl` ). If it cannot, it answers 404 as for an unknown name, and
525+ clients go to the database themselves, as they would without the proxy. The
526+ check waits five seconds at most, and after a failed check the proxy waits a
527+ minute before it tries the database again.
528+
529+ Set `upstream.go_sumdbs_offline : true` when clients have no route to the
530+ database of their own. The proxy then keeps answering for it from the cached
531+ tree for as long as the outage lasts and serves cached lookups and tiles.
532+ That does not mean every cached module still verifies : the `go` command
533+ checks each lookup against tiles of the signed tree that came with it, the
534+ database attaches a different tree to almost every lookup, and a tile no
535+ client fetched through the proxy before cannot be served during the outage.
536+ Lookups for modules that were never cached fail as well. Builds whose
537+ ` go.sum` already lists every module do not ask the database at all and are
538+ not affected. This requires `cache_metadata`.
539+
540+ With `cache_metadata` enabled, lookups, partial hash tiles and the latest
541+ signed tree follow `metadata_ttl` and are served from cache when the database
542+ is unreachable. Complete hash tiles never change and are not revalidated once
543+ cached; a tile of the wrong size is refused and not stored. Data tiles are
544+ always forwarded and never stored : the `go` command does not fetch them, only
545+ mirrors and auditors do.
546+ Without `cache_metadata` the requests are forwarded and nothing is stored.
547+
548+ A 404 from the database keeps its text, which the `go` command prints to
549+ explain why a version is missing. With `cache_metadata` enabled the text is
550+ cut at 4 KiB; without it the response is passed on unchanged.
551+
552+ If `upstream.go` points at a module proxy that serves the checksum database
553+ itself, such as Athens, point the entry there instead, for example
554+ `sum.golang.org : " https://athens.example/sumdb/sum.golang.org" ` .
555+
498556### Debian archives
499557
500558` ` ` yaml
0 commit comments