Code Monkey home page Code Monkey logo

Comments (6)

maelp avatar maelp commented on July 4, 2024

This seems to work

    if query_type == _lib.T_A:
        host = _ffi.new("struct hostent **")
        addrttls = _ffi.new("struct ares_addrttl[]", PYCARES_ADDRTTL_SIZE)
        naddrttls = _ffi.new("int*", PYCARES_ADDRTTL_SIZE)
        parse_status = _lib.ares_parse_a_reply(abuf, alen, host, addrttls, naddrttls)
        if parse_status != _lib.ARES_SUCCESS:
            result = None
            status = parse_status
        else:
            if host[0].h_aliases[0] != _ffi.NULL:
                result = ares_query_cname_result(host[0])
                _lib.ares_free_hostent(host[0])
            else:
                result = [ares_query_a_result(addrttls[i]) for i in range(naddrttls[0])]
            status = None

from pycares.

saghul avatar saghul commented on July 4, 2024

Nice! Is there a publicly available record we can use to test? If so, mind making a PR?

from pycares.

maelp avatar maelp commented on July 4, 2024

Well I guess we'd have to update this https://github.com/saghul/pycares/blob/master/tests/tests.py#L186 but I'm not exactly sure how we are supposed to build the response for each case?

from pycares.

saghul avatar saghul commented on July 4, 2024

Right. Up until this point I've used publicly available records instead of synthetic ones.

from pycares.

maelp avatar maelp commented on July 4, 2024

I'm not sure how we should go about generating the synthetic one, perhaps creating a fake server ?

from pycares.

saghul avatar saghul commented on July 4, 2024

Not sure, I suppose it might be tricky to test on Windows, that's why I relied on existing DNS records, though this is not ideal.

from pycares.

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.