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
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
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) static List<InetSocketAddress>
getInetSocketAddressList
(com.typesafe.config.Config config, String path) static KeyAgreementPublicKey
getKeyAgreementPublicKey
(com.typesafe.config.Config config, String path) Gets theKeyAgreementPublicKey
at the given path.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 Set<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 Duration
abstract Duration
abstract Path
abstract Duration
abstract int
abstract Duration
abstract Duration
abstract int
abstract Duration
abstract Duration
abstract Duration
abstract int
abstract Duration
abstract byte
abstract int
abstract int
abstract Duration
abstract Duration
abstract int
abstract Duration
abstract Map<DrasylAddress,
InetSocketAddress> abstract Set<PeerEndpoint>
abstract InetSocketAddress
abstract Duration
abstract InetAddress
abstract int
abstract Duration
getSerializationBindings
(com.typesafe.config.Config config, String path, Collection<String> serializers) abstract Map<String,
Serializer> static Map<String,
Serializer> getSerializationSerializers
(com.typesafe.config.Config config, String path) static short
Gets the short at the given path.abstract List<SocketAddress>
static Map<DrasylAddress,
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
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.static DrasylConfig
Parses a file path into a Config instance.static DrasylConfig
Parses a file path into a Config instance.static DrasylConfig
Parses a string into a Config instance.
-
Field Details
-
NETWORK_ID
- See Also:
-
IDENTITY_PROOF_OF_WORK
- See Also:
-
IDENTITY_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_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_HANDSHAKE_TIMEOUT
- 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_MESSAGE_ARQ_ENABLED
- See Also:
-
REMOTE_MESSAGE_ARQ_WINDOW_SIZE
- See Also:
-
REMOTE_MESSAGE_ARQ_RETRY_TIMEOUT
- See Also:
-
REMOTE_MESSAGE_ARQ_DEAD_PEER_TIMEOUT
- See Also:
-
REMOTE_MESSAGE_ARQ_CLOCK
- 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:
-
SNTP_SERVER
- 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
-
getInetSocketAddressList
public static List<InetSocketAddress> getInetSocketAddressList(com.typesafe.config.Config config, String path) - Throws:
DrasylConfigException
- if value at path is invalid
-
getStaticRoutes
public static Map<DrasylAddress,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.- Parameters:
file
- the file to parse- Returns:
- the parsed configuration
- Throws:
DrasylConfigException
- on IO or parse errors
-
parseFile
Parses a file path into a Config instance.- Parameters:
path
- the path to file to parse- Returns:
- the parsed configuration
- Throws:
DrasylConfigException
- on IO or parse errors
-
parseFile
Parses a file path into a Config instance.- Parameters:
path
- the path to file to parse- Returns:
- the parsed configuration
- Throws:
DrasylConfigException
- on IO or parse errors
-
parseString
Parses a string into a Config instance.- 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
-
getIdentitySecretKey
-
getIdentity
- Returns:
- the identity specified in
getIdentitySecretKey()
, andgetIdentityProofOfWork()
ornull
if some of these properties are not present. - Throws:
IllegalStateException
- if the key pair returned bygetIdentitySecretKey()
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
.
-
getIdentityPath
-
getMessageBufferSize
public abstract int getMessageBufferSize() -
isRemoteEnabled
public abstract boolean isRemoteEnabled() -
getRemoteBindHost
-
getRemoteBindPort
public abstract int getRemoteBindPort() -
isRemoteExposeEnabled
public abstract boolean isRemoteExposeEnabled() -
getRemotePingInterval
-
getRemotePingTimeout
-
getRemotePingCommunicationTimeout
-
getRemotePingMaxPeers
public abstract int getRemotePingMaxPeers() -
getRemoteUniteMinInterval
-
isRemoteSuperPeerEnabled
public abstract boolean isRemoteSuperPeerEnabled() -
getRemoteSuperPeerEndpoints
-
getRemoteStaticRoutes
-
getRemoteHandshakeTimeout
-
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
-
isRemoteMessageArqEnabled
public abstract boolean isRemoteMessageArqEnabled() -
getRemoteMessageArqWindowSize
public abstract int getRemoteMessageArqWindowSize() -
getRemoteMessageArqRetryTimeout
-
getRemoteMessageArqDeadPeerTimeout
-
getRemoteMessageArqClock
-
isRemoteTcpFallbackEnabled
public abstract boolean isRemoteTcpFallbackEnabled() -
getRemoteTcpFallbackServerBindHost
-
getRemoteTcpFallbackServerBindPort
public abstract int getRemoteTcpFallbackServerBindPort() -
getRemoteTcpFallbackClientTimeout
-
getRemoteTcpFallbackClientAddress
-
isIntraVmDiscoveryEnabled
public abstract boolean isIntraVmDiscoveryEnabled() -
getSntpServers
-
getPlugins
-
getSerializationSerializers
-
getSerializationsBindingsInbound
-
getSerializationsBindingsOutbound
-
getChannelInactivityTimeout
-