Giter Club home page Giter Club logo

Comments (3)

twisteroidambassador avatar twisteroidambassador commented on May 28, 2024

Just curious, is there a reason why you used gethostbyname instead of getaddrinfo? There's an async version of getaddrinfo available as AbstractEventLoop.getaddrinfo(host, port, *, family=0, type=0, proto=0, flags=0).

from aioice.

jlaine avatar jlaine commented on May 28, 2024

I'm using gethostbyname as we absolutely want only IPv4 addresses, does that make sense?

from aioice.

twisteroidambassador avatar twisteroidambassador commented on May 28, 2024

Um, not really?
My best guess: If a STUN server is dual-stack, a naive address resolution method may use only one IPv6 address, while a STUN server is much more useful for discovering IPv4 candidates because IPv4 is much more likely to be behind NAT.
If that's the case, then the best course of action is probably: If the host name resolves to both IPv4 and IPv6 addresses, take one of each and use them as two separate STUN servers.
And now I wonder whether any of the RFCs mention host name resolution for dual-stack STUN servers.

Anyways, getaddrinfo(..., family=socket.AF_INET) should also restrict resolution results to IPv4 addresses.

(I was a bit startled to see run_in_executor, but it turns out loop.getaddrinfo() is also implemented by running the synchronous socket.getaddrinfo() in an executor, so not much of an improvement there.)

from aioice.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.