I am writing a simple script in D that needs to interface with command-line network programs that use IP domain addresses (e.g. 10.0.14.0/24
).
Is there any ready parser existing for that in D?
Something, that can validate a domain and break it into elements.
I dug up my old code and formatted it a bit for github. It is probably buggy though:
https://github.com/adamdruppe/arsd/blob/master/cidr.d
You use it like
import cidr;
import std.stdio;
void main() {
auto block = IPv4Block("192.168.1.0/24");
foreach(address; block) writeln(address);
}
and stuff like that.