Package org.drasyl.node
Class DrasylConfig
java.lang.Object
org.drasyl.node.DrasylConfig
This class represents the configuration for a
DrasylNode
. For example, it defines the
identity and the Super Peer.
This is an immutable object.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte
Gets the byte at the given path.abstract Duration
static PeerEndpoint
getEndpoint
(com.typesafe.config.Config config, String path) static Set<PeerEndpoint>
getEndpointSet
(com.typesafe.config.Config config, String path) abstract Path
abstract ProofOfWork
abstract IdentityPublicKey
static IdentityPublicKey
getIdentityPublicKey
(com.typesafe.config.Config config, String path) Gets theIdentityPublicKey
at the given path.abstract IdentitySecretKey
static IdentitySecretKey
getIdentitySecretKey
(com.typesafe.config.Config config, String path) Gets theIdentitySecretKey
at the given path.static InetAddress
getInetAddress
(com.typesafe.config.Config config, String path) static InetSocketAddress
getInetSocketAddress
(com.typesafe.config.Config config, String path) abstract KeyAgreementPublicKey
static KeyAgreementPublicKey
getKeyAgreementPublicKey
(com.typesafe.config.Config config, String path) Gets theKeyAgreementPublicKey
at the given path.abstract KeyAgreementSecretKey
static KeyAgreementSecretKey
getKeyAgreementSecretKey
(com.typesafe.config.Config config, String path) Gets theKeyAgreementSecretKey
at the given path.abstract int
abstract int
static Path
Gets thePath
at the given path.abstract com.google.common.collect.ImmutableSet<DrasylPlugin>
static Set<DrasylPlugin>
getPlugins
(com.typesafe.config.Config config, String path) static ProofOfWork
getProofOfWork
(com.typesafe.config.Config config, String path) Gets theProofOfWork
at the given path.abstract InetAddress
abstract int
abstract com.google.common.collect.ImmutableSet<PeerEndpoint>
abstract Duration
abstract Path
abstract Duration
abstract int
abstract Duration
abstract Duration
abstract int
abstract Duration
abstract byte
abstract int
abstract int
abstract Duration
abstract Duration
abstract int
abstract Duration
abstract com.google.common.collect.ImmutableMap<IdentityPublicKey,
InetSocketAddress> abstract com.google.common.collect.ImmutableSet<PeerEndpoint>
abstract InetSocketAddress
abstract Duration
abstract InetAddress
abstract int
abstract Duration
getSerializationBindings
(com.typesafe.config.Config config, String path, Collection<String> serializers) abstract com.google.common.collect.ImmutableMap<String,
Serializer> static Map<String,
Serializer> getSerializationSerializers
(com.typesafe.config.Config config, String path) static short
Gets the short at the given path.static Map<IdentityPublicKey,
InetSocketAddress> getStaticRoutes
(com.typesafe.config.Config config, String path) static URI
Gets theURI
at the given path.abstract boolean
abstract boolean
abstract boolean
abstract boolean
abstract boolean
abstract boolean
abstract boolean
abstract boolean
abstract boolean
abstract boolean
static DrasylConfig.Builder
Creates a new builder to build a customDrasylConfig
.static DrasylConfig.Builder
newBuilder
(DrasylConfig config) static DrasylConfig
of()
static DrasylConfig
of
(com.typesafe.config.Config config) static DrasylConfig
Parses a file into a Config instance as withstatic DrasylConfig
Parses a file into a Config instance as with
-
Field Details
-
NETWORK_ID
- See Also:
-
IDENTITY_PROOF_OF_WORK
- See Also:
-
IDENTITY_PUBLIC_KEY
- See Also:
-
IDENTITY_SECRET_KEY
- See Also:
-
IDENTITY_KEY_AGREEMENT_PUBLIC_KEY
- See Also:
-
IDENTITY_KEY_AGREEMENT_SECRET_KEY
- See Also:
-
IDENTITY_PATH
- See Also:
-
MESSAGE_BUFFER_SIZE
- See Also:
-
REMOTE_ENABLED
- See Also:
-
REMOTE_BIND_HOST
- See Also:
-
REMOTE_BIND_PORT
- See Also:
-
REMOTE_ENDPOINTS
- See Also:
-
REMOTE_EXPOSE_ENABLED
- See Also:
-
REMOTE_PING_INTERVAL
- See Also:
-
REMOTE_PING_TIMEOUT
- See Also:
-
REMOTE_PING_COMMUNICATION_TIMEOUT
- See Also:
-
REMOTE_PING_MAX_PEERS
- See Also:
-
REMOTE_UNITE_MIN_INTERVAL
- See Also:
-
REMOTE_SUPER_PEER_ENABLED
- See Also:
-
REMOTE_SUPER_PEER_ENDPOINTS
- See Also:
-
REMOTE_STATIC_ROUTES
- See Also:
-
REMOTE_LOCAL_HOST_DISCOVERY_ENABLED
- See Also:
-
REMOTE_LOCAL_HOST_DISCOVERY_PATH
- See Also:
-
REMOTE_LOCAL_HOST_DISCOVERY_LEASE_TIME
- See Also:
-
REMOTE_LOCAL_HOST_DISCOVERY_WATCH_ENABLED
- See Also:
-
REMOTE_LOCAL_NETWORK_DISCOVERY_ENABLED
- See Also:
-
REMOTE_MESSAGE_MTU
- See Also:
-
REMOTE_MESSAGE_MAX_CONTENT_LENGTH
- See Also:
-
REMOTE_MESSAGE_COMPOSED_MESSAGE_TRANSFER_TIMEOUT
- See Also:
-
REMOTE_MESSAGE_HOP_LIMIT
- See Also:
-
REMOTE_MESSAGE_ARM_PROTOCOL_ENABLED
- See Also:
-
REMOTE_MESSAGE_ARM_PROTOCOL_SESSION_MAX_COUNT
- See Also:
-
REMOTE_MESSAGE_ARM_PROTOCOL_SESSION_EXPIRE_AFTER
- See Also:
-
REMOTE_MESSAGE_ARM_APPLICATION_ENABLED
- See Also:
-
REMOTE_MESSAGE_ARM_APPLICATION_AGREEMENT_MAX_COUNT
- See Also:
-
REMOTE_MESSAGE_ARM_APPLICATION_AGREEMENT_EXPIRE_AFTER
- See Also:
-
REMOTE_MESSAGE_ARM_APPLICATION_AGREEMENT_RETRY_INTERVAL
- See Also:
-
REMOTE_TCP_FALLBACK_ENABLED
- See Also:
-
REMOTE_TCP_FALLBACK_SERVER_BIND_HOST
- See Also:
-
REMOTE_TCP_FALLBACK_SERVER_BIND_PORT
- See Also:
-
REMOTE_TCP_FALLBACK_CLIENT_TIMEOUT
- See Also:
-
REMOTE_TCP_FALLBACK_CLIENT_ADDRESS
- See Also:
-
INTRA_VM_DISCOVERY_ENABLED
- See Also:
-
CHANNEL_INACTIVITY_TIMEOUT
- See Also:
-
PLUGINS
- See Also:
-
SERIALIZATION_SERIALIZERS
- See Also:
-
SERIALIZATION_BINDINGS_INBOUND
- See Also:
-
SERIALIZATION_BINDINGS_OUTBOUND
- See Also:
-
-
Constructor Details
-
DrasylConfig
public DrasylConfig()
-
-
Method Details
-
of
-
of
-
getProofOfWork
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
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
- Throws:
DrasylConfigException
- if value at path is invalid
-
getEndpointSet
- Throws:
DrasylConfigException
- if value at path is invalid
-
getEndpoint
- Throws:
DrasylConfigException
- if value at path is invalid
-
getShort
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
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
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
- Throws:
DrasylConfigException
- if value at path is invalid
-
getSerializationSerializers
public static Map<String,Serializer> getSerializationSerializers(com.typesafe.config.Config config, String path) -
getSerializationBindings
-
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,InetSocketAddress> getStaticRoutes(com.typesafe.config.Config config, String path) - Throws:
DrasylConfigException
- if value at path is invalid
-
parseFile
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
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
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
-
getNetworkId
public abstract int getNetworkId() -
getIdentityProofOfWork
-
getIdentityPublicKey
-
getIdentitySecretKey
-
getIdentity
- Returns:
- the identity specified in
getIdentityPublicKey()
,getIdentitySecretKey()
, andgetIdentityProofOfWork()
ornull
if some of these properties are not present. - Throws:
IllegalStateException
- if the key pair returned bygetIdentityPublicKey()
andgetIdentitySecretKey()
is notnull
and can not be converted to a key agreement key pair OR thegetIdentityProofOfWork()
does not match to the identity key pair/required difficulty specified inIdentity.POW_DIFFICULTY
.
-
getKeyAgreementPublicKey
-
getKeyAgreementSecretKey
-
getIdentityPath
-
getMessageBufferSize
public abstract int getMessageBufferSize() -
isRemoteEnabled
public abstract boolean isRemoteEnabled() -
getRemoteBindHost
-
getRemoteBindPort
public abstract int getRemoteBindPort() -
getRemoteEndpoints
-
isRemoteExposeEnabled
public abstract boolean isRemoteExposeEnabled() -
getRemotePingInterval
-
getRemotePingTimeout
-
getRemotePingCommunicationTimeout
-
getRemotePingMaxPeers
public abstract int getRemotePingMaxPeers() -
getRemoteUniteMinInterval
-
isRemoteSuperPeerEnabled
public abstract boolean isRemoteSuperPeerEnabled() -
getRemoteSuperPeerEndpoints
-
getRemoteStaticRoutes
public abstract com.google.common.collect.ImmutableMap<IdentityPublicKey,InetSocketAddress> getRemoteStaticRoutes() -
isRemoteLocalHostDiscoveryEnabled
public abstract boolean isRemoteLocalHostDiscoveryEnabled() -
getRemoteLocalHostDiscoveryPath
-
getRemoteLocalHostDiscoveryLeaseTime
-
isRemoteLocalHostDiscoveryWatchEnabled
public abstract boolean isRemoteLocalHostDiscoveryWatchEnabled() -
isRemoteLocalNetworkDiscoveryEnabled
public abstract boolean isRemoteLocalNetworkDiscoveryEnabled() -
getRemoteMessageMtu
public abstract int getRemoteMessageMtu() -
getRemoteMessageMaxContentLength
public abstract int getRemoteMessageMaxContentLength() -
getRemoteMessageComposedMessageTransferTimeout
-
getRemoteMessageHopLimit
public abstract byte getRemoteMessageHopLimit() -
isRemoteMessageArmProtocolEnabled
public abstract boolean isRemoteMessageArmProtocolEnabled() -
getRemoteMessageArmProtocolSessionMaxCount
public abstract int getRemoteMessageArmProtocolSessionMaxCount() -
getRemoteMessageArmProtocolSessionExpireAfter
-
isRemoteMessageArmApplicationEnabled
public abstract boolean isRemoteMessageArmApplicationEnabled() -
getRemoteMessageArmApplicationAgreementMaxCount
public abstract int getRemoteMessageArmApplicationAgreementMaxCount() -
getRemoteMessageArmApplicationAgreementExpireAfter
-
getRemoteMessageArmApplicationAgreementRetryInterval
-
isRemoteTcpFallbackEnabled
public abstract boolean isRemoteTcpFallbackEnabled() -
getRemoteTcpFallbackServerBindHost
-
getRemoteTcpFallbackServerBindPort
public abstract int getRemoteTcpFallbackServerBindPort() -
getRemoteTcpFallbackClientTimeout
-
getRemoteTcpFallbackClientAddress
-
isIntraVmDiscoveryEnabled
public abstract boolean isIntraVmDiscoveryEnabled() -
getPlugins
-
getSerializationSerializers
public abstract com.google.common.collect.ImmutableMap<String,Serializer> getSerializationSerializers() -
getSerializationsBindingsInbound
-
getSerializationsBindingsOutbound
-
getChannelInactivityTimeout
-