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 Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byteGets the byte at the given path.abstract Durationstatic PeerEndpointgetEndpoint(com.typesafe.config.Config config, String path) static Set<PeerEndpoint>getEndpointSet(com.typesafe.config.Config config, String path) abstract Pathabstract ProofOfWorkabstract IdentityPublicKeystatic IdentityPublicKeygetIdentityPublicKey(com.typesafe.config.Config config, String path) Gets theIdentityPublicKeyat the given path.abstract IdentitySecretKeystatic IdentitySecretKeygetIdentitySecretKey(com.typesafe.config.Config config, String path) Gets theIdentitySecretKeyat the given path.static InetAddressgetInetAddress(com.typesafe.config.Config config, String path) static InetSocketAddressgetInetSocketAddress(com.typesafe.config.Config config, String path) abstract KeyAgreementPublicKeystatic KeyAgreementPublicKeygetKeyAgreementPublicKey(com.typesafe.config.Config config, String path) Gets theKeyAgreementPublicKeyat the given path.abstract KeyAgreementSecretKeystatic KeyAgreementSecretKeygetKeyAgreementSecretKey(com.typesafe.config.Config config, String path) Gets theKeyAgreementSecretKeyat the given path.abstract intabstract intstatic PathGets thePathat the given path.abstract Set<DrasylPlugin>static Set<DrasylPlugin>getPlugins(com.typesafe.config.Config config, String path) static ProofOfWorkgetProofOfWork(com.typesafe.config.Config config, String path) Gets theProofOfWorkat the given path.abstract InetAddressabstract intabstract Set<PeerEndpoint>abstract Durationabstract Pathabstract Durationabstract intabstract Durationabstract Durationabstract intabstract Durationabstract byteabstract intabstract intabstract Durationabstract Durationabstract intabstract Durationabstract Map<DrasylAddress,InetSocketAddress> abstract Set<PeerEndpoint>abstract InetSocketAddressabstract Durationabstract InetAddressabstract intabstract DurationgetSerializationBindings(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 shortGets the short at the given path.static Map<DrasylAddress,InetSocketAddress> getStaticRoutes(com.typesafe.config.Config config, String path) static URIGets theURIat the given path.abstract booleanabstract booleanabstract booleanabstract booleanabstract booleanabstract booleanabstract booleanabstract booleanabstract booleanabstract booleanstatic DrasylConfig.BuilderCreates a new builder to build a customDrasylConfig.static DrasylConfig.BuildernewBuilder(DrasylConfig config) static DrasylConfigof()static DrasylConfigof(com.typesafe.config.Config config) static DrasylConfigParses a file into a Config instance as withstatic DrasylConfigParses 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 theProofOfWorkat 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
ProofOfWorkvalue 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 theIdentityPublicKeyat 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
IdentityPublicKeyvalue 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 theIdentitySecretKeyat 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
IdentitySecretKeyvalue 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 theKeyAgreementPublicKeyat 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
IdentityPublicKeyvalue 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 theKeyAgreementSecretKeyat 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
IdentitySecretKeyvalue at the requested path - Throws:
DrasylConfigException- if value is not convertible to aIdentitySecretKey
-
getPath
Gets thePathat the given path.- Parameters:
config- the application's portion of the configurationpath- path expression- Returns:
- the
Pathvalue 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 theURIat the given path.- Parameters:
config- the application's portion of the configurationpath- path expression- Returns:
- the
URIvalue 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<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 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()ornullif some of these properties are not present. - Throws:
IllegalStateException- if the key pair returned bygetIdentityPublicKey()andgetIdentitySecretKey()is notnulland 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
-
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
-
getSerializationsBindingsInbound
-
getSerializationsBindingsOutbound
-
getChannelInactivityTimeout
-