define

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LINUX_ALL_DISTROS             string = "all"
	LINUX_DISTROS_UBUNTU          string = "ubuntu"
	LINUX_DISTROS_UBUNTU_PORTS    string = "ubuntu-ports"
	LINUX_DISTROS_DEBIAN          string = "debian"
	LINUX_DISTROS_DEBIAN_SECURITY string = "debian-security"
	LINUX_DISTROS_CENTOS          string = "centos"
	LINUX_DISTROS_ROCKY           string = "rocky"
	LINUX_DISTROS_FEDORA          string = "fedora"
	LINUX_DISTROS_ALPINE          string = "alpine"
)
View Source
const (
	TYPE_LINUX_ALL_DISTROS             int = 0
	TYPE_LINUX_DISTROS_UBUNTU          int = 1
	TYPE_LINUX_DISTROS_UBUNTU_PORTS    int = 2
	TYPE_LINUX_DISTROS_DEBIAN          int = 3
	TYPE_LINUX_DISTROS_DEBIAN_SECURITY int = 4
	TYPE_LINUX_DISTROS_CENTOS          int = 5
	TYPE_LINUX_DISTROS_ROCKY           int = 7
	TYPE_LINUX_DISTROS_FEDORA          int = 8
	TYPE_LINUX_DISTROS_ALPINE          int = 9
)
View Source
const (
	UBUNTU_PORTS_GEO_MIRROR_API = "http://mirrors.ubuntu.com/mirrors.txt"
	UBUNTU_PORTS_BENCHMAKR_URL  = "dists/noble/InRelease/Release"
)
View Source
const (
	UBUNTU_GEO_MIRROR_API = "http://mirrors.ubuntu.com/mirrors.txt"
	UBUNTU_BENCHMAKR_URL  = "dists/noble/main/binary-amd64/Release"
)
View Source
const ALPINE_BENCHMAKR_URL = "MIRRORS.txt"
View Source
const CENTOS_BENCHMAKR_URL = "TIME"
View Source
const (
	DEBIAN_BENCHMAKR_URL = "dists/bookworm/main/binary-amd64/Release"
)
View Source
const (
	DEBIAN_SECURITY_BENCHMARK_URL = "dists/bookworm-security/main/binary-amd64/Release"
)
View Source
const FEDORA_BENCHMAKR_URL = "TIME"
View Source
const ROCKY_BENCHMAKR_URL = "TIME"

Variables

View Source
var ALPINE_CUSTOM_MIRRORS = []string{}
View Source
var ALPINE_DEFAULT_CACHE_RULES = []Rule{
	{Pattern: regexp.MustCompile(`APKINDEX.tar.gz$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_ALPINE},
	{Pattern: regexp.MustCompile(`tar.gz$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_ALPINE},
	{Pattern: regexp.MustCompile(`apk$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_ALPINE},
	{Pattern: regexp.MustCompile(`.*`), CacheControl: `max-age=100000`, Rewrite: true, OS: TYPE_LINUX_DISTROS_ALPINE},
}
View Source
var ALPINE_HOST_PATTERN = regexp.MustCompile(`/alpine/(.+)$`)
View Source
var ALPINE_OFFICIAL_MIRRORS = []string{
	"http://dl-cdn.alpinelinux.org/alpine/",
	"http://mirrors.ircam.fr/pub/alpine/",
	"mirrors.tuna.tsinghua.edu.cn/alpine/",
}

https://mirrors.alpinelinux.org/ 2022.11.19 Sites that contain protocol headers, restrict access to resources using that protocol

View Source
var CENTOS_CUSTOM_MIRRORS = []string{}
View Source
var CENTOS_DEFAULT_CACHE_RULES = []Rule{
	{Pattern: regexp.MustCompile(`repomd.xml$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_CENTOS},
	{Pattern: regexp.MustCompile(`filelist.gz$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_CENTOS},
	{Pattern: regexp.MustCompile(`dir_sizes$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_CENTOS},
	{Pattern: regexp.MustCompile(`TIME$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_CENTOS},
	{Pattern: regexp.MustCompile(`timestamp.txt$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_CENTOS},
	{Pattern: regexp.MustCompile(`.*`), CacheControl: `max-age=100000`, Rewrite: true, OS: TYPE_LINUX_DISTROS_CENTOS},
}
View Source
var CENTOS_HOST_PATTERN = regexp.MustCompile(`/centos/(.+)$`)
View Source
var CENTOS_OFFICIAL_MIRRORS = []string{
	"http://mirror.centos.org/centos/",
	"http://centos.mirrors.proxad.net/centos/",
	"http://centos.mirrors.ovh.net/ftp.centos.org/",
	"http://ftp.rezopole.net/centos/",
	"http://mirror.ibcp.fr/pub/centos/",
	"mirrors.tuna.tsinghua.edu.cn/centos/",
}

https://www.centos.org/download/mirrors/ 2022.11.19 Sites that contain protocol headers, restrict access to resources using that protocol

View Source
var DEBIAN_CUSTOM_MIRRORS = []string{}
View Source
var DEBIAN_DEFAULT_CACHE_RULES = []Rule{
	{Pattern: regexp.MustCompile(`deb$`), CacheControl: `max-age=100000`, Rewrite: true, OS: TYPE_LINUX_DISTROS_DEBIAN},
	{Pattern: regexp.MustCompile(`udeb$`), CacheControl: `max-age=100000`, Rewrite: true, OS: TYPE_LINUX_DISTROS_DEBIAN},
	{Pattern: regexp.MustCompile(`InRelease$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_DEBIAN},
	{Pattern: regexp.MustCompile(`DiffIndex$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_DEBIAN},
	{Pattern: regexp.MustCompile(`PackagesIndex$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_DEBIAN},
	{Pattern: regexp.MustCompile(`Packages\.(bz2|gz|lzma)$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_DEBIAN},
	{Pattern: regexp.MustCompile(`SourcesIndex$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_DEBIAN},
	{Pattern: regexp.MustCompile(`Sources\.(bz2|gz|lzma)$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_DEBIAN},
	{Pattern: regexp.MustCompile(`Release(\.gpg)?$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_DEBIAN},
	{Pattern: regexp.MustCompile(`Translation-(en|fr)\.(gz|bz2|bzip2|lzma)$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_DEBIAN},

	{Pattern: regexp.MustCompile(`/by-hash/`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_DEBIAN},
}
View Source
var DEBIAN_HOST_PATTERN = regexp.MustCompile(`/debian/(.+)$`)
View Source
var DEBIAN_OFFICIAL_MIRRORS = []string{
	"http://ftp.fr.debian.org/debian/",
	"http://deb.debian.org/debian/",
	"http://ftp.rezopole.net/debian/",
	"mirrors.tuna.tsinghua.edu.cn/debian/",
}

https://www.debian.org/mirror/list 2022.11.19 Sites that contain protocol headers, restrict access to resources using that protocol

View Source
var DEBIAN_SECURITY_CUSTOM_MIRRORS = []string{}
View Source
var DEBIAN_SECURITY_DEFAULT_CACHE_RULES = []Rule{
	{Pattern: regexp.MustCompile(`deb$`), CacheControl: `max-age=100000`, Rewrite: true, OS: TYPE_LINUX_DISTROS_DEBIAN_SECURITY},
	{Pattern: regexp.MustCompile(`udeb$`), CacheControl: `max-age=100000`, Rewrite: true, OS: TYPE_LINUX_DISTROS_DEBIAN_SECURITY},
	{Pattern: regexp.MustCompile(`InRelease$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_DEBIAN_SECURITY},
	{Pattern: regexp.MustCompile(`DiffIndex$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_DEBIAN_SECURITY},
	{Pattern: regexp.MustCompile(`PackagesIndex$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_DEBIAN_SECURITY},
	{Pattern: regexp.MustCompile(`Packages\.(bz2|gz|lzma)$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_DEBIAN_SECURITY},
	{Pattern: regexp.MustCompile(`SourcesIndex$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_DEBIAN_SECURITY},
	{Pattern: regexp.MustCompile(`Sources\.(bz2|gz|lzma)$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_DEBIAN_SECURITY},
	{Pattern: regexp.MustCompile(`Release(\.gpg)?$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_DEBIAN_SECURITY},
	{Pattern: regexp.MustCompile(`Translation-(en|fr)\.(gz|bz2|bzip2|lzma)$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_DEBIAN_SECURITY},
	{Pattern: regexp.MustCompile(`/by-hash/`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_DEBIAN_SECURITY},
}
View Source
var DEBIAN_SECURITY_HOST_PATTERN = regexp.MustCompile(`/debian-security/(.+)$`)
View Source
var DEBIAN_SECURITY_OFFICIAL_MIRRORS = []string{
	"http://ftp.fr.debian.org/debian-security/",
	"http://deb.debian.org/debian-security/",
	"http://ftp.rezopole.net/debian-security/",
	"mirrors.tuna.tsinghua.edu.cn/debian-security/",
}
View Source
var FEDORA_CUSTOM_MIRRORS = []string{}
View Source
var FEDORA_DEFAULT_CACHE_RULES = []Rule{
	{Pattern: regexp.MustCompile(`repodata/.*\.(xml|xml.gz|xml.xz|json)$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_FEDORA},
	{Pattern: regexp.MustCompile(`repodata/.*\.(zck|zst)$`), CacheControl: ``, Rewrite: false, OS: TYPE_LINUX_DISTROS_FEDORA},
	{Pattern: regexp.MustCompile(`Packages/.*\.rpm$`), CacheControl: `max-age=86400`, Rewrite: true, OS: TYPE_LINUX_DISTROS_FEDORA},
	{Pattern: regexp.MustCompile(`.*timestamp.txt$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_FEDORA},
	{Pattern: regexp.MustCompile(`.*`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_FEDORA},
}
View Source
var FEDORA_HOST_PATTERN = regexp.MustCompile(`/fedora/(.+)$`)
View Source
var FEDORA_OFFICIAL_MIRRORS = []string{
	"https://download.fedoraproject.org/pub/fedora/linux/",
	"https://mirror.ufs.ac.za/fedora/",
	"http://ftp.nluug.nl/pub/os/Linux/distr/fedora/",
}

https://mirrors.fedoraproject.org/ 2022.11.19 Official Fedora mirrors

View Source
var ROCKY_CUSTOM_MIRRORS = []string{}
View Source
var ROCKY_DEFAULT_CACHE_RULES = []Rule{
	{Pattern: regexp.MustCompile(`repomd.xml$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_ROCKY},
	{Pattern: regexp.MustCompile(`filelist.gz$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_ROCKY},
	{Pattern: regexp.MustCompile(`dir_sizes$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_ROCKY},
	{Pattern: regexp.MustCompile(`TIME$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_ROCKY},
	{Pattern: regexp.MustCompile(`timestamp.txt$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_ROCKY},
	{Pattern: regexp.MustCompile(`.*`), CacheControl: `max-age=100000`, Rewrite: true, OS: TYPE_LINUX_DISTROS_ROCKY},
}
View Source
var ROCKY_HOST_PATTERN = regexp.MustCompile(`/rocky/(.+)$`)
View Source
var ROCKY_OFFICIAL_MIRRORS = []string{
	"https://dl.rockylinux.org/pub/rocky/",
	"https://rockylinux.mirrors.ovh.net/",
}

https://mirrors.rockylinux.org/ 2022.11.19 Official Rocky Linux mirrors

View Source
var UBUNTU_CUSTOM_MIRRORS = []string{}
View Source
var UBUNTU_DEFAULT_CACHE_RULES = []Rule{
	{Pattern: regexp.MustCompile(`deb$`), CacheControl: `max-age=100000`, Rewrite: true, OS: TYPE_LINUX_DISTROS_UBUNTU},
	{Pattern: regexp.MustCompile(`udeb$`), CacheControl: `max-age=100000`, Rewrite: true, OS: TYPE_LINUX_DISTROS_UBUNTU},
	{Pattern: regexp.MustCompile(`InRelease$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_UBUNTU},
	{Pattern: regexp.MustCompile(`DiffIndex$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_UBUNTU},
	{Pattern: regexp.MustCompile(`PackagesIndex$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_UBUNTU},
	{Pattern: regexp.MustCompile(`Packages\.(bz2|gz|lzma)$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_UBUNTU},
	{Pattern: regexp.MustCompile(`SourcesIndex$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_UBUNTU},
	{Pattern: regexp.MustCompile(`Sources\.(bz2|gz|lzma)$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_UBUNTU},
	{Pattern: regexp.MustCompile(`Release(\.gpg)?$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_UBUNTU},
	{Pattern: regexp.MustCompile(`Translation-(en|fr)\.(gz|bz2|bzip2|lzma)$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_UBUNTU},

	{Pattern: regexp.MustCompile(`\/by-hash\/`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_UBUNTU},
}
View Source
var UBUNTU_HOST_PATTERN = regexp.MustCompile(`/ubuntu/(.+)$`)
View Source
var UBUNTU_OFFICIAL_MIRRORS = []string{
	"http://fr.archive.ubuntu.com/ubuntu/",
	"http://mirrors.ircam.fr/pub/ubuntu/",
	"mirrors.tuna.tsinghua.edu.cn/ubuntu/",
}

http://mirrors.ubuntu.com/mirrors.txt 2022.11.19 Sites that contain protocol headers, restrict access to resources using that protocol

View Source
var UBUNTU_PORTS_CUSTOM_MIRRORS = []string{}
View Source
var UBUNTU_PORTS_DEFAULT_CACHE_RULES = []Rule{
	{Pattern: regexp.MustCompile(`deb$`), CacheControl: `max-age=100000`, Rewrite: true, OS: TYPE_LINUX_DISTROS_UBUNTU_PORTS},
	{Pattern: regexp.MustCompile(`udeb$`), CacheControl: `max-age=100000`, Rewrite: true, OS: TYPE_LINUX_DISTROS_UBUNTU_PORTS},
	{Pattern: regexp.MustCompile(`InRelease$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_UBUNTU_PORTS},
	{Pattern: regexp.MustCompile(`DiffIndex$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_UBUNTU_PORTS},
	{Pattern: regexp.MustCompile(`PackagesIndex$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_UBUNTU_PORTS},
	{Pattern: regexp.MustCompile(`Packages\.(bz2|gz|lzma)$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_UBUNTU_PORTS},
	{Pattern: regexp.MustCompile(`SourcesIndex$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_UBUNTU_PORTS},
	{Pattern: regexp.MustCompile(`Sources\.(bz2|gz|lzma)$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_UBUNTU_PORTS},
	{Pattern: regexp.MustCompile(`Release(\.gpg)?$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_UBUNTU_PORTS},
	{Pattern: regexp.MustCompile(`Translation-(en|fr)\.(gz|bz2|bzip2|lzma)$`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_UBUNTU_PORTS},

	{Pattern: regexp.MustCompile(`\/by-hash\/`), CacheControl: `max-age=3600`, Rewrite: true, OS: TYPE_LINUX_DISTROS_UBUNTU_PORTS},
}
View Source
var UBUNTU_PORTS_HOST_PATTERN = regexp.MustCompile(`/ubuntu-ports/(.+)$`)
View Source
var UBUNTU_PORTS_OFFICIAL_MIRRORS = []string{
	"http://mirrors.ircam.fr/pub/ubuntu-ports/",
	"http://fr.archive.ubuntu.com/ubuntu-ports/",
	"mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/",
}

http://mirrors.ubuntu.com/mirrors.txt 2022.11.19 Sites that contain protocol headers, restrict access to resources using that protocol

Functions

func GenerateAliasFromURL

func GenerateAliasFromURL(url string) string

Types

type Rule

type Rule struct {
	OS           int
	Pattern      *regexp.Regexp
	CacheControl string
	Rewrite      bool
}

func (*Rule) String

func (r *Rule) String() string

type UrlWithAlias

type UrlWithAlias struct {
	URL       string
	Alias     string
	Http      bool
	Https     bool
	Official  bool
	Bandwidth int64
}

func GenerateBuildInList

func GenerateBuildInList(officialList []string, customList []string) (mirrors []UrlWithAlias)

func GenerateBuildInMirorItem

func GenerateBuildInMirorItem(url string, official bool) UrlWithAlias

Jump to

Keyboard shortcuts

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