-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
68 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,48 @@ | ||
const TTL = 300; | ||
|
||
const CHECK_INTERVAL = 500; | ||
const TIMEOUT_DURATION = 2 * 60000; | ||
const TIME_CLEAN_MSG = 30 * 60000; | ||
const TTL = 300; | ||
const DEFAULT_TIMEOUT = 10000; | ||
const TWO_DAYS = 2 * 24 * 60 * 60 * 1000; | ||
|
||
const ERROR = 'ERROR'; | ||
const HANDSHAKE = 'HANDSHAKE'; | ||
const DM = 'MESSAGE'; | ||
const CRYPTO_DM = 'CRYPTO_DM'; | ||
const ERROR = 'ERROR'; | ||
const PUBLIC_KEY_REQUEST = 'PUBLIC_KEY_REQUEST'; | ||
const PUBLIC_KEY_RESPONSE = 'PUBLIC_KEY_RESPONSE'; | ||
|
||
const TIMEOUT_ERROR_MESSAGE = `Neighbor check timed out after ${TIMEOUT_DURATION / 1000} seconds`; | ||
const TIMEOUT_ERROR_REQUEST = 'RSA key retrieval timed out.'; | ||
const DECRYPT_ERROR = 'Unable to decrypt the message.'; | ||
const SEND_ERROR = 'Failed to send the data.'; | ||
const PUBLISH_ERROR = 'Failed to publish the data.'; | ||
const DEFAULT_TIMEOUT = 10000; | ||
const TWO_DAYS = 2 * 24 * 60 * 60 * 1000; | ||
module.exports = { | ||
PUBLIC_KEY_REQUEST, | ||
PUBLIC_KEY_RESPONSE, | ||
HANDSHAKE, | ||
DEFAULT_TIMEOUT, | ||
TIMEOUT_ERROR_REQUEST, | ||
TIME_CLEAN_MSG, | ||
CHECK_INTERVAL, | ||
TIMEOUT_DURATION, | ||
TIMEOUT_ERROR_MESSAGE, | ||
const SOCKET_ERROR = 'An error occurred with the socket connection.'; | ||
|
||
const CONSTANTS = { | ||
TIMEOUTS: { | ||
CHECK_INTERVAL, | ||
TIMEOUT_DURATION, | ||
TIME_CLEAN_MSG, | ||
DEFAULT_TIMEOUT, | ||
TWO_DAYS, | ||
}, | ||
EVENTS: { DM, CRYPTO_DM, ERROR }, | ||
MESSAGES: { | ||
HANDSHAKE, | ||
PUBLIC_KEY_REQUEST, | ||
PUBLIC_KEY_RESPONSE, | ||
}, | ||
ERRORS: { | ||
TIMEOUT_ERROR_MESSAGE, | ||
TIMEOUT_ERROR_REQUEST, | ||
DECRYPT_ERROR, | ||
SEND_ERROR, | ||
PUBLISH_ERROR, | ||
SOCKET_ERROR, | ||
}, | ||
TTL, | ||
CRYPTO_DM, | ||
DM, | ||
TWO_DAYS, | ||
ERROR, | ||
SEND_ERROR, | ||
DECRYPT_ERROR, | ||
PUBLISH_ERROR, | ||
}; | ||
|
||
module.exports = CONSTANTS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters