@libp2p/tcp
Version:
A TCP transport for libp2p
23 lines • 637 B
JavaScript
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