Skip to content

Instantly share code, notes, and snippets.

@suryapratap
Created October 20, 2020 05:39
Show Gist options
  • Save suryapratap/29b73762ffc98a9f8e4379f4b3d9ef20 to your computer and use it in GitHub Desktop.
Save suryapratap/29b73762ffc98a9f8e4379f4b3d9ef20 to your computer and use it in GitHub Desktop.
simple helper function to generate nip.io url from a given IPV4
function ip2nipHex(ipv4){
return `http://${(ipv4.split('.').map(x=>parseInt(x).toString(16)).map(x=>('00'+x).substring(x.length)).join(''))}.nip.io`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment