/** * Shared constants for libp2p configuration across platforms */ export const LIBP2P_CONFIG = { // Default ports DEFAULT_TCP_PORT: 10000, DEFAULT_WS_PORT: 10001, // Connection timeouts (in milliseconds) CONNECTION_PENDING_TIMEOUT: 30000, // 30 seconds before removing pending connections CONNECTION_FAILED_VISIBILITY: 5000, // 5 seconds to keep failed connections visible CONNECTION_ACCEPTANCE_CHECK_DELAY: 5000, // 5 seconds before checking acceptance // Monitoring intervals (in milliseconds) CONNECTION_MONITOR_INTERVAL: 3000, // Check connections every 3 seconds CONNECTION_SYNC_INTERVAL: 5000, // Sync connections every 5 seconds // Protocol IDs PROTOCOLS: { CONNECTION_ACCEPT: '/metatrom/connection-accept/1.0.0', CONNECTION_ACCEPTED: '/metatrom/connection-accepted/1.0.0', }, // Connection states CONNECTION_STATUS: { PENDING: 'pending', CONNECTED: 'connected', DISCONNECTED: 'disconnected', FAILED: 'failed', CLOSING: 'closing', CLOSED: 'closed', } as const, // Connection directions CONNECTION_DIRECTION: { INBOUND: 'inbound', OUTBOUND: 'outbound', } as const, } as const; export type ConnectionStatus = (typeof LIBP2P_CONFIG.CONNECTION_STATUS)[keyof typeof LIBP2P_CONFIG.CONNECTION_STATUS]; export type ConnectionDirection = (typeof LIBP2P_CONFIG.CONNECTION_DIRECTION)[keyof typeof LIBP2P_CONFIG.CONNECTION_DIRECTION];