Package nxt.peer
Interface Peer
public interface Peer
Peer network node
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumstatic enumPeer servicesstatic enumPeer state -
Method Summary
Modifier and TypeMethodDescriptionvoidBlacklist the peervoidBlacklist the peervoidConnect the peervoidDisconnect the peerGet the announced addressintGet the open API portintintGet the open SSL portGet the application nameGet the blacklist reasonlongGet the download volumegetHost()Get the peer host addressintGet the time of the last connect attemptintGet the time when the last message was received from the peerGet the application platformintgetPort()Get the peer portGet the software description as 'name(version)@platform'getState()Get the peer statelongGet the upload volumeGet the application versionbooleanbooleanCheck if peer is blacklistedbooleanCheck if the connection handshake is in progressbooleanCheck if this is an inbound connectionbooleanbooleanprovidesService(Peer.Service service) Check if the peer provides the specified servicebooleanprovidesServices(long services) Check if the peer provides the specifies servicesvoidsendMessage(NetworkMessage message) Send an asynchronous messagesendRequest(NetworkMessage message) Send a request and wait for a responsebooleanCheck if address should be sharedvoidUnblacklist the peervoidWait for the initial exchange of GetInfo messages to complete
-
Method Details
-
getState
Peer.State getState()Get the peer state- Returns:
- Current state
-
getHost
String getHost()Get the peer host address- Returns:
- Host address
-
getAnnouncedAddress
String getAnnouncedAddress()Get the announced address- Returns:
- Announced address
-
getDownloadedVolume
long getDownloadedVolume()Get the download volume- Returns:
- Download volume
-
getUploadedVolume
long getUploadedVolume()Get the upload volume- Returns:
- Upload volume
-
getApplication
String getApplication()Get the application name- Returns:
- Application name or null
-
getVersion
String getVersion()Get the application version- Returns:
- Application version or null
-
getPlatform
String getPlatform()Get the application platform- Returns:
- Application platform or null
-
getSoftware
String getSoftware()Get the software description as 'name(version)@platform'- Returns:
- Software description
-
getPort
int getPort()Get the peer port- Returns:
- Peer port or 0
-
getApiPort
int getApiPort()Get the open API port- Returns:
- API port or 0
-
getApiSSLPort
int getApiSSLPort()Get the open SSL port- Returns:
- SSL port or 0
-
getDisabledAPIs
-
getApiServerIdleTimeout
int getApiServerIdleTimeout() -
getBlockchainState
Peer.BlockchainState getBlockchainState() -
isBlacklisted
boolean isBlacklisted()Check if peer is blacklisted- Returns:
- TRUE if peer is blacklisted
-
getBlacklistingCause
String getBlacklistingCause()Get the blacklist reason- Returns:
- Blacklist reason
-
connectPeer
void connectPeer()Connect the peer -
isHandshakePending
boolean isHandshakePending()Check if the connection handshake is in progress- Returns:
- TRUE if the handshake is in progress
-
disconnectPeer
void disconnectPeer()Disconnect the peer -
blacklist
Blacklist the peer- Parameters:
cause- Exception causing the blacklist
-
blacklist
Blacklist the peer- Parameters:
cause- Blacklist reason
-
unBlacklist
void unBlacklist()Unblacklist the peer -
getLastUpdated
int getLastUpdated()Get the time when the last message was received from the peer- Returns:
- Epoch time
-
getLastConnectAttempt
int getLastConnectAttempt()Get the time of the last connect attempt- Returns:
- Epoch time
-
isInbound
boolean isInbound()Check if this is an inbound connection- Returns:
- TRUE if this is an inbound connection
-
providesService
Check if the peer provides the specified service- Parameters:
service- Service- Returns:
- TRUE if the service is provided
-
isOpenAPI
boolean isOpenAPI() -
isApiConnectable
boolean isApiConnectable() -
getPeerApiUri
StringBuilder getPeerApiUri() -
providesServices
boolean providesServices(long services) Check if the peer provides the specifies services- Parameters:
services- Services as a bit map- Returns:
- TRUE if the services are provided
-
sendMessage
Send an asynchronous message- Parameters:
message- Network message
-
sendRequest
Send a request and wait for a response- Parameters:
message- Request message- Returns:
- Response message or null if there is no response
-
waitHandshake
void waitHandshake()Wait for the initial exchange of GetInfo messages to complete
-