cockpit-machines
cockpit-machines copied to clipboard
Switch to a different IP implementation
In our webpack.config.js we have a todo about the ip module:
// TODO: The following fallbacks are needed for ip module - replace this module with one better maintained
fallback: {
"browser": false,
"os": false,
"buffer": require.resolve("buffer"),
}
In src/components/networks/utils.js
we use the ip module to validate various parts of IP address validity, netmask, broadcast address, format, etc.
A promising candidate is ipaddr.js, no external deps. Alternative ip-address
Latest version 2.0.0 solves the buffer ssue but the 'os' workaround is still needed. Opened an upstream issue for this https://github.com/indutny/node-ip/issues/127
We now use ipaddr.js f27fc31c514be87f643153b4a3b64ba7300c6f34