Documentation
¶
Overview ¶
Package source chooses where magpie reads from, with a mirror as a fallback when the official address can't be reached. The official source stays first; a mirror is only asked when it fails. The Plugins page's 「国内镜像」 switch (China) puts a mirror in China first for the few addresses one serves byte for byte.
Index ¶
Constants ¶
const NPMMirror = npmMirror
NPMMirror is npm's registry in China, npmmirror.
Variables ¶
var China = func() bool { return settings.Load().ChinaMirror }
China is whether the Plugins page's 「国内镜像」 switch is on (settings.ChinaMirror); a var for tests.
Functions ¶
func Do ¶
Do sends req as usual and, when the official answer fails in a way a mirror could answer, tries its mirrors in order. A request that carries credentials is never sent to a mirror.
func DoFaithful ¶ added in v0.1.721
DoFaithful sends req to its official address, after its mirror in China when the 「国内镜像」 switch is on, but never to a fallback mirror: for a file nothing checks, which only a copy of the very file may stand in for.
func DoOfficial ¶
DoOfficial sends req to its official address alone. It is for a file whose checksum must come from the same trusted place as the file itself.
Types ¶
This section is empty.