Module net-socket-address
net-socket-address
Runtime agnostic core Socket IpAddr classes base on Rust implementation.
Installation
npm i net-socket-address net-address @luolapeikko/result-option
Examples
const socketAddr = new SocketAddrV4({port: 6372});
// or new SocketAddrV4({addr: Ipv4Addr.UNSPECIFIED, port: 6372});
tcpServer.listen(socketAddr..asNodeListenerOptions(), () => {});
udpSocket.bind(socketAddr, () => {});
tcpServer.listen({...socketAddr.asNodeListenerOptions(), ipv6Only: true}, () => {});
Classes
- SocketAddrV4
- SocketAddrV6