UNPKG

@libp2p/tcp

Version:
23 lines 637 B
import os from 'os'; import path from 'path'; export function multiaddrToNetConfig(addr, config = {}) { const listenPath = addr.getPath(); // unix socket listening if (listenPath != null) { if (os.platform() === 'win32') { // Use named pipes on Windows systems. return { path: path.join('\\\\.\\pipe\\', listenPath) }; } else { return { path: listenPath }; } } const options = addr.toOptions(); // tcp listening return { ...config, ...options, ipv6Only: options.family === 6 }; } //# sourceMappingURL=utils.js.map