Package nxt.peer

Interface Peer


public interface Peer
Peer network node
  • 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
    • shareAddress

      boolean shareAddress()
      Check if address should be shared
      Returns:
      TRUE if address should be shared
    • getDisabledAPIs

      Set<APIEnum> 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

      void blacklist(Exception cause)
      Blacklist the peer
      Parameters:
      cause - Exception causing the blacklist
    • blacklist

      void blacklist(String cause)
      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

      boolean providesService(Peer.Service service)
      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

      void sendMessage(NetworkMessage message)
      Send an asynchronous message
      Parameters:
      message - Network message
    • sendRequest

      NetworkMessage sendRequest(NetworkMessage message)
      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