github.com/AbhinandanKurakure/podman/v3@v3.4.10/libpod/network/ip.go (about)

     1  package network
     2  
     3  import (
     4  	"net"
     5  
     6  	"github.com/containernetworking/plugins/pkg/ip"
     7  )
     8  
     9  // CalcGatewayIP takes a network and returns the first IP in it.
    10  func CalcGatewayIP(ipn *net.IPNet) net.IP {
    11  	// taken from cni bridge plugin as it is not exported
    12  	nid := ipn.IP.Mask(ipn.Mask)
    13  	return ip.NextIP(nid)
    14  }
    15  
    16  // IsIPv6 returns if netIP is IPv6.
    17  func IsIPv6(netIP net.IP) bool {
    18  	return netIP != nil && netIP.To4() == nil
    19  }