mirror of
https://github.com/caddyserver/caddy.git
synced 2025-06-04 03:00:47 +08:00
core: Change net.IP to netip.Addr; use netip.Prefix (#4966)
Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
This commit is contained in:
@ -20,6 +20,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/netip"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -400,7 +401,7 @@ func (na NetworkAddress) isLoopback() bool {
|
||||
if na.Host == "localhost" {
|
||||
return true
|
||||
}
|
||||
if ip := net.ParseIP(na.Host); ip != nil {
|
||||
if ip, err := netip.ParseAddr(na.Host); err == nil {
|
||||
return ip.IsLoopback()
|
||||
}
|
||||
return false
|
||||
@ -410,7 +411,7 @@ func (na NetworkAddress) isWildcardInterface() bool {
|
||||
if na.Host == "" {
|
||||
return true
|
||||
}
|
||||
if ip := net.ParseIP(na.Host); ip != nil {
|
||||
if ip, err := netip.ParseAddr(na.Host); err == nil {
|
||||
return ip.IsUnspecified()
|
||||
}
|
||||
return false
|
||||
|
Reference in New Issue
Block a user