use of org.aion.zero.impl.config.CfgNet in project aion by aionnetwork.
the class ApiWeb3Aion method configNet.
// TODO: we can refactor these in the future to be in
// their respective classes, for now put the toJson here
private static JSONObject configNet() {
CfgNet config = CfgAion.inst().getNet();
JSONObject obj = new JSONObject();
// begin base.net.p2p
CfgNetP2p configP2p = config.getP2p();
JSONObject p2p = new JSONObject();
p2p.put("ip", configP2p.getIp());
p2p.put("port", configP2p.getPort());
p2p.put("discover", configP2p.getDiscover());
p2p.put("errorTolerance", configP2p.getErrorTolerance());
p2p.put("maxActiveNodes", configP2p.getMaxActiveNodes());
p2p.put("maxTempNodes", configP2p.getMaxTempNodes());
p2p.put("clusterNodeMode", configP2p.inClusterNodeMode());
p2p.put("syncOnlyMode", configP2p.inSyncOnlyMode());
// end
obj.put("p2p", p2p);
// begin base.net.nodes[]
JSONArray nodeArray = new JSONArray();
for (String n : config.getNodes()) {
nodeArray.put(n);
}
// end
obj.put("nodes", nodeArray);
// begin base
obj.put("id", config.getId());
// end
return obj;
}
Aggregations