Skip to content

IPv6 string representation #25

Open

Description

@jimmykao89

Hi,

I was wondering, do the strings output from iptools conform to RFC 5952 for IPv6? Thanks

Activity

  1. bd808 commented on Aug 31, 2020

    @bd808
    Owner

    I believe it mostly is, but there is not a strong conformance test suite to ensure this. I tried the explicit examples from https://tools.ietf.org/html/rfc5952#page-10 and they all seem to be output as the RFC suggests:

    >>> from iptools.ipv6 import (ip2long, long2ip)
    >>> long2ip(ip2long("2001:0db8::0001"))
    '2001:db8::1'
    >>> long2ip(ip2long("2001:db8:0:0:0:0:2:1"))
    '2001:db8::2:1'
    >>> long2ip(ip2long("2001:db8::1:1:1:1:1"))
    '2001:db8:0:1:1:1:1:1'
    >>> long2ip(ip2long("2001:db8:0:0:1:0:0:1"))
    '2001:db8::1:0:0:1'

    There is currently no special output handling for IPv4-Mapped addresses. This is recommended in RFC 5952, but not required.

    >>> long2ip(ip2long("::ffff:192.0.2.1"))
    '::ffff:c000:201'
  2. jimmykao89 commented on Aug 31, 2020

    @jimmykao89
    Author

    Ok, thanks for the speedy reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions