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
|
var ip net.IP
|
||||||
switch ifaceAddressValue := ifaceAddress.(type) {
|
switch ifaceAddressValue := ifaceAddress.(type) {
|
||||||
case *net.IPAddr:
|
case *net.IPAddr:
|
||||||
ip, addrok = ifaceAddressValue.IP, true
|
ip, addrok, netwok = ifaceAddressValue.IP, true, true
|
||||||
netwok = len(ip) == net.IPv4len && caddy.IsIPv4Network(lnNetw) || len(ip) == net.IPv6len && caddy.IsIPv6Network(lnNetw)
|
|
||||||
case *net.IPNet:
|
case *net.IPNet:
|
||||||
ip, addrok = ifaceAddressValue.IP, true
|
ip, addrok, netwok = ifaceAddressValue.IP, true, true
|
||||||
netwok = len(ip) == net.IPv4len && caddy.IsIPv4Network(lnNetw) || len(ip) == net.IPv6len && caddy.IsIPv6Network(lnNetw)
|
|
||||||
case *net.TCPAddr:
|
case *net.TCPAddr:
|
||||||
ip, addrok, netwok = ifaceAddressValue.IP, true, caddy.IsTCPNetwork(lnNetw)
|
ip, addrok, netwok = ifaceAddressValue.IP, true, caddy.IsTCPNetwork(lnNetw)
|
||||||
case *net.UDPAddr:
|
case *net.UDPAddr:
|
||||||
ip, addrok, netwok = ifaceAddressValue.IP, true, caddy.IsUDPNetwork(lnNetw)
|
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 addrok {
|
||||||
if netwok {
|
if netwok {
|
||||||
lnIfaceAddresses = append(lnIfaceAddresses, ip.String())
|
lnIfaceAddresses = append(lnIfaceAddresses, ip.String())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue