code: func buildAndSelectGuestIPs(ctx context.Context, vm *object.VirtualMachine) ([]string, error) {
  	logger.Printf("[DEBUG] Discovering addresses for virtual machine %q", vm.Name())
  	var addrs []string
  
  	props, err := virtualMachineProperties(ctx, vm, []string{"guest.net"})
  	if err != nil {
  		return nil, fmt.Errorf("cannot fetch properties for VM %q: %s", vm.Name(), err)
  	}
  
  	if props.Guest == nil || props.Guest.Net == nil {
  		logger.Printf("[WARN] No networking stack information available for %q or VMware tools not running", vm.Name())
  		return nil, nil
  	}
  
  	// Now fetch all IP addresses, checking at the same time to see if the IP
  	// address is eligible to be a primary IP address.
  	for _, n := range props.Guest.Net {
  		if n.IpConfig != nil {
  			for _, addr := range n.IpConfig.IpAddress {
  				if skipIPAddr(net.ParseIP(addr.IpAddress)) {
  					continue
  				}
  				addrs = append(addrs, addr.IpAddress)
  			}
  		}
  	}
  
  	logger.Printf("[INFO] Discovered IP addresses for virtual machine %q: %s", vm.Name(), strings.Join(addrs, ","))
  	return addrs, nil
  }
docs: // buildAndSelectGuestIPs builds a list of IP addresses known to VMware tools,
  // skipping local and auto-configuration addresses.
  //
  // The builder is non-discriminate and is only deterministic to the order that
  // it discovers addresses in VMware tools.