'net' module: tests and fixes

So far this updates #308 with a very basic test suite, and fixes IPv4 and/or IPv6 address detection.
Can we add `ttt` as a dependency? Should be version 1.0.3. Without it the Travis tests fail.