Package org.drasyl
Class DrasylConfig
- java.lang.Object
-
- org.drasyl.DrasylConfig
-
public abstract class DrasylConfig extends Object
This class represents the configuration for aDrasylNode
. For example, it defines the identity and the Super Peer.This is an immutable object.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DrasylConfig.Builder
-
Field Summary
-
Constructor Summary
Constructors Constructor Description DrasylConfig()
-
Method Summary
-
-
-
Field Detail
-
NETWORK_ID
public static final String NETWORK_ID
- See Also:
- Constant Field Values
-
IDENTITY_PROOF_OF_WORK
public static final String IDENTITY_PROOF_OF_WORK
- See Also:
- Constant Field Values
-
IDENTITY_PUBLIC_KEY
public static final String IDENTITY_PUBLIC_KEY
- See Also:
- Constant Field Values
-
IDENTITY_SECRET_KEY
public static final String IDENTITY_SECRET_KEY
- See Also:
- Constant Field Values
-
IDENTITY_KEY_AGREEMENT_PUBLIC_KEY
public static final String IDENTITY_KEY_AGREEMENT_PUBLIC_KEY
- See Also:
- Constant Field Values
-
IDENTITY_KEY_AGREEMENT_SECRET_KEY
public static final String IDENTITY_KEY_AGREEMENT_SECRET_KEY
- See Also:
- Constant Field Values
-
IDENTITY_PATH
public static final String IDENTITY_PATH
- See Also:
- Constant Field Values
-
MESSAGE_BUFFER_SIZE
public static final String MESSAGE_BUFFER_SIZE
- See Also:
- Constant Field Values
-
REMOTE_ENABLED
public static final String REMOTE_ENABLED
- See Also:
- Constant Field Values
-
REMOTE_BIND_HOST
public static final String REMOTE_BIND_HOST
- See Also:
- Constant Field Values
-
REMOTE_BIND_PORT
public static final String REMOTE_BIND_PORT
- See Also:
- Constant Field Values
-
REMOTE_ENDPOINTS
public static final String REMOTE_ENDPOINTS
- See Also:
- Constant Field Values
-
REMOTE_EXPOSE_ENABLED
public static final String REMOTE_EXPOSE_ENABLED
- See Also:
- Constant Field Values
-
REMOTE_PING_INTERVAL
public static final String REMOTE_PING_INTERVAL
- See Also:
- Constant Field Values
-
REMOTE_PING_TIMEOUT
public static final String REMOTE_PING_TIMEOUT
- See Also:
- Constant Field Values
-
REMOTE_PING_COMMUNICATION_TIMEOUT
public static final String REMOTE_PING_COMMUNICATION_TIMEOUT
- See Also:
- Constant Field Values
-
REMOTE_PING_MAX_PEERS
public static final String REMOTE_PING_MAX_PEERS
- See Also:
- Constant Field Values
-
REMOTE_UNITE_MIN_INTERVAL
public static final String REMOTE_UNITE_MIN_INTERVAL
- See Also:
- Constant Field Values
-
REMOTE_SUPER_PEER_ENABLED
public static final String REMOTE_SUPER_PEER_ENABLED
- See Also:
- Constant Field Values
-
REMOTE_SUPER_PEER_ENDPOINTS
public static final String REMOTE_SUPER_PEER_ENDPOINTS
- See Also:
- Constant Field Values
-
REMOTE_STATIC_ROUTES
public static final String REMOTE_STATIC_ROUTES
- See Also:
- Constant Field Values
-
REMOTE_LOCAL_HOST_DISCOVERY_ENABLED
public static final String REMOTE_LOCAL_HOST_DISCOVERY_ENABLED
- See Also:
- Constant Field Values
-
REMOTE_LOCAL_HOST_DISCOVERY_PATH
public static final String REMOTE_LOCAL_HOST_DISCOVERY_PATH
- See Also:
- Constant Field Values
-
REMOTE_LOCAL_HOST_DISCOVERY_LEASE_TIME
public static final String REMOTE_LOCAL_HOST_DISCOVERY_LEASE_TIME
- See Also:
- Constant Field Values
-
REMOTE_LOCAL_HOST_DISCOVERY_WATCH_ENABLED
public static final String REMOTE_LOCAL_HOST_DISCOVERY_WATCH_ENABLED
- See Also:
- Constant Field Values
-
REMOTE_LOCAL_NETWORK_DISCOVERY_ENABLED
public static final String REMOTE_LOCAL_NETWORK_DISCOVERY_ENABLED
- See Also:
- Constant Field Values
-
REMOTE_MESSAGE_MTU
public static final String REMOTE_MESSAGE_MTU
- See Also:
- Constant Field Values
-
REMOTE_MESSAGE_MAX_CONTENT_LENGTH
public static final String REMOTE_MESSAGE_MAX_CONTENT_LENGTH
- See Also:
- Constant Field Values
-
REMOTE_MESSAGE_COMPOSED_MESSAGE_TRANSFER_TIMEOUT
public static final String REMOTE_MESSAGE_COMPOSED_MESSAGE_TRANSFER_TIMEOUT
- See Also:
- Constant Field Values
-
REMOTE_MESSAGE_HOP_LIMIT
public static final String REMOTE_MESSAGE_HOP_LIMIT
- See Also:
- Constant Field Values
-
REMOTE_MESSAGE_ARM_ENABLED
public static final String REMOTE_MESSAGE_ARM_ENABLED
- See Also:
- Constant Field Values
-
REMOTE_MESSAGE_ARM_SESSION_EXPIRE_AFTER
public static final String REMOTE_MESSAGE_ARM_SESSION_EXPIRE_AFTER
- See Also:
- Constant Field Values
-
REMOTE_MESSAGE_ARM_SESSION_RETRY_INTERVAL
public static final String REMOTE_MESSAGE_ARM_SESSION_RETRY_INTERVAL
- See Also:
- Constant Field Values
-
REMOTE_MESSAGE_ARM_SESSION_MAX_COUNT
public static final String REMOTE_MESSAGE_ARM_SESSION_MAX_COUNT
- See Also:
- Constant Field Values
-
REMOTE_MESSAGE_ARM_SESSION_MAX_AGREEMENTS
public static final String REMOTE_MESSAGE_ARM_SESSION_MAX_AGREEMENTS
- See Also:
- Constant Field Values
-
REMOTE_TCP_FALLBACK_ENABLED
public static final String REMOTE_TCP_FALLBACK_ENABLED
- See Also:
- Constant Field Values
-
REMOTE_TCP_FALLBACK_SERVER_BIND_HOST
public static final String REMOTE_TCP_FALLBACK_SERVER_BIND_HOST
- See Also:
- Constant Field Values
-
REMOTE_TCP_FALLBACK_SERVER_BIND_PORT
public static final String REMOTE_TCP_FALLBACK_SERVER_BIND_PORT
- See Also:
- Constant Field Values
-
REMOTE_TCP_FALLBACK_CLIENT_TIMEOUT
public static final String REMOTE_TCP_FALLBACK_CLIENT_TIMEOUT
- See Also:
- Constant Field Values
-
REMOTE_TCP_FALLBACK_CLIENT_ADDRESS
public static final String REMOTE_TCP_FALLBACK_CLIENT_ADDRESS
- See Also:
- Constant Field Values
-
INTRA_VM_DISCOVERY_ENABLED
public static final String INTRA_VM_DISCOVERY_ENABLED
- See Also:
- Constant Field Values
-
MONITORING_ENABLED
public static final String MONITORING_ENABLED
- See Also:
- Constant Field Values
-
MONITORING_HOST_TAG
public static final String MONITORING_HOST_TAG
- See Also:
- Constant Field Values
-
MONITORING_INFLUX_URI
public static final String MONITORING_INFLUX_URI
- See Also:
- Constant Field Values
-
MONITORING_INFLUX_USER
public static final String MONITORING_INFLUX_USER
- See Also:
- Constant Field Values
-
MONITORING_INFLUX_PASSWORD
public static final String MONITORING_INFLUX_PASSWORD
- See Also:
- Constant Field Values
-
MONITORING_INFLUX_DATABASE
public static final String MONITORING_INFLUX_DATABASE
- See Also:
- Constant Field Values
-
MONITORING_INFLUX_REPORTING_FREQUENCY
public static final String MONITORING_INFLUX_REPORTING_FREQUENCY
- See Also:
- Constant Field Values
-
PLUGINS
public static final String PLUGINS
- See Also:
- Constant Field Values
-
SERIALIZATION_SERIALIZERS
public static final String SERIALIZATION_SERIALIZERS
- See Also:
- Constant Field Values
-
SERIALIZATION_BINDINGS_INBOUND
public static final String SERIALIZATION_BINDINGS_INBOUND
- See Also:
- Constant Field Values
-
SERIALIZATION_BINDINGS_OUTBOUND
public static final String SERIALIZATION_BINDINGS_OUTBOUND
- See Also:
- Constant Field Values
-
-
Method Detail
-
of
public static DrasylConfig of()
-
of
public static DrasylConfig of(com.typesafe.config.Config config)
-
getProofOfWork
public static ProofOfWork getProofOfWork(com.typesafe.config.Config config, String path)
Gets theProofOfWork
at the given path. Similar toConfig
, an exception is thrown for an invalid value.- Parameters:
config
- the application's portion of the configurationpath
- path expression- Returns:
- the
ProofOfWork
value at the requested path - Throws:
DrasylConfigException
- if value is absent or null
-
getIdentityPublicKey
public static IdentityPublicKey getIdentityPublicKey(com.typesafe.config.Config config, String path)
Gets theIdentityPublicKey
at the given path. Similar toConfig
, an exception is thrown for an invalid value.- Parameters:
config
- the application's portion of the configurationpath
- path expression- Returns:
- the
IdentityPublicKey
value at the requested path - Throws:
DrasylConfigException
- if value is not convertible to aIdentityPublicKey
-
getIdentitySecretKey
public static IdentitySecretKey getIdentitySecretKey(com.typesafe.config.Config config, String path)
Gets theIdentitySecretKey
at the given path. Similar toConfig
, an exception is thrown for an invalid value.- Parameters:
config
- the application's portion of the configurationpath
- path expression- Returns:
- the
IdentitySecretKey
value at the requested path - Throws:
DrasylConfigException
- if value is not convertible to aIdentitySecretKey
-
getKeyAgreementPublicKey
public static KeyAgreementPublicKey getKeyAgreementPublicKey(com.typesafe.config.Config config, String path)
Gets theKeyAgreementPublicKey
at the given path. Similar toConfig
, an exception is thrown for an invalid value.- Parameters:
config
- the application's portion of the configurationpath
- path expression- Returns:
- the
IdentityPublicKey
value at the requested path - Throws:
DrasylConfigException
- if value is not convertible to aIdentityPublicKey
-
getKeyAgreementSecretKey
public static KeyAgreementSecretKey getKeyAgreementSecretKey(com.typesafe.config.Config config, String path)
Gets theKeyAgreementSecretKey
at the given path. Similar toConfig
, an exception is thrown for an invalid value.- Parameters:
config
- the application's portion of the configurationpath
- path expression- Returns:
- the
IdentitySecretKey
value at the requested path - Throws:
DrasylConfigException
- if value is not convertible to aIdentitySecretKey
-
getPath
public static Path getPath(com.typesafe.config.Config config, String path)
Gets thePath
at the given path.- Parameters:
config
- the application's portion of the configurationpath
- path expression- Returns:
- the
Path
value at the requested path - Throws:
DrasylConfigException
- if value at path is invalid
-
getInetAddress
public static InetAddress getInetAddress(com.typesafe.config.Config config, String path)
- Throws:
DrasylConfigException
- if value at path is invalid
-
getEndpointSet
public static Set<Endpoint> getEndpointSet(com.typesafe.config.Config config, String path)
- Throws:
DrasylConfigException
- if value at path is invalid
-
getEndpoint
public static Endpoint getEndpoint(com.typesafe.config.Config config, String path)
- Throws:
DrasylConfigException
- 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 toConfig
, an exception is thrown for an out-of-range value.- Parameters:
config
- the application's portion of the configurationpath
- path expression- Returns:
- the short value at the requested path
- Throws:
DrasylConfigException
- if value is not convertible to a short
-
getByte
public static byte getByte(com.typesafe.config.Config config, String path)
Gets the byte at the given path. Similar toConfig
, an exception is thrown for an out-of-range value.- Parameters:
config
- the application's portion of the configurationpath
- path expression- Returns:
- the byte value at the requested path
- Throws:
DrasylConfigException
- if value is not convertible to a short
-
getURI
public static URI getURI(com.typesafe.config.Config config, String path)
Gets theURI
at the given path.- Parameters:
config
- the application's portion of the configurationpath
- path expression- Returns:
- the
URI
value at the requested path - Throws:
DrasylConfigException
- if value at path is invalid
-
getPlugins
public static Set<DrasylPlugin> getPlugins(com.typesafe.config.Config config, String path)
- Throws:
DrasylConfigException
- if value at path is invalid
-
getSerializationSerializers
public static Map<String,Serializer> getSerializationSerializers(com.typesafe.config.Config config, String path)
-
getSerializationBindings
public static Map<Class<?>,String> getSerializationBindings(com.typesafe.config.Config config, String path, Collection<String> serializers)
-
getInetSocketAddress
public static InetSocketAddress getInetSocketAddress(com.typesafe.config.Config config, String path)
- Throws:
DrasylConfigException
- if value at path is invalid
-
getStaticRoutes
public static Map<IdentityPublicKey,InetSocketAddressWrapper> getStaticRoutes(com.typesafe.config.Config config, String path)
- Throws:
DrasylConfigException
- if value at path is invalid
-
parseFile
public static DrasylConfig parseFile(File file)
Parses a file into a Config instance as with- Parameters:
file
- the file to parse- Returns:
- the parsed configuration
- Throws:
DrasylConfigException
- on IO or parse errors
-
parseString
public static DrasylConfig parseString(String s)
Parses a file into a Config instance as with- Parameters:
s
- string to parse- Returns:
- the parsed configuration
- Throws:
DrasylConfigException
- on IO or parse errors
-
newBuilder
public static DrasylConfig.Builder newBuilder()
Creates a new builder to build a customDrasylConfig
. The built configuration is derived from the default configuration. The builder must be finalized by callingDrasylConfig.Builder.build()
to create the resultingDrasylConfig
.- Returns:
- the new builder
-
newBuilder
public static DrasylConfig.Builder newBuilder(DrasylConfig config)
-
getNetworkId
public abstract int getNetworkId()
-
getIdentityProofOfWork
@Nullable public abstract ProofOfWork getIdentityProofOfWork()
-
getIdentityPublicKey
@Nullable public abstract IdentityPublicKey getIdentityPublicKey()
-
getIdentitySecretKey
@Nullable public abstract IdentitySecretKey getIdentitySecretKey()
-
getKeyAgreementPublicKey
@Nullable public abstract KeyAgreementPublicKey getKeyAgreementPublicKey()
-
getKeyAgreementSecretKey
@Nullable public abstract KeyAgreementSecretKey getKeyAgreementSecretKey()
-
getIdentityPath
public abstract Path getIdentityPath()
-
getMessageBufferSize
public abstract int getMessageBufferSize()
-
isRemoteEnabled
public abstract boolean isRemoteEnabled()
-
getRemoteBindHost
public abstract InetAddress getRemoteBindHost()
-
getRemoteBindPort
public abstract int getRemoteBindPort()
-
getRemoteEndpoints
public abstract com.google.common.collect.ImmutableSet<Endpoint> getRemoteEndpoints()
-
isRemoteExposeEnabled
public abstract boolean isRemoteExposeEnabled()
-
getRemotePingInterval
public abstract Duration getRemotePingInterval()
-
getRemotePingTimeout
public abstract Duration getRemotePingTimeout()
-
getRemotePingCommunicationTimeout
public abstract Duration getRemotePingCommunicationTimeout()
-
getRemotePingMaxPeers
public abstract int getRemotePingMaxPeers()
-
getRemoteUniteMinInterval
public abstract Duration getRemoteUniteMinInterval()
-
isRemoteSuperPeerEnabled
public abstract boolean isRemoteSuperPeerEnabled()
-
getRemoteSuperPeerEndpoints
public abstract com.google.common.collect.ImmutableSet<Endpoint> getRemoteSuperPeerEndpoints()
-
getRemoteStaticRoutes
public abstract com.google.common.collect.ImmutableMap<IdentityPublicKey,InetSocketAddressWrapper> getRemoteStaticRoutes()
-
isRemoteLocalHostDiscoveryEnabled
public abstract boolean isRemoteLocalHostDiscoveryEnabled()
-
getRemoteLocalHostDiscoveryPath
public abstract Path getRemoteLocalHostDiscoveryPath()
-
getRemoteLocalHostDiscoveryLeaseTime
public abstract Duration getRemoteLocalHostDiscoveryLeaseTime()
-
isRemoteLocalHostDiscoveryWatchEnabled
public abstract boolean isRemoteLocalHostDiscoveryWatchEnabled()
-
isRemoteLocalNetworkDiscoveryEnabled
public abstract boolean isRemoteLocalNetworkDiscoveryEnabled()
-
getRemoteMessageMtu
public abstract int getRemoteMessageMtu()
-
getRemoteMessageMaxContentLength
public abstract int getRemoteMessageMaxContentLength()
-
getRemoteMessageComposedMessageTransferTimeout
public abstract Duration getRemoteMessageComposedMessageTransferTimeout()
-
getRemoteMessageHopLimit
public abstract byte getRemoteMessageHopLimit()
-
isRemoteMessageArmEnabled
public abstract boolean isRemoteMessageArmEnabled()
-
getRemoteMessageArmSessionMaxCount
public abstract int getRemoteMessageArmSessionMaxCount()
-
getRemoteMessageArmSessionMaxAgreements
public abstract int getRemoteMessageArmSessionMaxAgreements()
-
getRemoteMessageArmSessionExpireAfter
public abstract Duration getRemoteMessageArmSessionExpireAfter()
-
getRemoteMessageArmSessionRetryInterval
public abstract Duration getRemoteMessageArmSessionRetryInterval()
-
isRemoteTcpFallbackEnabled
public abstract boolean isRemoteTcpFallbackEnabled()
-
getRemoteTcpFallbackServerBindHost
public abstract InetAddress getRemoteTcpFallbackServerBindHost()
-
getRemoteTcpFallbackServerBindPort
public abstract int getRemoteTcpFallbackServerBindPort()
-
getRemoteTcpFallbackClientTimeout
public abstract Duration getRemoteTcpFallbackClientTimeout()
-
getRemoteTcpFallbackClientAddress
public abstract InetSocketAddress getRemoteTcpFallbackClientAddress()
-
isIntraVmDiscoveryEnabled
public abstract boolean isIntraVmDiscoveryEnabled()
-
isMonitoringEnabled
public abstract boolean isMonitoringEnabled()
-
getMonitoringHostTag
public abstract String getMonitoringHostTag()
-
getMonitoringInfluxUri
public abstract URI getMonitoringInfluxUri()
-
getMonitoringInfluxUser
public abstract String getMonitoringInfluxUser()
-
getMonitoringInfluxPassword
public abstract MaskedString getMonitoringInfluxPassword()
-
getMonitoringInfluxDatabase
public abstract String getMonitoringInfluxDatabase()
-
getMonitoringInfluxReportingFrequency
public abstract Duration getMonitoringInfluxReportingFrequency()
-
getPlugins
public abstract com.google.common.collect.ImmutableSet<DrasylPlugin> getPlugins()
-
getSerializationSerializers
public abstract com.google.common.collect.ImmutableMap<String,Serializer> getSerializationSerializers()
-
getSerializationsBindingsInbound
public abstract com.google.common.collect.ImmutableMap<Class<?>,String> getSerializationsBindingsInbound()
-
-