private void inspectDeviceRecursive(final RemoteDevice device, final Set<String> serviceTypes) {
    for (RemoteService service : device.getServices()) {
      String serviceType = service.getServiceType().getType();
      if (serviceTypes.contains(serviceType)) {
        synchronized (this) {
          // log a warning if we detect a second WANIPConnection service
          CompletableFuture<RemoteService> existingFuture = recognizedServices.get(serviceType);
          if (existingFuture.isDone()) {
            LOG.warn(
                "Detected multiple WANIPConnection services on network. This may interfere with NAT circumvention.");
            continue;
          }
          existingFuture.complete(service);
        }
      }
    }
    for (RemoteDevice subDevice : device.getEmbeddedDevices()) {
      inspectDeviceRecursive(subDevice, serviceTypes);
    }
  }
Recursively crawls the given device to look for specific services.

@param device is the device to inspect for desired services.
@param serviceTypes is a set of service types to look for.
nat/src/main/java/org/hyperledger/besu/nat/upnp/UpnpNatManager.java