Package org.drasyl

Class DrasylConfig

java.lang.Object
org.drasyl.DrasylConfig

public class DrasylConfig extends Object
This class represents the configuration for a DrasylNode. For example, it defines the identity and the Super Peer.

This is an immutable object.

  • Constructor Details

    • DrasylConfig

      public DrasylConfig()
    • DrasylConfig

      public DrasylConfig(com.typesafe.config.Config config)
      Creates a new config for a drasyl node.
      Parameters:
      config - config to be loaded
  • Method Details

    • getProofOfWork

      public static ProofOfWork getProofOfWork(com.typesafe.config.Config config, String path)
      Gets the ProofOfWork at the given path. Similar to Config, an exception is thrown for an invalid value.
      Parameters:
      config - the application's portion of the configuration
      path - path expression
      Returns:
      the ProofOfWork value at the requested path
      Throws:
      com.typesafe.config.ConfigException.Missing - if value is absent or null
      com.typesafe.config.ConfigException.WrongType - if value is not convertible to a ProofOfWork
    • getPublicKey

      public static CompressedPublicKey getPublicKey(com.typesafe.config.Config config, String path)
      Gets the CompressedPublicKey at the given path. Similar to Config, an exception is thrown for an invalid value.
      Parameters:
      config - the application's portion of the configuration
      path - path expression
      Returns:
      the CompressedPublicKey value at the requested path
      Throws:
      com.typesafe.config.ConfigException.Missing - if value is absent or null
      com.typesafe.config.ConfigException.WrongType - if value is not convertible to a CompressedPublicKey
    • getPrivateKey

      public static CompressedPrivateKey getPrivateKey(com.typesafe.config.Config config, String path)
      Gets the CompressedPrivateKey at the given path. Similar to Config, an exception is thrown for an invalid value.
      Parameters:
      config - the application's portion of the configuration
      path - path expression
      Returns:
      the CompressedPrivateKey value at the requested path
      Throws:
      com.typesafe.config.ConfigException.Missing - if value is absent or null
      com.typesafe.config.ConfigException.WrongType - if value is not convertible to a CompressedPrivateKey
    • getPath

      public static Path getPath(com.typesafe.config.Config config, String path)
      Gets the Path at the given path.
      Parameters:
      config - the application's portion of the configuration
      path - path expression
      Returns:
      the Path value at the requested path
      Throws:
      com.typesafe.config.ConfigException - if value at path is invalid
    • getShort

      public static short getShort(com.typesafe.config.Config config, String path)
      Gets the short at the given path. Similar to Config, an exception is thrown for an out-of-range value.
      Parameters:
      config - the application's portion of the configuration
      path - path expression
      Returns:
      the short value at the requested path
      Throws:
      com.typesafe.config.ConfigException.Missing - if value is absent or null
      com.typesafe.config.ConfigException.WrongType - if value is not convertible to a short
    • getEndpointList

      public static List<Endpoint> getEndpointList(com.typesafe.config.Config config, String path)
      Throws:
      com.typesafe.config.ConfigException - if value at path is invalid
    • getChannelInitializer

      public static Class<io.netty.channel.ChannelInitializer<io.netty.channel.socket.SocketChannel>> getChannelInitializer(com.typesafe.config.Config config, String path)
      Throws:
      com.typesafe.config.ConfigException - if value at path is invalid
    • getPlugins

      public static Set<DrasylPlugin> getPlugins(com.typesafe.config.Config config, String path)
      Throws:
      com.typesafe.config.ConfigException - if value at path is invalid
    • getInetAddress

      public static InetAddress getInetAddress(com.typesafe.config.Config config, String path)
      Throws:
      com.typesafe.config.ConfigException - if value at path is invalid
    • getURI

      public static URI getURI(com.typesafe.config.Config config, String path)
      Gets the URI at the given path.
      Parameters:
      config - the application's portion of the configuration
      path - path expression
      Returns:
      the URI value at the requested path
      Throws:
      com.typesafe.config.ConfigException - if value at path is invalid
    • getNetworkId

      public int getNetworkId()
    • isMonitoringEnabled

      public boolean isMonitoringEnabled()
    • getMonitoringInfluxUri

      public URI getMonitoringInfluxUri()
    • getMonitoringInfluxUser

      public String getMonitoringInfluxUser()
    • getMonitoringInfluxPassword

      public String getMonitoringInfluxPassword()
    • getMonitoringInfluxDatabase

      public String getMonitoringInfluxDatabase()
    • getMonitoringInfluxReportingFrequency

      public Duration getMonitoringInfluxReportingFrequency()
    • getServerBindHost

      public InetAddress getServerBindHost()
    • getServerBindPort

      public int getServerBindPort()
    • getIdentityProofOfWork

      public ProofOfWork getIdentityProofOfWork()
    • getIdentityPublicKey

      public CompressedPublicKey getIdentityPublicKey()
    • getIdentityPrivateKey

      public CompressedPrivateKey getIdentityPrivateKey()
    • getIdentityPath

      public Path getIdentityPath()
    • isServerEnabled

      public boolean isServerEnabled()
    • getServerSSLEnabled

      public boolean getServerSSLEnabled()
    • getServerIdleRetries

      public short getServerIdleRetries()
    • getSuperPeerHandshakeTimeout

      public Duration getSuperPeerHandshakeTimeout()
    • getServerIdleTimeout

      public Duration getServerIdleTimeout()
    • getFlushBufferSize

      public int getFlushBufferSize()
    • getServerSSLProtocols

      public Set<String> getServerSSLProtocols()
    • getServerHandshakeTimeout

      public Duration getServerHandshakeTimeout()
    • getServerEndpoints

      public Set<Endpoint> getServerEndpoints()
    • getServerChannelInitializer

      public Class<? extends io.netty.channel.ChannelInitializer<io.netty.channel.socket.SocketChannel>> getServerChannelInitializer()
    • getMessageMaxContentLength

      public int getMessageMaxContentLength()
    • getMessageHopLimit

      public short getMessageHopLimit()
    • getMessageComposedMessageTransferTimeout

      public Duration getMessageComposedMessageTransferTimeout()
    • isSuperPeerEnabled

      public boolean isSuperPeerEnabled()
    • getSuperPeerEndpoints

      public Set<Endpoint> getSuperPeerEndpoints()
    • getSuperPeerRetryDelays

      public List<Duration> getSuperPeerRetryDelays()
    • getSuperPeerChannelInitializer

      public Class<? extends io.netty.channel.ChannelInitializer<io.netty.channel.socket.SocketChannel>> getSuperPeerChannelInitializer()
    • getSuperPeerIdleRetries

      public short getSuperPeerIdleRetries()
    • getSuperPeerIdleTimeout

      public Duration getSuperPeerIdleTimeout()
    • isIntraVmDiscoveryEnabled

      public boolean isIntraVmDiscoveryEnabled()
    • isLocalHostDiscoveryEnabled

      public boolean isLocalHostDiscoveryEnabled()
    • getLocalHostDiscoveryPath

      public Path getLocalHostDiscoveryPath()
    • getLocalHostDiscoveryLeaseTime

      public Duration getLocalHostDiscoveryLeaseTime()
    • areDirectConnectionsEnabled

      public boolean areDirectConnectionsEnabled()
    • getDirectConnectionsMaxConcurrentConnections

      public int getDirectConnectionsMaxConcurrentConnections()
    • getDirectConnectionsIdleTimeout

      public Duration getDirectConnectionsIdleTimeout()
    • getDirectConnectionsIdleRetries

      public short getDirectConnectionsIdleRetries()
    • getDirectConnectionsHandshakeTimeout

      public Duration getDirectConnectionsHandshakeTimeout()
    • getDirectConnectionsRetryDelays

      public List<Duration> getDirectConnectionsRetryDelays()
    • getPlugins

      public Set<DrasylPlugin> getPlugins()
    • getDirectConnectionsChannelInitializer

      public Class<? extends io.netty.channel.ChannelInitializer<io.netty.channel.socket.SocketChannel>> getDirectConnectionsChannelInitializer()
    • getMarshallingInboundAllowedTypes

      public List<String> getMarshallingInboundAllowedTypes()
    • isMarshallingInboundAllowAllPrimitives

      public boolean isMarshallingInboundAllowAllPrimitives()
    • isMarshallingInboundAllowArrayOfDefinedTypes

      public boolean isMarshallingInboundAllowArrayOfDefinedTypes()
    • getMarshallingInboundAllowedPackages

      public List<String> getMarshallingInboundAllowedPackages()
    • getMarshallingOutboundAllowedTypes

      public List<String> getMarshallingOutboundAllowedTypes()
    • isMarshallingOutboundAllowAllPrimitives

      public boolean isMarshallingOutboundAllowAllPrimitives()
    • isMarshallingOutboundAllowArrayOfDefinedTypes

      public boolean isMarshallingOutboundAllowArrayOfDefinedTypes()
    • getMarshallingOutboundAllowedPackages

      public List<String> getMarshallingOutboundAllowedPackages()
    • isServerExposeEnabled

      public boolean isServerExposeEnabled()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • parseFile

      public static DrasylConfig parseFile(File file)
    • newBuilder

      public static DrasylConfig.Builder newBuilder()
      Creates a new builder to build a custom DrasylConfig. The built configuration is derived from the default configuration. The builder must be finalized by calling DrasylConfig.Builder.build() to create the resulting DrasylConfig.
      Returns:
      the new builder
    • newBuilder

      public static DrasylConfig.Builder newBuilder(DrasylConfig config)