Giter VIP home page Giter VIP logo

inet_aton's Introduction

inet_aton

Implementations of inet_ntoa() and inet_aton() in various languages.

Funny thing about Internet addresses; they're actually rather more flexible than we give them credit for.

Don't believe me? Pull up a command line in Windows, Linux, or Mac OS and type:

ping 0x7f.1

Betcha didn't know that IP addresses were that flexible, eh? As a result, I've tried to incorporate as many features of a "real" inet_ntoa/inet_aton implementation as I easily could. In particular, addresses like "127.1" will work, since they are perfectly valid. Some of the more esoteric forms (like the 0x7f.1 example, above) may not, but I encourage forks, patches and improvements.

As to why I put this up? It was one thing when I had to develop the JavaScript ones. Once I found myself doing it in Bash, I said, "To hell with it, someone else probably faced this same issue, and I can save them some time." So hopefully I've saved you some time. Then again, the likelihood of anyone casually browsing Github stumbling across this and needing it, I freely admit, is damn near zero. So: hi, Google! inet_ntoa, inet_aton, IP address translation, etc., etc. INDEX MEEEEEEEEEEE! ;)

Oh, also worth pointing out that this provides a simple way to verify IP addresses are sane and canonical: if (inet_ntoa(inet_aton(provided_address)) != provided_address) { ....

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.