ns1 / ipx Goto Github PK
View Code? Open in Web Editor NEWExtended IP operations for Go
License: MIT License
Extended IP operations for Go
License: MIT License
Right now, we don't have any logic for comparing IPs and nets.
You might imagine a CmpIP(a, b net.IP) int
, CmpNet(a, b net.IPNet) int
sort of signature.
ipaddress
would blow up if you compared v4 and v6; we could panic, too, maybe?
The uint128 type is at the heart of all our ipv6 work but has no direct units or benchmarking.
We should verify its correctness with tests and benchmarks -- and then maybe make it faster.
It'd probably be helpful to export a reverse dns pointer helper as ipaddress
does. This is straightforward for ipv4 but slightly more complicated for ipv6.
_, n, _ := net.ParseCIDR("172.18.11.0/24")
ptr := ReversePointerNet(n)
fmt.Println(ptr)
Output: 11.18.172.in-addr.arpa
It'd probably be useful to have SortIPs(ips []net.IP)
and SortNets(nets []*net.IPNet)
.
Questions include how to handle v4 vs v6 illegal args and what does an absolute ordering for networks look like?
Right now, the IP increment logic will probably just wrap around on overflow. Is that desired? We should decide and document / add tests that demo it.
We need tests verifying that the v4/v6 logic behaves appropriately when hitting mins or maxes for their types. That probably looks like a) deciding what is appropriate, b) writing tests and c) making those tests pass.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.