[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ipng
Subject:    Re: [IPv6] get_addr_pairs()
From:       Brian E Carpenter <brian.e.carpenter () gmail ! com>
Date:       2023-11-30 4:29:08
Message-ID: 91181c38-f6e1-38b9-2b7a-11aa4978f73d () gmail ! com
[Download RAW message or body]

Dave,

Meant to say thanks for this weeks ago. I aimed at portable code, so I can't use this \
directly, but it's good to know. My prototype, like getaddrinfo(), can handle an \
address as input as well as an FQDN, but only one at a time.

Everybody,

I've just written up a description of how the code works, at \
https://github.com/becarpenter/getapr/blob/main/ProofOfConcept.md

Regards
    Brian Carpenter

On 04-Oct-23 09:51, dthaler1968@googlemail.com wrote:
> I haven't read the rest of this thread but FYI there is already a Windows
> API to do this:
> https://learn.microsoft.com/en-us/windows/win32/api/netioapi/nf-netioapi-cre
> atesortedaddresspairs
> 
> You can take a set of destination IP's returned from getaddrinfo() or any
> other address exchange
> mechanism (e.g., SIP or whatever else), and pass the list into
> CreateSortedAddressPairs().
> We chose this approach rather than limiting it to hostname resolution as in
> your email below,
> so that it can be used by more applications than just ones that deal with
> names.
> For example, there might be game lobbys that return client IP's to other
> clients, or there might be
> other host-to-host communication protocols that do IP/port exchange using
> STUN or TURN
> (including for IPv6 [RFC6156]) which would work with the above mechanism but
> not with
> the syntax in the email below.
> 
> Dave
> 
> > -----Original Message-----
> > From: ipv6 <ipv6-bounces@ietf.org> On Behalf Of Brian E Carpenter
> > Sent: Sunday, October 1, 2023 6:25 PM
> > To: 6man <ipv6@ietf.org>
> > Subject: [IPv6] get_addr_pairs()
> > 
> > Hi,
> > 
> > A few weeks ago I suggested that we needed an API like get_addr_pairs() in
> > place of getaddrinfo(), because the latter does not provide a way to
> choose
> > the most appropriate source address. Somebody said that was impossible, so
> > I decided to find out.
> > 
> > There's now a prototype Python implementation at
> > https://github.com/becarpenter/getapr
> > 
> > Please see the README.md file for an explanation; it's been tested on
> > Windows 10 and Linux 5.4.0, and it might also work on any other POSIX-
> > compliant system with Python 3.9 or higher. It's clear that ideally this
> would
> > be implemented as a kernel function, but that's beyond my capability.
> > 
> > Comments and issues welcome.
> > 
> > Regards
> > Brian Carpenter
> > 
> > P.S. A call to getapr.get_addr_pairs("www.ietf.org", 80)
> > 
> > gets back a reply like:
> > 
> > [(<AddressFamily.AF_INET6: 23>,
> > ('2406:e003:110d:5301:8cb6:c2a:7461:a047', 0, 0, 0),
> ('2606:4700::6810:2d63',
> > 80, 0, 0)),
> > (<AddressFamily.AF_INET6: 23>, ('2406:e003:110d:5301:8cb6:c2a:7461:a047',
> > 0, 0, 0), ('2606:4700::6810:2c63', 80, 0, 0)),
> > (<AddressFamily.AF_INET: 2>, ('192.168.178.42', 0), ('104.16.45.99', 80)),
> > (<AddressFamily.AF_INET: 2>, ('192.168.178.42', 0), ('104.16.44.99', 80))]
> > 
> > which provides the correct formats for bind() and connect() calls in
> Python.
> > 
> > --------------------------------------------------------------------
> > IETF IPv6 working group mailing list
> > ipv6@ietf.org
> > Administrative Requests: https://www.ietf.org/mailman/listinfo/ipv6
> > --------------------------------------------------------------------
> 

--------------------------------------------------------------------
IETF IPv6 working group mailing list
ipv6@ietf.org
Administrative Requests: https://www.ietf.org/mailman/listinfo/ipv6
--------------------------------------------------------------------


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic