[Freeipa-devel] [PATCH] 060 Parsing of IPv4 and IPv6 addresses
Endi Sukma Dewata
edewata at redhat.com
Tue Dec 20 20:57:40 UTC 2011
On 12/20/2011 2:35 AM, Petr Vobornik wrote:
>>> Added support of parsing and validation of IPv4 and IPv6 addresses.
>>> Class IP.address can also create reverse address from any valid IPv4 or
>>> IPv6 address.
>>>
>>> This functionality is prerequisite for tickets:
>>> https://fedorahosted.org/freeipa/ticket/1466
>>> https://fedorahosted.org/freeipa/ticket/1975
>>>
>>> Ticket: https://fedorahosted.org/freeipa/ticket/1466
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');
var address2 = IP.address({
parts: [127, 0, 0, 1]
type: 'v4-quads'
});
var reverse = address1.get_reverse();
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]);
3. The ip_tests.html should be linked from the index.html.
4. It's probably better to use NET instead of IP for the namespace so we
can add more net-related stuff.
--
Endi S. Dewata
More information about the Freeipa-devel
mailing list