Bump to build with go1.18 (#19120 et al) (#19127)

Backport #19120 
Backport #19099 
Backport #18874 
Backport #18420
Backport #19128
Backport #18270 

Bump to build with go1.18

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Jelle Hulter <jellehulter@gmail.com>
This commit is contained in:
techknowlogick 2022-03-19 13:46:47 -04:00 committed by GitHub
parent e6d46eeb55
commit f9ea4ab69a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 1052 additions and 337 deletions

View file

@ -8,8 +8,6 @@ import (
"net"
"path/filepath"
"strings"
"code.gitea.io/gitea/modules/util"
)
// HostMatchList is used to check if a host or IP is in a list.
@ -104,11 +102,11 @@ func (hl *HostMatchList) checkIP(ip net.IP) bool {
for _, builtin := range hl.builtins {
switch builtin {
case MatchBuiltinExternal:
if ip.IsGlobalUnicast() && !util.IsIPPrivate(ip) {
if ip.IsGlobalUnicast() && !ip.IsPrivate() {
return true
}
case MatchBuiltinPrivate:
if util.IsIPPrivate(ip) {
if ip.IsPrivate() {
return true
}
case MatchBuiltinLoopback: