Code Monkey home page Code Monkey logo

Comments (6)

ValentinBELYN avatar ValentinBELYN commented on August 28, 2024

Hi @audeoudh 👋

Wow! Thank you for taking the time to detail your request.

I'll see how to implement this for the next release.

from icmplib.

sunwire avatar sunwire commented on August 28, 2024

I'll see how to implement this for the next release.

Just replace this line

self._sock.sendto(packet, (request.destination, 0))

with this line

self._sock.sendto(packet,socket.getaddrinfo(request.destination, port=None, family=socket.AF_INET if self._IP_VERSION == 4 else socket.AF_INET6, type=socket.SOCK_DGRAM)[0][4])

I've tested it and it looks like everything works

host = ping('fe80::d250:99ff:fe28:7d19%em1' ,count=10, interval=0.2, privileged=False)
(host.address ,host.avg_rtt ,host.is_alive ,host.jitter ,host.max_rtt ,host.min_rtt ,host.packet_loss ,host.packets_received ,host.packets_sent)
('fe80::d250:99ff:fe28:7d19%em1', 0.355, True, 0.17, 0.751, 0.139, 0.0, 10, 10)

host = ping('localhost' ,count=10, interval=0.2, privileged=False)
 (host.address ,host.avg_rtt ,host.is_alive ,host.jitter ,host.max_rtt ,host.min_rtt ,host.packet_loss ,host.packets_received ,host.packets_sent)
('127.0.0.1', 0.462, True, 0.093, 0.604, 0.386, 0.0, 10, 10)

from icmplib.

ValentinBELYN avatar ValentinBELYN commented on August 28, 2024

Hi @sunwire,

Sorry for the delay.

It is not so simple. I'm trying to avoid putting any code related to IPv6 in the ICMPSocket class. The ideal would be to place this code in the ICMPv6Socket class. However, this class does not have its own send method. I have to find a solution not to duplicate the code.

from icmplib.

audeoudh avatar audeoudh commented on August 28, 2024

The PR #38 does not add IPv6-specific code to ICMPSocket class. It forwards the self._sock.family and self._sock.type attributes to getaddrinfo. It works for both versions.

from icmplib.

audeoudh avatar audeoudh commented on August 28, 2024

I added tests to make sure that things works well with these modifications. Do you have a specific test bench to run to ensure all is working well?

from icmplib.

ValentinBELYN avatar ValentinBELYN commented on August 28, 2024

Hi @audeoudh, sorry for the delay...

Thank you for your PR! I have integrated some of your work in the version 3.0.2 of icmplib.
Otherwise, there are no unit tests at the moment, at least on GitHub. I have to improve them before committing them.

from icmplib.

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.