code: func GetIfaceAddr(name string) (net.Addr, []net.Addr, error) {
  	iface, err := net.InterfaceByName(name)
  	if err != nil {
  		return nil, nil, err
  	}
  	addrs, err := iface.Addrs()
  	if err != nil {
  		return nil, nil, err
  	}
  	var addrs4 []net.Addr
  	var addrs6 []net.Addr
  	for _, addr := range addrs {
  		ip := (addr.(*net.IPNet)).IP
  		if ip4 := ip.To4(); ip4 != nil {
  			addrs4 = append(addrs4, addr)
  		} else if ip6 := ip.To16(); len(ip6) == net.IPv6len {
  			addrs6 = append(addrs6, addr)
  		}
  	}
  	switch {
  	case len(addrs4) == 0:
  		return nil, nil, fmt.Errorf("Interface %v has no IPv4 addresses", name)
  	case len(addrs4) > 1:
  		fmt.Printf("Interface %v has more than 1 IPv4 address. Defaulting to using %v\n",
  			name, (addrs4[0].(*net.IPNet)).IP)
  	}
  	return addrs4[0], addrs6, nil
  }
docs: // GetIfaceAddr returns the first IPv4 address and slice of IPv6 addresses for the specified network interface