Package nxt.peer
Class Peers
- java.lang.Object
-
- nxt.peer.Peers
-
public final class Peers extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Peers.Event
-
Field Summary
Fields Modifier and Type Field Description static int
maxNumberOfConnectedPublicPeers
static int
MIN_COMPRESS_SIZE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
addListener(Listener<Peer> listener, Peers.Event eventType)
static boolean
addPeer(Peer peer)
static boolean
addPeer(Peer peer, java.lang.String newAnnouncedAddress)
static void
connectPeer(Peer peer)
static nxt.peer.PeerImpl
findOrCreatePeer(java.lang.String announcedAddress, boolean create)
static java.util.List<Peer>
getActivePeers()
static java.util.Collection<? extends Peer>
getAllPeers()
static Peer
getAnyPeer(Peer.State state, boolean applyPullThreshold)
static int
getDefaultPeerPort()
static java.util.List<Peer>
getInboundPeers()
static Peer.BlockchainState
getMyBlockchainState()
static org.json.simple.JSONStreamAware
getMyPeerInfoRequest()
static org.json.simple.JSONStreamAware
getMyPeerInfoResponse()
static Peer
getPeer(java.lang.String host)
static java.util.List<Peer>
getPeers(Peer.State state)
static java.util.List<Peer>
getPeers(Filter<Peer> filter)
static java.util.List<Peer>
getPeers(Filter<Peer> filter, int limit)
static java.util.List<Peer>
getPublicPeers(Peer.State state, boolean applyPullThreshold)
static java.util.List<Peer.Service>
getServices()
Return local peer servicesstatic Peer
getWeightedPeer(java.util.List<Peer> selectedPeers)
static boolean
hasTooFewKnownPeers()
static boolean
hasTooManyInboundPeers()
static boolean
hasTooManyKnownPeers()
static boolean
hasTooManyOutboundConnections()
static void
init()
static boolean
isNewVersion(java.lang.String version)
static boolean
isOldVersion(java.lang.String version, int[] minVersion)
static boolean
removeListener(Listener<Peer> listener, Peers.Event eventType)
static nxt.peer.PeerImpl
removePeer(Peer peer)
static void
sendToSomePeers(java.util.List<? extends Transaction> transactions)
static void
sendToSomePeers(Block block)
static boolean
setCommunicationLoggingMask(java.lang.String[] events)
Set the communication logging maskstatic void
shutdown()
-
-
-
Field Detail
-
MIN_COMPRESS_SIZE
public static final int MIN_COMPRESS_SIZE
- See Also:
- Constant Field Values
-
maxNumberOfConnectedPublicPeers
public static final int maxNumberOfConnectedPublicPeers
-
-
Method Detail
-
init
public static void init()
-
shutdown
public static void shutdown()
-
addListener
public static boolean addListener(Listener<Peer> listener, Peers.Event eventType)
-
removeListener
public static boolean removeListener(Listener<Peer> listener, Peers.Event eventType)
-
getDefaultPeerPort
public static int getDefaultPeerPort()
-
getAllPeers
public static java.util.Collection<? extends Peer> getAllPeers()
-
getActivePeers
public static java.util.List<Peer> getActivePeers()
-
getPeers
public static java.util.List<Peer> getPeers(Peer.State state)
-
getPeer
public static Peer getPeer(java.lang.String host)
-
getInboundPeers
public static java.util.List<Peer> getInboundPeers()
-
hasTooManyInboundPeers
public static boolean hasTooManyInboundPeers()
-
hasTooManyOutboundConnections
public static boolean hasTooManyOutboundConnections()
-
findOrCreatePeer
public static nxt.peer.PeerImpl findOrCreatePeer(java.lang.String announcedAddress, boolean create)
-
addPeer
public static boolean addPeer(Peer peer, java.lang.String newAnnouncedAddress)
-
addPeer
public static boolean addPeer(Peer peer)
-
removePeer
public static nxt.peer.PeerImpl removePeer(Peer peer)
-
connectPeer
public static void connectPeer(Peer peer)
-
sendToSomePeers
public static void sendToSomePeers(Block block)
-
sendToSomePeers
public static void sendToSomePeers(java.util.List<? extends Transaction> transactions)
-
getAnyPeer
public static Peer getAnyPeer(Peer.State state, boolean applyPullThreshold)
-
getPublicPeers
public static java.util.List<Peer> getPublicPeers(Peer.State state, boolean applyPullThreshold)
-
isOldVersion
public static boolean isOldVersion(java.lang.String version, int[] minVersion)
-
isNewVersion
public static boolean isNewVersion(java.lang.String version)
-
hasTooFewKnownPeers
public static boolean hasTooFewKnownPeers()
-
hasTooManyKnownPeers
public static boolean hasTooManyKnownPeers()
-
setCommunicationLoggingMask
public static boolean setCommunicationLoggingMask(java.lang.String[] events)
Set the communication logging mask- Parameters:
events
- Communication event list or null to reset communications logging- Returns:
- TRUE if the communication logging mask was updated
-
getServices
public static java.util.List<Peer.Service> getServices()
Return local peer services- Returns:
- List of local peer services
-
getMyPeerInfoRequest
public static org.json.simple.JSONStreamAware getMyPeerInfoRequest()
-
getMyPeerInfoResponse
public static org.json.simple.JSONStreamAware getMyPeerInfoResponse()
-
getMyBlockchainState
public static Peer.BlockchainState getMyBlockchainState()
-
-