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
Nested Classes -
Field Summary
FieldsModifier 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
-
Constructor Summary
Constructors -
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
Deprecated.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
Deprecated.abstract int
abstract Duration
Deprecated.abstract Duration
Deprecated.abstract Path
Deprecated.abstract Duration
abstract int
abstract Duration
abstract Duration
Deprecated.abstract int
Deprecated.abstract byte
Deprecated.abstract Duration
Deprecated.abstract Duration
Deprecated.abstract int
abstract Duration
abstract Map<DrasylAddress,
InetSocketAddress> Deprecated.abstract Set<PeerEndpoint>
abstract int
Deprecated.abstract InetAddress
Deprecated.abstract int
Deprecated.abstract Duration
Deprecated.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>
Deprecated.static Map<DrasylAddress,
InetSocketAddress> getStaticRoutes
(com.typesafe.config.Config config, String path) static URI
Gets theURI
at the given path.abstract boolean
abstract boolean
Deprecated.abstract boolean
Deprecated.abstract boolean
Deprecated.abstract boolean
Deprecated.abstract boolean
Deprecated.abstract boolean
abstract boolean
Deprecated.abstract boolean
Deprecated.abstract boolean
Deprecated.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_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_CONNECT_PORT
- 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
Deprecated. -
isRemoteEnabled
Deprecated. -
getRemoteBindHost
Deprecated. -
getRemoteBindPort
public abstract int getRemoteBindPort() -
isRemoteExposeEnabled
Deprecated. -
getRemotePingInterval
Deprecated. -
getRemotePingTimeout
-
getRemotePingCommunicationTimeout
Deprecated. -
getRemotePingMaxPeers
public abstract int getRemotePingMaxPeers() -
getRemoteUniteMinInterval
Deprecated. -
isRemoteSuperPeerEnabled
Deprecated. -
getRemoteSuperPeerEndpoints
-
getRemoteStaticRoutes
Deprecated. -
getRemoteHandshakeTimeout
Deprecated. -
isRemoteLocalHostDiscoveryEnabled
Deprecated. -
getRemoteLocalHostDiscoveryPath
Deprecated. -
getRemoteLocalHostDiscoveryLeaseTime
Deprecated. -
isRemoteLocalHostDiscoveryWatchEnabled
Deprecated. -
isRemoteLocalNetworkDiscoveryEnabled
Deprecated. -
getRemoteMessageHopLimit
Deprecated. -
isRemoteMessageArmProtocolEnabled
Deprecated. -
getRemoteMessageArmProtocolSessionMaxCount
Deprecated. -
getRemoteMessageArmProtocolSessionExpireAfter
Deprecated. -
isRemoteMessageArmApplicationEnabled
public abstract boolean isRemoteMessageArmApplicationEnabled() -
getRemoteMessageArmApplicationAgreementMaxCount
public abstract int getRemoteMessageArmApplicationAgreementMaxCount() -
getRemoteMessageArmApplicationAgreementExpireAfter
-
getRemoteMessageArmApplicationAgreementRetryInterval
-
isRemoteTcpFallbackEnabled
Deprecated. -
getRemoteTcpFallbackServerBindHost
Deprecated. -
getRemoteTcpFallbackServerBindPort
Deprecated. -
getRemoteTcpFallbackClientConnectPort
Deprecated. -
isIntraVmDiscoveryEnabled
public abstract boolean isIntraVmDiscoveryEnabled() -
getSntpServers
Deprecated. -
getPlugins
-
getSerializationSerializers
-
getSerializationsBindingsInbound
-
getSerializationsBindingsOutbound
-
getChannelInactivityTimeout
-