feat: add mtr support for windows#106
Merged
Merged
Conversation
Collaborator
|
We should probably merge this into a new branch, and make a new PR based on that local branch. That way I can pull the docker image to test on my server. Would also be nice if the README had some info about this dependency for Windows. |
Collaborator
|
This makes sense now I guess 🤔 Other than that I cant really say. Looks good to me. diff --git a/internal/speedtest/packetloss.go b/internal/speedtest/packetloss.go
index 3e0cdf6..b3d996d 100644
--- a/internal/speedtest/packetloss.go
+++ b/internal/speedtest/packetloss.go
@@ -10,6 +10,7 @@ import (
"io"
"net"
"os/exec"
+ "runtime"
"strings"
"sync"
"time"
@@ -993,6 +994,13 @@ type mtrReport struct {
// runMTRTest runs an MTR test and returns statistics
func (s *PacketLossService) runMTRTest(monitor *PacketLossMonitor) (*probing.Statistics, error) {
+ if _, err := exec.LookPath("mtr"); err != nil {
+ if runtime.GOOS == "windows" {
+ return nil, fmt.Errorf("WinMTRCmd not found: please install from https://github.com/dqos/WinMTRCmd/releases and add to PATH")
+ }
+ return nil, fmt.Errorf("mtr not found: please install mtr package for your system")
+ }
+
// Initialize GeoIP databases if not already done
// This is a workaround since PacketLossService doesn't have access to the main service
if countryDB == nil && asnDB == nil { |
05e75f4 to
c5e5030
Compare
Contributor
Author
|
Nice one, added. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Completely LLM'd this.
Requires
https://github.com/dqos/WinMTRCmdNo idea what if any issues it causes for linux based systems.