1

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.

Adam Ryczkowski
  • 7,592
  • 13
  • 42
  • 68
  • 2
    the vocab word you're looking for is "CIDR notation". and I know I've written this before but idk if I still have it. – Adam D. Ruppe Oct 25 '15 at 19:51

1 Answers1

1

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.

Adam D. Ruppe
  • 25,382
  • 4
  • 41
  • 60