-
Notifications
You must be signed in to change notification settings - Fork 62
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
Set outbound interface, like ping -I
option
#32
Set outbound interface, like ping -I
option
#32
Conversation
ping -I
optionping -I
option
This needs a DCO sign-off. You can use |
ping.go
Outdated
// Iface used to send/recv ICMP messages | ||
Iface string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the short name
// Iface used to send/recv ICMP messages | |
Iface string | |
// Interface used to send/recv ICMP messages | |
Interface string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original intention was just to avoid confusion with the go interface
keyword
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe InterfaceName
then if needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I adopted Interface
to make a new commit but the ci test still fails
I use the same ci docker image locally and it works fine. Am I doing something wrong?
I hope you can give me some help, thank you very much
circleci@3b386f984da0:~/project/pro-bing$ git branch -vv
* feature-interface-binding 60b7449 [origin/feature-interface-binding] Refactoring the variable name `Iface` to `Interface` and `ifaceIndex` to `ifIndex`(keeping it consistent with `ControlMessage`)
main a17ba03 [origin/main] Merge pull request #29 from TheRushingWookie/add_context
circleci@3b386f984da0:~/project/pro-bing$ make style vet test
>> checking code style
>> vetting code
GO111MODULE= go vet ./...
>> running all tests
GO111MODULE= go test -race -cover ./...
ok github.com/prometheus-community/pro-bing (cached) coverage: 76.9% of statements
? github.com/prometheus-community/pro-bing/cmd/ping [no test files]
ci error message: socket: permission denied
Signed-off-by: ilolicon <[email protected]>
… to `ifIndex`(keeping it consistent with `ControlMessage`) Signed-off-by: ilolicon <[email protected]>
8dffa7b
to
60b7449
Compare
@@ -29,6 +29,9 @@ Examples: | |||
# ping google for 10 seconds | |||
ping -t 10s www.google.com | |||
|
|||
# ping google specified interface | |||
ping -I eth1 www.goole.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a typo here: goo[g]le.com
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping -I eth1 www.goole.com | |
ping -I eth1 www.google.com |
FWIW, I would like to see this feature added in order to use VRF with this library. |
I need this feature really bad. Can anyone merge this? |
The PR needs to be rebased if it is to have any chance of getting merged. |
Checking on this PR? I could use it. Is it dead? |
Hi, any updates on this PR? It is quite useful when debugging the network on hosts with multiple net interfaces. |
I need this to use link-local IPv6 addresses |
At least the PR has conflicts, @ilolicon can you resolve them? |
If someone would like to fork this code and submit a new PR, feel free. |
This allows using `pro-bing` to use VRFs interfaces and IPv6 link-local addresses. Originally from @ilolicon in prometheus-community#32. commit 16f9286 Author: Matthieu Pignolet <[email protected]> Date: Tue Oct 29 15:46:13 2024 +0400 Remove the un-used function in te `packetConn` interface that did not get removed during the merging process commit 88bb1f5 Author: ilolicon <[email protected]> Date: Wed Apr 12 16:23:06 2023 +0800 Refactoring the variable name `Iface` to `Interface` and `ifaceIndex` to `ifIndex`(keeping it consistent with `ControlMessage`) Signed-off-by: ilolicon <[email protected]> commit 887b4e2 Author: ilolicon <[email protected]> Date: Wed Apr 12 10:39:36 2023 +0800 feat: interface binding Signed-off-by: ilolicon <[email protected]>
This allows using `pro-bing` to use VRFs interfaces and IPv6 link-local addresses. Originally from @ilolicon in prometheus-community#32. commit 16f9286 Author: Matthieu Pignolet <[email protected]> Date: Tue Oct 29 15:46:13 2024 +0400 Remove the un-used function in te `packetConn` interface that did not get removed during the merging process commit 88bb1f5 Author: ilolicon <[email protected]> Date: Wed Apr 12 16:23:06 2023 +0800 Refactoring the variable name `Iface` to `Interface` and `ifaceIndex` to `ifIndex`(keeping it consistent with `ControlMessage`) Signed-off-by: ilolicon <[email protected]> commit 887b4e2 Author: ilolicon <[email protected]> Date: Wed Apr 12 10:39:36 2023 +0800 feat: interface binding Signed-off-by: ilolicon <[email protected]> Signed-off-by: Matthieu Pignolet <[email protected]>
…al addresses. Squashed commit of the following: commit 7385672 Author: Matthieu Pignolet <[email protected]> Date: Tue Oct 29 16:11:33 2024 +0400 Renaming the `Interface` Pinger property to `InterfaceDevice` to avoid conflict with the `interface` keyword. Signed-off-by: Matthieu Pignolet <[email protected]> commit 978c60e Author: Matthieu Pignolet <[email protected]> Date: Tue Oct 29 15:59:36 2024 +0400 Add the `Interface` option to `Pinger` This allows using `pro-bing` to use VRFs interfaces and IPv6 link-local addresses. Originally from @ilolicon in prometheus-community#32. commit 16f9286 Author: Matthieu Pignolet <[email protected]> Date: Tue Oct 29 15:46:13 2024 +0400 Remove the un-used function in te `packetConn` interface that did not get removed during the merging process commit 88bb1f5 Author: ilolicon <[email protected]> Date: Wed Apr 12 16:23:06 2023 +0800 Refactoring the variable name `Iface` to `Interface` and `ifaceIndex` to `ifIndex`(keeping it consistent with `ControlMessage`) Signed-off-by: ilolicon <[email protected]> commit 887b4e2 Author: ilolicon <[email protected]> Date: Wed Apr 12 10:39:36 2023 +0800 feat: interface binding Signed-off-by: ilolicon <[email protected]> Signed-off-by: Matthieu Pignolet <[email protected]>
…al addresses. Squashed commit of the following: commit 7385672 Author: Matthieu Pignolet <[email protected]> Date: Tue Oct 29 16:11:33 2024 +0400 Renaming the `Interface` Pinger property to `InterfaceDevice` to avoid conflict with the `interface` keyword. Signed-off-by: Matthieu Pignolet <[email protected]> commit 978c60e Author: Matthieu Pignolet <[email protected]> Date: Tue Oct 29 15:59:36 2024 +0400 Add the `Interface` option to `Pinger` This allows using `pro-bing` to use VRFs interfaces and IPv6 link-local addresses. Originally from @ilolicon in prometheus-community#32. commit 16f9286 Author: Matthieu Pignolet <[email protected]> Date: Tue Oct 29 15:46:13 2024 +0400 Remove the un-used function in te `packetConn` interface that did not get removed during the merging process commit 88bb1f5 Author: ilolicon <[email protected]> Date: Wed Apr 12 16:23:06 2023 +0800 Refactoring the variable name `Iface` to `Interface` and `ifaceIndex` to `ifIndex`(keeping it consistent with `ControlMessage`) Signed-off-by: ilolicon <[email protected]> commit 887b4e2 Author: ilolicon <[email protected]> Date: Wed Apr 12 10:39:36 2023 +0800 feat: interface binding Signed-off-by: ilolicon <[email protected]> Signed-off-by: Matthieu Pignolet <[email protected]> Signed-off-by: Matthieu Pignolet <[email protected]>
commit 75cbb26 Author: Matthieu Pignolet <[email protected]> Date: Tue Oct 29 20:49:25 2024 +0400 Use the machine executor for CI Signed-off-by: Matthieu Pignolet <[email protected]> commit a0e098a Author: Matthieu Pignolet <[email protected]> Date: Tue Oct 29 20:48:33 2024 +0400 Using the machine executor for CI Signed-off-by: Matthieu Pignolet <[email protected]> commit 77e1065 Merge: 3cb9e40 a563de4 Author: Matthieu Pignolet <[email protected]> Date: Tue Oct 29 20:09:52 2024 +0400 Merge branch 'prometheus-community:main' into main commit 3cb9e40 Author: Matthieu Pignolet <[email protected]> Date: Tue Oct 29 20:05:12 2024 +0400 Remote the un-used workaround used to avoid the `lo` interfaces Signed-off-by: Matthieu Pignolet <[email protected]> commit 006d173 Author: Matthieu Pignolet <[email protected]> Date: Tue Oct 29 17:11:14 2024 +0400 add a function (`testSetInterfaceNameChooseInterface`) to choose any interface that has an IP address assigned to it this is a "hack" to supposedly make CircleCI happy Signed-off-by: Matthieu Pignolet <[email protected]> commit 7385672 Author: Matthieu Pignolet <[email protected]> Date: Tue Oct 29 16:11:33 2024 +0400 Renaming the `Interface` Pinger property to `InterfaceDevice` to avoid conflict with the `interface` keyword. Signed-off-by: Matthieu Pignolet <[email protected]> commit 978c60e Author: Matthieu Pignolet <[email protected]> Date: Tue Oct 29 15:59:36 2024 +0400 Add the `Interface` option to `Pinger` This allows using `pro-bing` to use VRFs interfaces and IPv6 link-local addresses. Originally from @ilolicon in prometheus-community#32. commit 16f9286 Author: Matthieu Pignolet <[email protected]> Date: Tue Oct 29 15:46:13 2024 +0400 Remove the un-used function in te `packetConn` interface that did not get removed during the merging process commit 88bb1f5 Author: ilolicon <[email protected]> Date: Wed Apr 12 16:23:06 2023 +0800 Refactoring the variable name `Iface` to `Interface` and `ifaceIndex` to `ifIndex`(keeping it consistent with `ControlMessage`) Signed-off-by: ilolicon <[email protected]> commit 887b4e2 Author: ilolicon <[email protected]> Date: Wed Apr 12 10:39:36 2023 +0800 feat: interface binding Signed-off-by: ilolicon <[email protected]> Signed-off-by: Matthieu Pignolet <[email protected]> Signed-off-by: Matthieu Pignolet <[email protected]>
…t specifies the device that needs to be used to send and receive ICMP echo requests and response. This allows usage of `pro-bing` with linux VRFs, and IPv6 link-local addresses. Squashed commit of the following: commit 7385672 Author: Matthieu Pignolet <[email protected]> Date: Tue Oct 29 16:11:33 2024 +0400 Renaming the `Interface` Pinger property to `InterfaceDevice` to avoid conflict with the `interface` keyword. Signed-off-by: Matthieu Pignolet <[email protected]> commit 978c60e Author: Matthieu Pignolet <[email protected]> Date: Tue Oct 29 15:59:36 2024 +0400 Add the `Interface` option to `Pinger` This allows using `pro-bing` to use VRFs interfaces and IPv6 link-local addresses. Originally from @ilolicon in prometheus-community#32. commit 16f9286 Author: Matthieu Pignolet <[email protected]> Date: Tue Oct 29 15:46:13 2024 +0400 Remove the un-used function in te `packetConn` interface that did not get removed during the merging process commit 88bb1f5 Author: ilolicon <[email protected]> Date: Wed Apr 12 16:23:06 2023 +0800 Refactoring the variable name `Iface` to `Interface` and `ifaceIndex` to `ifIndex`(keeping it consistent with `ControlMessage`) Signed-off-by: ilolicon <[email protected]> commit 887b4e2 Author: ilolicon <[email protected]> Date: Wed Apr 12 10:39:36 2023 +0800 feat: interface binding Signed-off-by: ilolicon <[email protected]>
…t specifies the device that needs to be used to send and receive ICMP echo requests and response. This allows usage of `pro-bing` with linux VRFs, and IPv6 link-local addresses. Squashed commit of the following: commit 7385672 Author: Matthieu Pignolet <[email protected]> Date: Tue Oct 29 16:11:33 2024 +0400 Renaming the `Interface` Pinger property to `InterfaceDevice` to avoid conflict with the `interface` keyword. Signed-off-by: Matthieu Pignolet <[email protected]> commit 978c60e Author: Matthieu Pignolet <[email protected]> Date: Tue Oct 29 15:59:36 2024 +0400 Add the `Interface` option to `Pinger` This allows using `pro-bing` to use VRFs interfaces and IPv6 link-local addresses. Originally from @ilolicon in prometheus-community#32. commit 16f9286 Author: Matthieu Pignolet <[email protected]> Date: Tue Oct 29 15:46:13 2024 +0400 Remove the un-used function in te `packetConn` interface that did not get removed during the merging process commit 88bb1f5 Author: ilolicon <[email protected]> Date: Wed Apr 12 16:23:06 2023 +0800 Refactoring the variable name `Iface` to `Interface` and `ifaceIndex` to `ifIndex`(keeping it consistent with `ControlMessage`) Signed-off-by: ilolicon <[email protected]> commit 887b4e2 Author: ilolicon <[email protected]> Date: Wed Apr 12 10:39:36 2023 +0800 feat: interface binding Signed-off-by: ilolicon <[email protected]> Signed-off-by: Matthieu Pignolet <[email protected]>
Sorry, I was too busy recently and didn't pay attention to the news. It seems that @MatthieuCoder has resolved the conflict. |
Resolved #123 |
Hello,
I attempted to implement a useful feature - sending data packets from a specific network interface, similar to what the "ping" command's "-I" option does in Linux.
Hoping I did it correctly. Test successfully passed on Linux OS.
Thanks!
The issues related to this feature:
go-ping/ping#111
go-ping/ping#204