public static Endpoint fromEnode(final EnodeURL enode) {
    Optional<Integer> discoveryPort = enode.getDiscoveryPort();

    if (discoveryPort.isEmpty()) {
      int defaultPort = EnodeURLImpl.DEFAULT_LISTENING_PORT;
      LOG.debug("Discovery disabled for enode {}. Using default port {}.", enode, defaultPort);
      return new Endpoint(enode.getIp().getHostAddress(), defaultPort, Optional.empty());
    }

    final Optional<Integer> listeningPort = enode.getListeningPort();
    return new Endpoint(enode.getIp().getHostAddress(), discoveryPort.get(), listeningPort);
  }
Encapsulates the network coordinates of a {@link DiscoveryPeer} as well as serialization logic
used in various Discovery messages.
ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/Endpoint.java