@projectlibertylabs/p2p-peer-test
Version:
CLI tool to test libp2p connections and discover peer protocols
50 lines (46 loc) • 1.01 kB
JavaScript
/**
* Configuration and constants for the libp2p peer tester
*/
/**
* Default configuration values
* @readonly
* @enum {number|string|Array}
*/
export const DEFAULT_CONFIG = {
TIMEOUT_MS: 10000,
DEFAULT_RETRIES: 0,
CONNECTION_MAX: 1,
IDENTIFY_TIMEOUT: 5000,
PROTOCOL_DISCOVERY_DELAY: 500,
LISTEN_ADDRESSES: ['/ip4/0.0.0.0/tcp/0', '/ip6/::/tcp/0']
};
/**
* Standardized error messages
* @readonly
* @enum {string|Function}
*/
export const ERROR_MESSAGES = {
EMPTY_MULTIADDR: 'Multiaddr cannot be empty',
INVALID_TIMEOUT: 'Timeout must be a positive number',
INVALID_RETRIES: 'Retries must be a non-negative number',
CONNECTION_TIMEOUT: (ms) => `Connection timeout after ${ms}ms`
};
/**
* Output formatting configuration for colors and symbols
* @readonly
* @enum {Object}
*/
export const OUTPUT_CONFIG = {
COLORS: {
SUCCESS: 'green',
ERROR: 'red',
WARNING: 'yellow',
INFO: 'cyan',
MUTED: 'gray'
},
SYMBOLS: {
SUCCESS: '✅',
FAILURE: '❌',
BULLET: '•'
}
};