use of org.hyperledger.besu.ethstats.authentication.NodeInfo in project besu by hyperledger.
the class EthStatsService method sendHello.
/**
* Sends a hello request to the ethstats server in order to log in.
*/
private void sendHello() {
try {
final Optional<Integer> port = enodeURL.getListeningPort();
final Optional<BigInteger> chainId = genesisConfigOptions.getChainId();
if (port.isPresent() && chainId.isPresent()) {
final String os = PlatformDetector.getOSType();
final String arch = PlatformDetector.getArch();
final NodeInfo nodeInfo = ImmutableNodeInfo.of(netstatsUrl.getNodeName(), clientVersion, String.valueOf(port.get()), chainId.get().toString(), protocolManager.getSupportedCapabilities().toString(), "No", os, arch, "0.1.1", true, netstatsUrl.getContact());
final EthStatsRequest hello = new EthStatsRequest(HELLO, ImmutableAuthenticationData.of(enodeURL.getNodeId().toHexString(), nodeInfo, netstatsUrl.getSecret()));
sendMessage(webSocket, hello, isSucceeded -> {
if (!isSucceeded) {
retryConnect();
}
});
} else {
throw new NoSuchElementException();
}
} catch (NoSuchElementException e) {
LOG.error("Failed to find required parameters for ethstats request : {}", e.getMessage());
retryConnect();
}
}
Aggregations