mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-22 20:19:21 +00:00
show available monero nodes in network settings
This commit is contained in:
parent
1f385328de
commit
dc8d854709
22 changed files with 100 additions and 95 deletions
|
@ -40,7 +40,6 @@ import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||||
|
|
||||||
|
@ -64,7 +63,6 @@ import monero.common.MoneroRpcConnection;
|
||||||
import monero.common.TaskLooper;
|
import monero.common.TaskLooper;
|
||||||
import monero.daemon.MoneroDaemonRpc;
|
import monero.daemon.MoneroDaemonRpc;
|
||||||
import monero.daemon.model.MoneroDaemonInfo;
|
import monero.daemon.model.MoneroDaemonInfo;
|
||||||
import monero.daemon.model.MoneroPeer;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Singleton
|
@Singleton
|
||||||
|
@ -85,9 +83,9 @@ public final class XmrConnectionService {
|
||||||
private final XmrLocalNode xmrLocalNode;
|
private final XmrLocalNode xmrLocalNode;
|
||||||
private final MoneroConnectionManager connectionManager;
|
private final MoneroConnectionManager connectionManager;
|
||||||
private final EncryptedConnectionList connectionList;
|
private final EncryptedConnectionList connectionList;
|
||||||
private final ObjectProperty<List<MoneroPeer>> peers = new SimpleObjectProperty<>();
|
private final ObjectProperty<List<MoneroRpcConnection>> connections = new SimpleObjectProperty<>();
|
||||||
|
private final IntegerProperty numConnections = new SimpleIntegerProperty(0);
|
||||||
private final ObjectProperty<MoneroRpcConnection> connectionProperty = new SimpleObjectProperty<>();
|
private final ObjectProperty<MoneroRpcConnection> connectionProperty = new SimpleObjectProperty<>();
|
||||||
private final IntegerProperty numPeers = new SimpleIntegerProperty(0);
|
|
||||||
private final LongProperty chainHeight = new SimpleLongProperty(0);
|
private final LongProperty chainHeight = new SimpleLongProperty(0);
|
||||||
private final DownloadListener downloadListener = new DownloadListener();
|
private final DownloadListener downloadListener = new DownloadListener();
|
||||||
@Getter
|
@Getter
|
||||||
|
@ -390,12 +388,12 @@ public final class XmrConnectionService {
|
||||||
|
|
||||||
// ----------------------------- APP METHODS ------------------------------
|
// ----------------------------- APP METHODS ------------------------------
|
||||||
|
|
||||||
public ReadOnlyIntegerProperty numPeersProperty() {
|
public ReadOnlyIntegerProperty numConnectionsProperty() {
|
||||||
return numPeers;
|
return numConnections;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReadOnlyObjectProperty<List<MoneroPeer>> peerConnectionsProperty() {
|
public ReadOnlyObjectProperty<List<MoneroRpcConnection>> connectionsProperty() {
|
||||||
return peers;
|
return connections;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReadOnlyObjectProperty<MoneroRpcConnection> connectionProperty() {
|
public ReadOnlyObjectProperty<MoneroRpcConnection> connectionProperty() {
|
||||||
|
@ -403,7 +401,7 @@ public final class XmrConnectionService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasSufficientPeersForBroadcast() {
|
public boolean hasSufficientPeersForBroadcast() {
|
||||||
return numPeers.get() >= getMinBroadcastConnections();
|
return numConnections.get() >= getMinBroadcastConnections();
|
||||||
}
|
}
|
||||||
|
|
||||||
public LongProperty chainHeightProperty() {
|
public LongProperty chainHeightProperty() {
|
||||||
|
@ -782,16 +780,15 @@ public final class XmrConnectionService {
|
||||||
downloadListener.progress(percent, blocksLeft, null);
|
downloadListener.progress(percent, blocksLeft, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set peer connections
|
// set available connections
|
||||||
// TODO: peers often uknown due to restricted RPC call, skipping call to get peer connections
|
List<MoneroRpcConnection> availableConnections = new ArrayList<>();
|
||||||
// try {
|
for (MoneroRpcConnection connection : connectionManager.getConnections()) {
|
||||||
// peers.set(getOnlinePeers());
|
if (Boolean.TRUE.equals(connection.isOnline()) && Boolean.TRUE.equals(connection.isAuthenticated())) {
|
||||||
// } catch (Exception err) {
|
availableConnections.add(connection);
|
||||||
// // TODO: peers unknown due to restricted RPC call
|
}
|
||||||
// }
|
}
|
||||||
// numPeers.set(peers.get().size());
|
connections.set(availableConnections);
|
||||||
numPeers.set(lastInfo.getNumOutgoingConnections() + lastInfo.getNumIncomingConnections());
|
numConnections.set(availableConnections.size());
|
||||||
peers.set(new ArrayList<MoneroPeer>());
|
|
||||||
|
|
||||||
// notify update
|
// notify update
|
||||||
numUpdates.set(numUpdates.get() + 1);
|
numUpdates.set(numUpdates.get() + 1);
|
||||||
|
@ -821,12 +818,6 @@ public final class XmrConnectionService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<MoneroPeer> getOnlinePeers() {
|
|
||||||
return daemon.getPeers().stream()
|
|
||||||
.filter(peer -> peer.isOnline())
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isFixedConnection() {
|
private boolean isFixedConnection() {
|
||||||
return !"".equals(config.xmrNode) || preferences.getMoneroNodesOption() == XmrNodes.MoneroNodesOption.CUSTOM;
|
return !"".equals(config.xmrNode) || preferences.getMoneroNodesOption() == XmrNodes.MoneroNodesOption.CUSTOM;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class AppStartupState {
|
||||||
isWalletSynced.set(true);
|
isWalletSynced.set(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
xmrConnectionService.numPeersProperty().addListener((observable, oldValue, newValue) -> {
|
xmrConnectionService.numConnectionsProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
if (xmrConnectionService.hasSufficientPeersForBroadcast())
|
if (xmrConnectionService.hasSufficientPeersForBroadcast())
|
||||||
hasSufficientPeersForBroadcast.set(true);
|
hasSufficientPeersForBroadcast.set(true);
|
||||||
});
|
});
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class P2PNetworkSetup {
|
||||||
BooleanProperty initialP2PNetworkDataReceived = new SimpleBooleanProperty();
|
BooleanProperty initialP2PNetworkDataReceived = new SimpleBooleanProperty();
|
||||||
|
|
||||||
p2PNetworkInfoBinding = EasyBind.combine(bootstrapState, bootstrapWarning, p2PService.getNumConnectedPeers(),
|
p2PNetworkInfoBinding = EasyBind.combine(bootstrapState, bootstrapWarning, p2PService.getNumConnectedPeers(),
|
||||||
xmrConnectionService.numPeersProperty(), hiddenServicePublished, initialP2PNetworkDataReceived,
|
xmrConnectionService.numConnectionsProperty(), hiddenServicePublished, initialP2PNetworkDataReceived,
|
||||||
(state, warning, numP2pPeers, numXmrPeers, hiddenService, dataReceived) -> {
|
(state, warning, numP2pPeers, numXmrPeers, hiddenService, dataReceived) -> {
|
||||||
String result;
|
String result;
|
||||||
int p2pPeers = (int) numP2pPeers;
|
int p2pPeers = (int) numP2pPeers;
|
||||||
|
|
|
@ -1315,6 +1315,8 @@ settings.net.p2pHeader=Haveno network
|
||||||
settings.net.onionAddressLabel=My onion address
|
settings.net.onionAddressLabel=My onion address
|
||||||
settings.net.xmrNodesLabel=Use custom Monero nodes
|
settings.net.xmrNodesLabel=Use custom Monero nodes
|
||||||
settings.net.moneroPeersLabel=Connected peers
|
settings.net.moneroPeersLabel=Connected peers
|
||||||
|
settings.net.connection=Connection
|
||||||
|
settings.net.connected=Connected
|
||||||
settings.net.useTorForXmrJLabel=Use Tor for Monero network
|
settings.net.useTorForXmrJLabel=Use Tor for Monero network
|
||||||
settings.net.useTorForXmrAfterSyncRadio=After wallet is synchronized
|
settings.net.useTorForXmrAfterSyncRadio=After wallet is synchronized
|
||||||
settings.net.useTorForXmrOffRadio=Never
|
settings.net.useTorForXmrOffRadio=Never
|
||||||
|
|
|
@ -1043,6 +1043,8 @@ settings.net.p2pHeader=Síť Haveno
|
||||||
settings.net.onionAddressLabel=Moje onion adresa
|
settings.net.onionAddressLabel=Moje onion adresa
|
||||||
settings.net.xmrNodesLabel=Použijte vlastní Monero node
|
settings.net.xmrNodesLabel=Použijte vlastní Monero node
|
||||||
settings.net.moneroPeersLabel=Připojené peer uzly
|
settings.net.moneroPeersLabel=Připojené peer uzly
|
||||||
|
settings.net.connection=Připojení
|
||||||
|
settings.net.connected=Připojeno
|
||||||
settings.net.useTorForXmrJLabel=Použít Tor pro Monero síť
|
settings.net.useTorForXmrJLabel=Použít Tor pro Monero síť
|
||||||
settings.net.moneroNodesLabel=Monero nody, pro připojení
|
settings.net.moneroNodesLabel=Monero nody, pro připojení
|
||||||
settings.net.useProvidedNodesRadio=Použijte nabízené Monero Core nody
|
settings.net.useProvidedNodesRadio=Použijte nabízené Monero Core nody
|
||||||
|
|
|
@ -1043,6 +1043,8 @@ settings.net.p2pHeader=Haveno-Netzwerk
|
||||||
settings.net.onionAddressLabel=Meine Onion-Adresse
|
settings.net.onionAddressLabel=Meine Onion-Adresse
|
||||||
settings.net.xmrNodesLabel=Spezifische Monero-Knoten verwenden
|
settings.net.xmrNodesLabel=Spezifische Monero-Knoten verwenden
|
||||||
settings.net.moneroPeersLabel=Verbundene Peers
|
settings.net.moneroPeersLabel=Verbundene Peers
|
||||||
|
settings.net.connection=Verbindung
|
||||||
|
settings.net.connected=Verbunden
|
||||||
settings.net.useTorForXmrJLabel=Tor für das Monero-Netzwerk verwenden
|
settings.net.useTorForXmrJLabel=Tor für das Monero-Netzwerk verwenden
|
||||||
settings.net.moneroNodesLabel=Mit Monero-Knoten verbinden
|
settings.net.moneroNodesLabel=Mit Monero-Knoten verbinden
|
||||||
settings.net.useProvidedNodesRadio=Bereitgestellte Monero-Core-Knoten verwenden
|
settings.net.useProvidedNodesRadio=Bereitgestellte Monero-Core-Knoten verwenden
|
||||||
|
|
|
@ -1044,6 +1044,8 @@ settings.net.p2pHeader=Red Haveno
|
||||||
settings.net.onionAddressLabel=Mi dirección onion
|
settings.net.onionAddressLabel=Mi dirección onion
|
||||||
settings.net.xmrNodesLabel=Utilizar nodos Monero personalizados
|
settings.net.xmrNodesLabel=Utilizar nodos Monero personalizados
|
||||||
settings.net.moneroPeersLabel=Pares conectados
|
settings.net.moneroPeersLabel=Pares conectados
|
||||||
|
settings.net.connection=Conexión
|
||||||
|
settings.net.connected=Conectado
|
||||||
settings.net.useTorForXmrJLabel=Usar Tor para la red Monero
|
settings.net.useTorForXmrJLabel=Usar Tor para la red Monero
|
||||||
settings.net.moneroNodesLabel=Nodos Monero para conectarse
|
settings.net.moneroNodesLabel=Nodos Monero para conectarse
|
||||||
settings.net.useProvidedNodesRadio=Utilizar nodos Monero Core proporcionados
|
settings.net.useProvidedNodesRadio=Utilizar nodos Monero Core proporcionados
|
||||||
|
|
|
@ -1040,6 +1040,8 @@ settings.net.p2pHeader=Haveno network
|
||||||
settings.net.onionAddressLabel=آدرس onion من
|
settings.net.onionAddressLabel=آدرس onion من
|
||||||
settings.net.xmrNodesLabel=استفاده از گرههای Monero اختصاصی
|
settings.net.xmrNodesLabel=استفاده از گرههای Monero اختصاصی
|
||||||
settings.net.moneroPeersLabel=همتایان متصل
|
settings.net.moneroPeersLabel=همتایان متصل
|
||||||
|
settings.net.connection=اتصال
|
||||||
|
settings.net.connected=متصل
|
||||||
settings.net.useTorForXmrJLabel=استفاده از Tor برای شبکه مونرو
|
settings.net.useTorForXmrJLabel=استفاده از Tor برای شبکه مونرو
|
||||||
settings.net.moneroNodesLabel=گرههای Monero در دسترس
|
settings.net.moneroNodesLabel=گرههای Monero در دسترس
|
||||||
settings.net.useProvidedNodesRadio=استفاده از نودهای بیتکوین ارائه شده
|
settings.net.useProvidedNodesRadio=استفاده از نودهای بیتکوین ارائه شده
|
||||||
|
|
|
@ -1045,6 +1045,8 @@ settings.net.p2pHeader=Le réseau Haveno
|
||||||
settings.net.onionAddressLabel=Mon adresse onion
|
settings.net.onionAddressLabel=Mon adresse onion
|
||||||
settings.net.xmrNodesLabel=Utiliser des nœuds Monero personnalisés
|
settings.net.xmrNodesLabel=Utiliser des nœuds Monero personnalisés
|
||||||
settings.net.moneroPeersLabel=Pairs connectés
|
settings.net.moneroPeersLabel=Pairs connectés
|
||||||
|
settings.net.connection=Connexion
|
||||||
|
settings.net.connected=Connecté
|
||||||
settings.net.useTorForXmrJLabel=Utiliser Tor pour le réseau Monero
|
settings.net.useTorForXmrJLabel=Utiliser Tor pour le réseau Monero
|
||||||
settings.net.moneroNodesLabel=Nœuds Monero pour se connecter à
|
settings.net.moneroNodesLabel=Nœuds Monero pour se connecter à
|
||||||
settings.net.useProvidedNodesRadio=Utiliser les nœuds Monero Core fournis
|
settings.net.useProvidedNodesRadio=Utiliser les nœuds Monero Core fournis
|
||||||
|
|
|
@ -1042,6 +1042,8 @@ settings.net.p2pHeader=Rete Haveno
|
||||||
settings.net.onionAddressLabel=Il mio indirizzo onion
|
settings.net.onionAddressLabel=Il mio indirizzo onion
|
||||||
settings.net.xmrNodesLabel=Usa nodi Monero personalizzati
|
settings.net.xmrNodesLabel=Usa nodi Monero personalizzati
|
||||||
settings.net.moneroPeersLabel=Peer connessi
|
settings.net.moneroPeersLabel=Peer connessi
|
||||||
|
settings.net.connection=Connessione
|
||||||
|
settings.net.connected=Connesso
|
||||||
settings.net.useTorForXmrJLabel=Usa Tor per la rete Monero
|
settings.net.useTorForXmrJLabel=Usa Tor per la rete Monero
|
||||||
settings.net.moneroNodesLabel=Nodi Monero a cui connettersi
|
settings.net.moneroNodesLabel=Nodi Monero a cui connettersi
|
||||||
settings.net.useProvidedNodesRadio=Usa i nodi Monero Core forniti
|
settings.net.useProvidedNodesRadio=Usa i nodi Monero Core forniti
|
||||||
|
|
|
@ -1043,6 +1043,8 @@ settings.net.p2pHeader=Havenoネットワーク
|
||||||
settings.net.onionAddressLabel=私のonionアドレス
|
settings.net.onionAddressLabel=私のonionアドレス
|
||||||
settings.net.xmrNodesLabel=任意のモネロノードを使う
|
settings.net.xmrNodesLabel=任意のモネロノードを使う
|
||||||
settings.net.moneroPeersLabel=接続されたピア
|
settings.net.moneroPeersLabel=接続されたピア
|
||||||
|
settings.net.connection=接続
|
||||||
|
settings.net.connected=接続されました
|
||||||
settings.net.useTorForXmrJLabel=MoneroネットワークにTorを使用
|
settings.net.useTorForXmrJLabel=MoneroネットワークにTorを使用
|
||||||
settings.net.moneroNodesLabel=接続するMoneroノード:
|
settings.net.moneroNodesLabel=接続するMoneroノード:
|
||||||
settings.net.useProvidedNodesRadio=提供されたMonero Core ノードを使う
|
settings.net.useProvidedNodesRadio=提供されたMonero Core ノードを使う
|
||||||
|
|
|
@ -1044,6 +1044,8 @@ settings.net.p2pHeader=Rede Haveno
|
||||||
settings.net.onionAddressLabel=Meu endereço onion
|
settings.net.onionAddressLabel=Meu endereço onion
|
||||||
settings.net.xmrNodesLabel=Usar nodos personalizados do Monero
|
settings.net.xmrNodesLabel=Usar nodos personalizados do Monero
|
||||||
settings.net.moneroPeersLabel=Pares conectados
|
settings.net.moneroPeersLabel=Pares conectados
|
||||||
|
settings.net.connection=Conexão
|
||||||
|
settings.net.connected=Conectado
|
||||||
settings.net.useTorForXmrJLabel=Usar Tor na rede Monero
|
settings.net.useTorForXmrJLabel=Usar Tor na rede Monero
|
||||||
settings.net.moneroNodesLabel=Conexão a nodos do Monero
|
settings.net.moneroNodesLabel=Conexão a nodos do Monero
|
||||||
settings.net.useProvidedNodesRadio=Usar nodos do Monero Core fornecidos
|
settings.net.useProvidedNodesRadio=Usar nodos do Monero Core fornecidos
|
||||||
|
|
|
@ -1041,6 +1041,8 @@ settings.net.p2pHeader=Rede do Haveno
|
||||||
settings.net.onionAddressLabel=O meu endereço onion
|
settings.net.onionAddressLabel=O meu endereço onion
|
||||||
settings.net.xmrNodesLabel=Usar nós de Monero personalizados
|
settings.net.xmrNodesLabel=Usar nós de Monero personalizados
|
||||||
settings.net.moneroPeersLabel=Pares conectados
|
settings.net.moneroPeersLabel=Pares conectados
|
||||||
|
settings.net.connection=Conexão
|
||||||
|
settings.net.connected=Conectado
|
||||||
settings.net.useTorForXmrJLabel=Usar Tor para a rede de Monero
|
settings.net.useTorForXmrJLabel=Usar Tor para a rede de Monero
|
||||||
settings.net.moneroNodesLabel=Nós de Monero para conectar
|
settings.net.moneroNodesLabel=Nós de Monero para conectar
|
||||||
settings.net.useProvidedNodesRadio=Usar nós de Monero Core providenciados
|
settings.net.useProvidedNodesRadio=Usar nós de Monero Core providenciados
|
||||||
|
|
|
@ -1040,6 +1040,8 @@ settings.net.p2pHeader=Haveno network
|
||||||
settings.net.onionAddressLabel=Мой onion-адрес
|
settings.net.onionAddressLabel=Мой onion-адрес
|
||||||
settings.net.xmrNodesLabel=Использовать особые узлы Monero
|
settings.net.xmrNodesLabel=Использовать особые узлы Monero
|
||||||
settings.net.moneroPeersLabel=Подключенные пиры
|
settings.net.moneroPeersLabel=Подключенные пиры
|
||||||
|
settings.net.connection=Соединение
|
||||||
|
settings.net.connected=Подключено
|
||||||
settings.net.useTorForXmrJLabel=Использовать Tor для сети Monero
|
settings.net.useTorForXmrJLabel=Использовать Tor для сети Monero
|
||||||
settings.net.moneroNodesLabel=Узлы Monero для подключения
|
settings.net.moneroNodesLabel=Узлы Monero для подключения
|
||||||
settings.net.useProvidedNodesRadio=Использовать предоставленные узлы Monero Core
|
settings.net.useProvidedNodesRadio=Использовать предоставленные узлы Monero Core
|
||||||
|
|
|
@ -1040,6 +1040,8 @@ settings.net.p2pHeader=Haveno network
|
||||||
settings.net.onionAddressLabel=ที่อยู่ onion ของฉัน
|
settings.net.onionAddressLabel=ที่อยู่ onion ของฉัน
|
||||||
settings.net.xmrNodesLabel=ใช้โหนดเครือข่าย Monero ที่กำหนดเอง
|
settings.net.xmrNodesLabel=ใช้โหนดเครือข่าย Monero ที่กำหนดเอง
|
||||||
settings.net.moneroPeersLabel=เชื่อมต่อกับเน็ตเวิร์ก peers แล้ว
|
settings.net.moneroPeersLabel=เชื่อมต่อกับเน็ตเวิร์ก peers แล้ว
|
||||||
|
settings.net.connection=การเชื่อมต่อ
|
||||||
|
settings.net.connected=เชื่อมต่อ
|
||||||
settings.net.useTorForXmrJLabel=ใช้ Tor สำหรับเครือข่าย Monero
|
settings.net.useTorForXmrJLabel=ใช้ Tor สำหรับเครือข่าย Monero
|
||||||
settings.net.moneroNodesLabel=ใช้โหนดเครือข่าย Monero เพื่อเชื่อมต่อ
|
settings.net.moneroNodesLabel=ใช้โหนดเครือข่าย Monero เพื่อเชื่อมต่อ
|
||||||
settings.net.useProvidedNodesRadio=ใช้โหนดเครือข่าย Monero ที่ให้มา
|
settings.net.useProvidedNodesRadio=ใช้โหนดเครือข่าย Monero ที่ให้มา
|
||||||
|
|
|
@ -1310,6 +1310,8 @@ settings.net.p2pHeader=Haveno ağı
|
||||||
settings.net.onionAddressLabel=Onion adresim
|
settings.net.onionAddressLabel=Onion adresim
|
||||||
settings.net.xmrNodesLabel=Özel Monero düğümleri kullan
|
settings.net.xmrNodesLabel=Özel Monero düğümleri kullan
|
||||||
settings.net.moneroPeersLabel=Bağlı eşler
|
settings.net.moneroPeersLabel=Bağlı eşler
|
||||||
|
settings.net.connection=Bağlantı
|
||||||
|
settings.net.connected=Bağlı
|
||||||
settings.net.useTorForXmrJLabel=Monero ağı için Tor kullan
|
settings.net.useTorForXmrJLabel=Monero ağı için Tor kullan
|
||||||
settings.net.useTorForXmrAfterSyncRadio=Cüzdan senkronize edildikten sonra
|
settings.net.useTorForXmrAfterSyncRadio=Cüzdan senkronize edildikten sonra
|
||||||
settings.net.useTorForXmrOffRadio=Asla
|
settings.net.useTorForXmrOffRadio=Asla
|
||||||
|
|
|
@ -1042,6 +1042,8 @@ settings.net.p2pHeader=Haveno network
|
||||||
settings.net.onionAddressLabel=Địa chỉ onion của tôi
|
settings.net.onionAddressLabel=Địa chỉ onion của tôi
|
||||||
settings.net.xmrNodesLabel=Sử dụng nút Monero thông dụng
|
settings.net.xmrNodesLabel=Sử dụng nút Monero thông dụng
|
||||||
settings.net.moneroPeersLabel=Các đối tác được kết nối
|
settings.net.moneroPeersLabel=Các đối tác được kết nối
|
||||||
|
settings.net.connection=Kết nối
|
||||||
|
settings.net.connected=Kết nối
|
||||||
settings.net.useTorForXmrJLabel=Sử dụng Tor cho mạng Monero
|
settings.net.useTorForXmrJLabel=Sử dụng Tor cho mạng Monero
|
||||||
settings.net.moneroNodesLabel=nút Monero để kết nối
|
settings.net.moneroNodesLabel=nút Monero để kết nối
|
||||||
settings.net.useProvidedNodesRadio=Sử dụng các nút Monero Core đã cung cấp
|
settings.net.useProvidedNodesRadio=Sử dụng các nút Monero Core đã cung cấp
|
||||||
|
|
|
@ -1043,6 +1043,8 @@ settings.net.p2pHeader=Haveno 网络
|
||||||
settings.net.onionAddressLabel=我的匿名地址
|
settings.net.onionAddressLabel=我的匿名地址
|
||||||
settings.net.xmrNodesLabel=使用自定义比特币主节点
|
settings.net.xmrNodesLabel=使用自定义比特币主节点
|
||||||
settings.net.moneroPeersLabel=已连接节点
|
settings.net.moneroPeersLabel=已连接节点
|
||||||
|
settings.net.connection=连接
|
||||||
|
settings.net.connected=连接
|
||||||
settings.net.useTorForXmrJLabel=使用 Tor 连接 Monero 网络
|
settings.net.useTorForXmrJLabel=使用 Tor 连接 Monero 网络
|
||||||
settings.net.moneroNodesLabel=需要连接 Monero
|
settings.net.moneroNodesLabel=需要连接 Monero
|
||||||
settings.net.useProvidedNodesRadio=使用公共比特币核心节点
|
settings.net.useProvidedNodesRadio=使用公共比特币核心节点
|
||||||
|
|
|
@ -1043,6 +1043,8 @@ settings.net.p2pHeader=Haveno 網絡
|
||||||
settings.net.onionAddressLabel=我的匿名地址
|
settings.net.onionAddressLabel=我的匿名地址
|
||||||
settings.net.xmrNodesLabel=使用自定义Monero节点
|
settings.net.xmrNodesLabel=使用自定义Monero节点
|
||||||
settings.net.moneroPeersLabel=已連接節點
|
settings.net.moneroPeersLabel=已連接節點
|
||||||
|
settings.net.connection=連接
|
||||||
|
settings.net.connected=連接完成
|
||||||
settings.net.useTorForXmrJLabel=使用 Tor 連接 Monero 網絡
|
settings.net.useTorForXmrJLabel=使用 Tor 連接 Monero 網絡
|
||||||
settings.net.moneroNodesLabel=需要連接 Monero
|
settings.net.moneroNodesLabel=需要連接 Monero
|
||||||
settings.net.useProvidedNodesRadio=使用公共比特幣核心節點
|
settings.net.useProvidedNodesRadio=使用公共比特幣核心節點
|
||||||
|
|
|
@ -17,28 +17,23 @@
|
||||||
|
|
||||||
package haveno.desktop.main.settings.network;
|
package haveno.desktop.main.settings.network;
|
||||||
|
|
||||||
import monero.daemon.model.MoneroPeer;
|
import haveno.core.locale.Res;
|
||||||
|
import monero.common.MoneroRpcConnection;
|
||||||
|
|
||||||
public class MoneroNetworkListItem {
|
public class MoneroNetworkListItem {
|
||||||
private final MoneroPeer peer;
|
private final MoneroRpcConnection connection;
|
||||||
|
private final boolean connected;
|
||||||
|
|
||||||
public MoneroNetworkListItem(MoneroPeer peer) {
|
public MoneroNetworkListItem(MoneroRpcConnection connection, boolean connected) {
|
||||||
this.peer = peer;
|
this.connection = connection;
|
||||||
|
this.connected = connected;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOnionAddress() {
|
public String getAddress() {
|
||||||
return peer.getHost() + ":" + peer.getPort();
|
return connection.getUri();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVersion() {
|
public String getConnected() {
|
||||||
return "";
|
return connected ? Res.get("settings.net.connected") : "";
|
||||||
}
|
|
||||||
|
|
||||||
public String getSubVersion() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHeight() {
|
|
||||||
return String.valueOf(peer.getHeight());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,27 +45,17 @@
|
||||||
|
|
||||||
<TitledGroupBg fx:id="btcHeader" GridPane.rowSpan="5"/>
|
<TitledGroupBg fx:id="btcHeader" GridPane.rowSpan="5"/>
|
||||||
<VBox GridPane.rowIndex="0" GridPane.hgrow="ALWAYS" GridPane.vgrow="SOMETIMES">
|
<VBox GridPane.rowIndex="0" GridPane.hgrow="ALWAYS" GridPane.vgrow="SOMETIMES">
|
||||||
<AutoTooltipLabel fx:id="moneroPeersLabel" styleClass="small-text"/>
|
<AutoTooltipLabel fx:id="moneroConnectionsLabel" styleClass="small-text"/>
|
||||||
<TableView fx:id="moneroPeersTableView">
|
<TableView fx:id="moneroConnectionsTableView">
|
||||||
<columns>
|
<columns>
|
||||||
<TableColumn fx:id="moneroPeerAddressColumn" minWidth="220">
|
<TableColumn fx:id="moneroConnectionAddressColumn" minWidth="220">
|
||||||
<cellValueFactory>
|
<cellValueFactory>
|
||||||
<PropertyValueFactory property="onionAddress"/>
|
<PropertyValueFactory property="address"/>
|
||||||
</cellValueFactory>
|
</cellValueFactory>
|
||||||
</TableColumn>
|
</TableColumn>
|
||||||
<TableColumn fx:id="moneroPeerVersionColumn" minWidth="80" maxWidth="90">
|
<TableColumn fx:id="moneroConnectionConnectedColumn" minWidth="80" maxWidth="90">
|
||||||
<cellValueFactory>
|
<cellValueFactory>
|
||||||
<PropertyValueFactory property="version"/>
|
<PropertyValueFactory property="connected"/>
|
||||||
</cellValueFactory>
|
|
||||||
</TableColumn>
|
|
||||||
<TableColumn fx:id="moneroPeerSubVersionColumn" minWidth="180" maxWidth="180">
|
|
||||||
<cellValueFactory>
|
|
||||||
<PropertyValueFactory property="subVersion"/>
|
|
||||||
</cellValueFactory>
|
|
||||||
</TableColumn>
|
|
||||||
<TableColumn fx:id="moneroPeerHeightColumn" minWidth="80" maxWidth="80">
|
|
||||||
<cellValueFactory>
|
|
||||||
<PropertyValueFactory property="height"/>
|
|
||||||
</cellValueFactory>
|
</cellValueFactory>
|
||||||
</TableColumn>
|
</TableColumn>
|
||||||
</columns>
|
</columns>
|
||||||
|
|
|
@ -44,7 +44,6 @@ import haveno.desktop.main.overlays.windows.TorNetworkSettingsWindow;
|
||||||
import haveno.desktop.util.GUIUtil;
|
import haveno.desktop.util.GUIUtil;
|
||||||
import haveno.network.p2p.P2PService;
|
import haveno.network.p2p.P2PService;
|
||||||
import haveno.network.p2p.network.Statistic;
|
import haveno.network.p2p.network.Statistic;
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import static javafx.beans.binding.Bindings.createStringBinding;
|
import static javafx.beans.binding.Bindings.createStringBinding;
|
||||||
|
@ -63,7 +62,6 @@ import javafx.scene.control.TextField;
|
||||||
import javafx.scene.control.Toggle;
|
import javafx.scene.control.Toggle;
|
||||||
import javafx.scene.control.ToggleGroup;
|
import javafx.scene.control.ToggleGroup;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import monero.daemon.model.MoneroPeer;
|
|
||||||
import org.fxmisc.easybind.EasyBind;
|
import org.fxmisc.easybind.EasyBind;
|
||||||
import org.fxmisc.easybind.Subscription;
|
import org.fxmisc.easybind.Subscription;
|
||||||
|
|
||||||
|
@ -79,7 +77,7 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
||||||
@FXML
|
@FXML
|
||||||
TextField onionAddress, sentDataTextField, receivedDataTextField, chainHeightTextField;
|
TextField onionAddress, sentDataTextField, receivedDataTextField, chainHeightTextField;
|
||||||
@FXML
|
@FXML
|
||||||
Label p2PPeersLabel, moneroPeersLabel;
|
Label p2PPeersLabel, moneroConnectionsLabel;
|
||||||
@FXML
|
@FXML
|
||||||
RadioButton useTorForXmrAfterSyncRadio, useTorForXmrOffRadio, useTorForXmrOnRadio;
|
RadioButton useTorForXmrAfterSyncRadio, useTorForXmrOffRadio, useTorForXmrOnRadio;
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -87,13 +85,12 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
||||||
@FXML
|
@FXML
|
||||||
TableView<P2pNetworkListItem> p2pPeersTableView;
|
TableView<P2pNetworkListItem> p2pPeersTableView;
|
||||||
@FXML
|
@FXML
|
||||||
TableView<MoneroNetworkListItem> moneroPeersTableView;
|
TableView<MoneroNetworkListItem> moneroConnectionsTableView;
|
||||||
@FXML
|
@FXML
|
||||||
TableColumn<P2pNetworkListItem, String> onionAddressColumn, connectionTypeColumn, creationDateColumn,
|
TableColumn<P2pNetworkListItem, String> onionAddressColumn, connectionTypeColumn, creationDateColumn,
|
||||||
roundTripTimeColumn, sentBytesColumn, receivedBytesColumn, peerTypeColumn;
|
roundTripTimeColumn, sentBytesColumn, receivedBytesColumn, peerTypeColumn;
|
||||||
@FXML
|
@FXML
|
||||||
TableColumn<MoneroNetworkListItem, String> moneroPeerAddressColumn, moneroPeerVersionColumn,
|
TableColumn<MoneroNetworkListItem, String> moneroConnectionAddressColumn, moneroConnectionConnectedColumn;
|
||||||
moneroPeerSubVersionColumn, moneroPeerHeightColumn;
|
|
||||||
@FXML
|
@FXML
|
||||||
Label rescanOutputsLabel;
|
Label rescanOutputsLabel;
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -116,7 +113,7 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
||||||
private final SortedList<MoneroNetworkListItem> moneroSortedList = new SortedList<>(moneroNetworkListItems);
|
private final SortedList<MoneroNetworkListItem> moneroSortedList = new SortedList<>(moneroNetworkListItems);
|
||||||
|
|
||||||
private Subscription numP2PPeersSubscription;
|
private Subscription numP2PPeersSubscription;
|
||||||
private Subscription moneroPeersSubscription;
|
private Subscription moneroConnectionsSubscription;
|
||||||
private Subscription moneroBlockHeightSubscription;
|
private Subscription moneroBlockHeightSubscription;
|
||||||
private Subscription nodeAddressSubscription;
|
private Subscription nodeAddressSubscription;
|
||||||
private ChangeListener<Boolean> xmrNodesInputTextFieldFocusListener;
|
private ChangeListener<Boolean> xmrNodesInputTextFieldFocusListener;
|
||||||
|
@ -156,17 +153,15 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
||||||
p2pHeader.setText(Res.get("settings.net.p2pHeader"));
|
p2pHeader.setText(Res.get("settings.net.p2pHeader"));
|
||||||
onionAddress.setPromptText(Res.get("settings.net.onionAddressLabel"));
|
onionAddress.setPromptText(Res.get("settings.net.onionAddressLabel"));
|
||||||
xmrNodesLabel.setText(Res.get("settings.net.xmrNodesLabel"));
|
xmrNodesLabel.setText(Res.get("settings.net.xmrNodesLabel"));
|
||||||
moneroPeersLabel.setText(Res.get("settings.net.moneroPeersLabel"));
|
moneroConnectionsLabel.setText(Res.get("settings.net.moneroPeersLabel"));
|
||||||
useTorForXmrLabel.setText(Res.get("settings.net.useTorForXmrJLabel"));
|
useTorForXmrLabel.setText(Res.get("settings.net.useTorForXmrJLabel"));
|
||||||
useTorForXmrAfterSyncRadio.setText(Res.get("settings.net.useTorForXmrAfterSyncRadio"));
|
useTorForXmrAfterSyncRadio.setText(Res.get("settings.net.useTorForXmrAfterSyncRadio"));
|
||||||
useTorForXmrOffRadio.setText(Res.get("settings.net.useTorForXmrOffRadio"));
|
useTorForXmrOffRadio.setText(Res.get("settings.net.useTorForXmrOffRadio"));
|
||||||
useTorForXmrOnRadio.setText(Res.get("settings.net.useTorForXmrOnRadio"));
|
useTorForXmrOnRadio.setText(Res.get("settings.net.useTorForXmrOnRadio"));
|
||||||
moneroNodesLabel.setText(Res.get("settings.net.moneroNodesLabel"));
|
moneroNodesLabel.setText(Res.get("settings.net.moneroNodesLabel"));
|
||||||
moneroPeerAddressColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.onionAddressColumn")));
|
moneroConnectionAddressColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.address")));
|
||||||
moneroPeerAddressColumn.getStyleClass().add("first-column");
|
moneroConnectionAddressColumn.getStyleClass().add("first-column");
|
||||||
moneroPeerVersionColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.versionColumn")));
|
moneroConnectionConnectedColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.connection")));
|
||||||
moneroPeerSubVersionColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.subVersionColumn")));
|
|
||||||
moneroPeerHeightColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.heightColumn")));
|
|
||||||
localhostXmrNodeInfoLabel.setText(Res.get("settings.net.localhostXmrNodeInfo"));
|
localhostXmrNodeInfoLabel.setText(Res.get("settings.net.localhostXmrNodeInfo"));
|
||||||
useProvidedNodesRadio.setText(Res.get("settings.net.useProvidedNodesRadio"));
|
useProvidedNodesRadio.setText(Res.get("settings.net.useProvidedNodesRadio"));
|
||||||
useCustomNodesRadio.setText(Res.get("settings.net.useCustomNodesRadio"));
|
useCustomNodesRadio.setText(Res.get("settings.net.useCustomNodesRadio"));
|
||||||
|
@ -192,19 +187,19 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
||||||
rescanOutputsLabel.setVisible(false);
|
rescanOutputsLabel.setVisible(false);
|
||||||
rescanOutputsButton.setVisible(false);
|
rescanOutputsButton.setVisible(false);
|
||||||
|
|
||||||
GridPane.setMargin(moneroPeersLabel, new Insets(4, 0, 0, 0));
|
GridPane.setMargin(moneroConnectionsLabel, new Insets(4, 0, 0, 0));
|
||||||
GridPane.setValignment(moneroPeersLabel, VPos.TOP);
|
GridPane.setValignment(moneroConnectionsLabel, VPos.TOP);
|
||||||
|
|
||||||
GridPane.setMargin(p2PPeersLabel, new Insets(4, 0, 0, 0));
|
GridPane.setMargin(p2PPeersLabel, new Insets(4, 0, 0, 0));
|
||||||
GridPane.setValignment(p2PPeersLabel, VPos.TOP);
|
GridPane.setValignment(p2PPeersLabel, VPos.TOP);
|
||||||
|
|
||||||
moneroPeersTableView.setMinHeight(180);
|
moneroConnectionAddressColumn.setSortType(TableColumn.SortType.ASCENDING);
|
||||||
moneroPeersTableView.setPrefHeight(180);
|
moneroConnectionConnectedColumn.setSortType(TableColumn.SortType.DESCENDING);
|
||||||
moneroPeersTableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
|
moneroConnectionsTableView.setMinHeight(180);
|
||||||
moneroPeersTableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noData")));
|
moneroConnectionsTableView.setPrefHeight(180);
|
||||||
moneroPeersTableView.getSortOrder().add(moneroPeerAddressColumn);
|
moneroConnectionsTableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
|
||||||
moneroPeerAddressColumn.setSortType(TableColumn.SortType.ASCENDING);
|
moneroConnectionsTableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noData")));
|
||||||
|
moneroConnectionsTableView.getSortOrder().add(moneroConnectionConnectedColumn);
|
||||||
|
|
||||||
p2pPeersTableView.setMinHeight(180);
|
p2pPeersTableView.setMinHeight(180);
|
||||||
p2pPeersTableView.setPrefHeight(180);
|
p2pPeersTableView.setPrefHeight(180);
|
||||||
|
@ -309,11 +304,11 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
||||||
|
|
||||||
rescanOutputsButton.setOnAction(event -> GUIUtil.rescanOutputs(preferences));
|
rescanOutputsButton.setOnAction(event -> GUIUtil.rescanOutputs(preferences));
|
||||||
|
|
||||||
moneroPeersSubscription = EasyBind.subscribe(connectionService.peerConnectionsProperty(),
|
moneroConnectionsSubscription = EasyBind.subscribe(connectionService.connectionsProperty(),
|
||||||
this::updateMoneroPeersTable);
|
connections -> updateMoneroConnectionsTable());
|
||||||
|
|
||||||
moneroBlockHeightSubscription = EasyBind.subscribe(connectionService.chainHeightProperty(),
|
moneroBlockHeightSubscription = EasyBind.subscribe(connectionService.chainHeightProperty(),
|
||||||
this::updateChainHeightTextField);
|
height -> updateMoneroConnectionsTable());
|
||||||
|
|
||||||
nodeAddressSubscription = EasyBind.subscribe(p2PService.getNetworkNode().nodeAddressProperty(),
|
nodeAddressSubscription = EasyBind.subscribe(p2PService.getNetworkNode().nodeAddressProperty(),
|
||||||
nodeAddress -> onionAddress.setText(nodeAddress == null ?
|
nodeAddress -> onionAddress.setText(nodeAddress == null ?
|
||||||
|
@ -333,8 +328,8 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
||||||
Statistic.numTotalReceivedMessagesPerSecProperty().get()),
|
Statistic.numTotalReceivedMessagesPerSecProperty().get()),
|
||||||
Statistic.numTotalReceivedMessagesPerSecProperty()));
|
Statistic.numTotalReceivedMessagesPerSecProperty()));
|
||||||
|
|
||||||
moneroSortedList.comparatorProperty().bind(moneroPeersTableView.comparatorProperty());
|
moneroSortedList.comparatorProperty().bind(moneroConnectionsTableView.comparatorProperty());
|
||||||
moneroPeersTableView.setItems(moneroSortedList);
|
moneroConnectionsTableView.setItems(moneroSortedList);
|
||||||
|
|
||||||
p2pSortedList.comparatorProperty().bind(p2pPeersTableView.comparatorProperty());
|
p2pSortedList.comparatorProperty().bind(p2pPeersTableView.comparatorProperty());
|
||||||
p2pPeersTableView.setItems(p2pSortedList);
|
p2pPeersTableView.setItems(p2pSortedList);
|
||||||
|
@ -355,8 +350,8 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
||||||
if (nodeAddressSubscription != null)
|
if (nodeAddressSubscription != null)
|
||||||
nodeAddressSubscription.unsubscribe();
|
nodeAddressSubscription.unsubscribe();
|
||||||
|
|
||||||
if (moneroPeersSubscription != null)
|
if (moneroConnectionsSubscription != null)
|
||||||
moneroPeersSubscription.unsubscribe();
|
moneroConnectionsSubscription.unsubscribe();
|
||||||
|
|
||||||
if (moneroBlockHeightSubscription != null)
|
if (moneroBlockHeightSubscription != null)
|
||||||
moneroBlockHeightSubscription.unsubscribe();
|
moneroBlockHeightSubscription.unsubscribe();
|
||||||
|
@ -521,13 +516,15 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMoneroPeersTable(List<MoneroPeer> peers) {
|
private void updateMoneroConnectionsTable() {
|
||||||
|
UserThread.execute(() -> {
|
||||||
|
if (connectionService.isShutDownStarted()) return; // ignore if shutting down
|
||||||
moneroNetworkListItems.clear();
|
moneroNetworkListItems.clear();
|
||||||
if (peers != null) {
|
moneroNetworkListItems.setAll(connectionService.getConnections().stream()
|
||||||
moneroNetworkListItems.setAll(peers.stream()
|
.map(connection -> new MoneroNetworkListItem(connection, Boolean.TRUE.equals(connection.isConnected()) && connection == connectionService.getConnection()))
|
||||||
.map(MoneroNetworkListItem::new)
|
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
}
|
updateChainHeightTextField(connectionService.chainHeightProperty().get());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateChainHeightTextField(Number chainHeight) {
|
private void updateChainHeightTextField(Number chainHeight) {
|
||||||
|
|
Loading…
Reference in a new issue