code: func ipFromInterface(iface string) (*net.UDPAddr, error) {
  	ief, err := net.InterfaceByName(iface)
  	if err != nil {
  		return nil, err
  	}
  
  	addrs, err := ief.Addrs()
  	if err == nil && len(addrs) <= 0 {
  		err = fmt.Errorf("no address associated with interface %s", iface)
  	}
  	if err != nil {
  		return nil, err
  	}
  
  	// Validate that one of the addrs is a valid network IP address.
  	for _, addr := range addrs {
  		switch ip := addr.(type) {
  		case *net.IPNet:
  			// Verify that the DefaultMask for the address we want to use exists.
  			if ip.IP.DefaultMask() != nil {
  				return &net.UDPAddr{
  					IP: ip.IP,
  				}, nil
  			}
  		}
  	}
  	return nil, fmt.Errorf("no address associated with interface %s", iface)
  }
docs: ////////////////////////////////////////////////////////////////////////////////
  // ipFromInterface returns a `*net.UDPAddr` from a network interface name.