mirror of
https://github.com/caddyserver/caddy.git
synced 2025-12-08 06:09:53 +00:00
also check addr len
This commit is contained in:
parent
2e5e165719
commit
dd230be8aa
1 changed files with 5 additions and 4 deletions
|
|
@ -362,16 +362,17 @@ func (st *ServerType) listenersForServerBlockAddress(sblock serverBlock, addr Ad
|
|||
var ip net.IP
|
||||
switch ifaceAddressValue := ifaceAddress.(type) {
|
||||
case *net.IPAddr:
|
||||
ip, addrok = ifaceAddressValue.IP, true
|
||||
netwok = len(ip) == net.IPv4len && caddy.IsIPv4Network(lnNetw) || len(ip) == net.IPv6len && caddy.IsIPv6Network(lnNetw)
|
||||
ip, addrok, netwok = ifaceAddressValue.IP, true, true
|
||||
case *net.IPNet:
|
||||
ip, addrok = ifaceAddressValue.IP, true
|
||||
netwok = len(ip) == net.IPv4len && caddy.IsIPv4Network(lnNetw) || len(ip) == net.IPv6len && caddy.IsIPv6Network(lnNetw)
|
||||
ip, addrok, netwok = ifaceAddressValue.IP, true, true
|
||||
case *net.TCPAddr:
|
||||
ip, addrok, netwok = ifaceAddressValue.IP, true, caddy.IsTCPNetwork(lnNetw)
|
||||
case *net.UDPAddr:
|
||||
ip, addrok, netwok = ifaceAddressValue.IP, true, caddy.IsUDPNetwork(lnNetw)
|
||||
}
|
||||
if netwok {
|
||||
netwok = len(ip) == net.IPv4len && caddy.IsIPv4Network(lnNetw) || len(ip) == net.IPv6len && caddy.IsIPv6Network(lnNetw)
|
||||
}
|
||||
if addrok {
|
||||
if netwok {
|
||||
lnIfaceAddresses = append(lnIfaceAddresses, ip.String())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue