[Freeipa-devel] [PATCH] 060 Parsing of IPv4 and IPv6 addresses

Petr Vobornik pvoborni at redhat.com
Wed Dec 21 13:50:37 UTC 2011


On 12/20/2011 09:57 PM, Endi Sukma Dewata wrote:
>
> The code isn't used yet in the main code, so it can be pushed without
> breaking anything. I have some suggestions though:
>
> 1. For convenience, the IP.address class probably can be made to take a
> string or a spec object then call parse() internally. For example:
>
> var address1 = IP.address('127.0.0.1');
Added
>
> var address2 = IP.address({
> parts: [127, 0, 0, 1]
> type: 'v4-quads'
> });
>
Added, but I don't see a usage for this.

> var reverse = address1.get_reverse();

Address is parsed internally. You can also set the input after creating 
an address - as it was before.

Added some tests to show the usages.
>
> 2. The test checks the return value of parse() but it doesn't validate
> whether the IP address is parsed into the correct parts. It probably
> should do something like this:
>
> var address = IP.address('127.0.0.1');
> same(address.parts, [127, 0, 0, 1]);

Added
>
> 3. The ip_tests.html should be linked from the index.html.

Added
>
> 4. It's probably better to use NET instead of IP for the namespace so we
> can add more net-related stuff.
>
Changed. Test are still called ip_tests - I wouldn't put there any new 
non-ip-address related.


For convenience I also attached a 'diff' patch.

-- 
Petr Vobornik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-pvoborni-0060-2-Parsing-of-IPv4-and-IPv6-addresses.patch
Type: text/x-patch
Size: 28458 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20111221/21d3698e/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wip-freeipa-pvoborni-0066-Review-changes.patch
Type: text/x-patch
Size: 21398 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20111221/21d3698e/attachment-0001.bin>


More information about the Freeipa-devel mailing list