Documentation ¶
Index ¶
Constants ¶
View Source
const ( LINUX_ALL_DISTROS string = "all" LINUX_DISTROS_UBUNTU string = "ubuntu" LINUX_DISTROS_DEBIAN string = "debian" LINUX_DISTROS_CENTOS string = "centos" LINUX_DISTROS_ALPINE string = "alpine" )
View Source
const ( TYPE_LINUX_ALL_DISTROS int = 0 TYPE_LINUX_DISTROS_UBUNTU int = 1 TYPE_LINUX_DISTROS_DEBIAN int = 2 TYPE_LINUX_DISTROS_CENTOS int = 3 TYPE_LINUX_DISTROS_ALPINE int = 4 )
View Source
const ( UBUNTU_GEO_MIRROR_API = "http://mirrors.ubuntu.com/mirrors.txt" UBUNTU_BENCHMAKR_URL = "dists/jammy/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/bullseye/main/binary-amd64/Release"
)
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{
"mirrors.tuna.tsinghua.edu.cn/alpine/",
"mirrors.ustc.edu.cn/alpine/",
"mirrors.nju.edu.cn/alpine/",
"mirrors.sjtug.sjtu.edu.cn/alpine/",
"mirrors.aliyun.com/alpine/",
}
https://mirrors.alpinelinux.org/ 2022.11.19 Sites that contain protocol headers, restrict access to resources using that protocol
View Source
var BUILDIN_ALPINE_MIRRORS = GenerateBuildInList(ALPINE_OFFICIAL_MIRRORS, ALPINE_CUSTOM_MIRRORS)
View Source
var BUILDIN_CENTOS_MIRRORS = GenerateBuildInList(CENTOS_OFFICIAL_MIRRORS, CENTOS_CUSTOM_MIRRORS)
View Source
var BUILDIN_DEBIAN_MIRRORS = GenerateBuildInList(DEBIAN_OFFICIAL_MIRRORS, DEBIAN_CUSTOM_MIRRORS)
View Source
var BUILDIN_UBUNTU_MIRRORS = GenerateBuildInList(UBUNTU_OFFICIAL_MIRRORS, UBUNTU_CUSTOM_MIRRORS)
View Source
var CENTOS_CUSTOM_MIRRORS = []string{
"mirrors.aliyun.com/centos/",
}
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{
"mirrors.bfsu.edu.cn/centos/",
"mirrors.cqu.edu.cn/CentOS/",
"http://mirrors.neusoft.edu.cn/centos/",
"mirrors.nju.edu.cn/centos/",
"mirrors.huaweicloud.com/centos/",
"mirror.lzu.edu.cn/centos/",
"http://mirrors.njupt.edu.cn/centos/",
"mirrors.163.com/centos/",
"mirrors.bupt.edu.cn/centos/",
"ftp.sjtu.edu.cn/centos/",
"mirrors.tuna.tsinghua.edu.cn/centos/",
"mirrors.ustc.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{
"repo.huaweicloud.com/debian/",
"mirrors.cloud.tencent.com/debian/",
"mirrors.hit.edu.cn/debian/",
"mirrors.aliyun.com/debian/",
"mirror.lzu.edu.cn/debian/",
"mirror.nju.edu.cn/debian/",
}
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.cn.debian.org/debian/",
"mirror.bjtu.edu.cn/debian/",
"mirrors.163.com/debian/",
"mirrors.bfsu.edu.cn/debian/",
"mirrors.huaweicloud.com/debian/",
"http://mirrors.neusoft.edu.cn/debian/",
"mirrors.tuna.tsinghua.edu.cn/debian/",
"mirrors.ustc.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 UBUNTU_CUSTOM_MIRRORS = []string{
"mirrors.163.com/ubuntu/",
}
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{
"mirrors.cn99.com/ubuntu/",
"mirrors.tuna.tsinghua.edu.cn/ubuntu/",
"mirrors.cnnic.cn/ubuntu/",
"mirror.bjtu.edu.cn/ubuntu/",
"mirrors.cqu.edu.cn/ubuntu/",
"http://mirrors.skyshe.cn/ubuntu/",
"mirrors.yun-idc.com/ubuntu/",
"http://mirror.dlut.edu.cn/ubuntu/",
"mirrors.xjtu.edu.cn/ubuntu/",
"mirrors.huaweicloud.com/repository/ubuntu/",
"mirrors.bupt.edu.cn/ubuntu/",
"mirrors.hit.edu.cn/ubuntu/",
"http://mirrors.sohu.com/ubuntu/",
"mirror.nju.edu.cn/ubuntu/",
"mirrors.bfsu.edu.cn/ubuntu/",
"mirror.lzu.edu.cn/ubuntu/",
"mirrors.aliyun.com/ubuntu/",
"ftp.sjtu.edu.cn/ubuntu/",
"mirrors.njupt.edu.cn/ubuntu/",
"mirrors.cloud.tencent.com/ubuntu/",
"http://mirrors.dgut.edu.cn/ubuntu/",
"mirrors.ustc.edu.cn/ubuntu/",
"mirrors.sdu.edu.cn/ubuntu/",
"http://cn.archive.ubuntu.com/ubuntu/",
}
http://mirrors.ubuntu.com/mirrors.txt 2022.11.19 Sites that contain protocol headers, restrict access to resources using that protocol
Functions ¶
func GenerateAliasFromURL ¶
Types ¶
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
Click to show internal directories.
Click to hide internal directories.