Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic IPv6 support. #67

Merged
merged 5 commits into from
Jan 25, 2018
Merged

Add basic IPv6 support. #67

merged 5 commits into from
Jan 25, 2018

Conversation

elad
Copy link
Contributor

@elad elad commented Jun 20, 2017

The following changes were made to support pinging IPv6 hosts:

  • On Linux and macOS, use /sbin/ping6 as the executable
  • On macOS, if pinging an IPv6 host, don't pass a timeout argument

The following changes were made to support pinging IPv6 hosts:
  - On Linux and macOS, use `/sbin/ping6` as the executable
  - On macOS, if pinging an IPv6 host, don't pass a timeout argument
@mondwan
Copy link
Collaborator

mondwan commented Jun 20, 2017 via email

@@ -74,11 +74,11 @@ factory.getExecutablePath = function (platform) {
if (platform === 'aix') {
ret = '/usr/sbin/ping';
} else if (factory.isLinux(platform)) {
ret = '/bin/ping';
ret = v6 ? '/sbin/ping6' : '/bin/ping';
} else if (factory.isWindow(platform)) {
ret = process.env.SystemRoot + '/system32/ping.exe';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering whether we should support the '-6' for windows command, per docs: https://ss64.com/nt/ping.html
BTW I don't have access to to Windows machine to validate this behaviour.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we probably should. I can test on Windows. I'll make the code force either IPv4 or IPv6.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(done, on merge we should squash with the latest commit)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, how to create a message box with review icon like this? Any button in github UI for doing this ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mondwan click "Files changed" at the top, then hover over the line number and click when you want to add a line-specific comment. :)

The following changes were made to support pinging IPv6 hosts:
  - On Linux and macOS, use `/sbin/ping6` as the executable
  - On macOS, if pinging an IPv6 host, don't pass a timeout argument
  - On Windows, use `-4` and `-6` to force IPv4 and IPv6, respectively
@elad
Copy link
Contributor Author

elad commented Jun 20, 2017

@mondwan sure, I'll try to get to it later today.

@mondwan
Copy link
Collaborator

mondwan commented Jun 20, 2017

Great. Thanks @elad

@mondwan
Copy link
Collaborator

mondwan commented Jun 21, 2017 via email

@elad
Copy link
Contributor Author

elad commented Jun 27, 2017

@mondwan how do you run the tests?

$ yarn test
yarn test v0.24.6
$ grunt test 
Running "eslint:src" (eslint) task

/private/tmp/node-ping/lib/parser/mac.js
  39:28  error  Unnecessary escape character: \.  no-useless-escape
  56:31  error  Unnecessary escape character: \/  no-useless-escape
  58:28  error  Unnecessary escape character: \.  no-useless-escape

/private/tmp/node-ping/lib/parser/win.js
   83:28  error  Unnecessary escape character: \.  no-useless-escape
  103:28  error  Unnecessary escape character: \.  no-useless-escape

✖ 5 problems (5 errors, 0 warnings)

Warning: Task "eslint:src" failed. Use --force to continue.

Aborted due to warnings.
error Command failed with exit code 3.
$ 

@mondwan
Copy link
Collaborator

mondwan commented Jun 27, 2017 via email

@elad
Copy link
Contributor Author

elad commented Jun 27, 2017

I have no idea. I just cloned the repository, installed the dependencies, and ran the command. Testing on macOS Sierra. What's your environment?

@mondwan
Copy link
Collaborator

mondwan commented Jun 27, 2017 via email

@elad
Copy link
Contributor Author

elad commented Jun 27, 2017

Those lines are checked out from the repository... they're not related to my changes.

@mondwan
Copy link
Collaborator

mondwan commented Jun 27, 2017 via email

@mondwan
Copy link
Collaborator

mondwan commented Jul 2, 2017

Ahh, I just found out linting errors from yours do not happen on my window machine. That's why I cannot spot them out.

@elad
Copy link
Contributor Author

elad commented Jul 2, 2017

@mondwan you should consider switching to macOS then. :)
Btw, still haven't had the time to write the tests -- hopefully soon because I need this feature in an official release..

@mondwan
Copy link
Collaborator

mondwan commented Jul 2, 2017

@elad , test cases are still missing. Can you provide examples for running with ipv6?

For example,

  • Add examples/example3.js
    • A new example js demonstrates how to use ipv6
  • Add examples for pinging with ipv6 in system's console
    • Just like examples in test/fixture/linux/en/sample1.txt, test/fixture/macos/en/sample1.txt
  • Add expected answer into test/fixture/answer.json

@mondwan
Copy link
Collaborator

mondwan commented Jul 2, 2017

Yea. Development in Window is bad. Really bad. I will do them on my mac book air if they are heavy.

However, this is a kind of fun for seeing tricky things which happen on window platform only. LOL

@ajmas
Copy link

ajmas commented Jul 2, 2017

Another option is using Vagrant/Virtual Box?

@mondwan
Copy link
Collaborator

mondwan commented Jul 3, 2017 via email

@danielzzz danielzzz merged commit 1601458 into danielzzz:master Jan 25, 2018
@mondwan
Copy link
Collaborator

mondwan commented Feb 11, 2018

Hey @elad, may I know the reason for not passing timeout when using ipv6 on mac OS?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants