Skip to content

feat: add mtr support for windows#106

Merged
s0up4200 merged 1 commit into
autobrr:developfrom
Audionut:windows-mtr
Sep 19, 2025
Merged

feat: add mtr support for windows#106
s0up4200 merged 1 commit into
autobrr:developfrom
Audionut:windows-mtr

Conversation

@Audionut

Copy link
Copy Markdown
Contributor

Completely LLM'd this.

Requires https://github.com/dqos/WinMTRCmd

No idea what if any issues it causes for linux based systems.

Screenshot 2025-08-18 001733

@Audionut Audionut changed the title add mtr support for windows feat: add mtr support for windows Aug 17, 2025
@s0up4200

Copy link
Copy Markdown
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.

@s0up4200

Copy link
Copy Markdown
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 {

@Audionut

Copy link
Copy Markdown
Contributor Author

Nice one, added.

@s0up4200 s0up4200 merged commit 4feba33 into autobrr:develop Sep 19, 2025
10 checks passed
@Audionut Audionut deleted the windows-mtr branch September 20, 2025 00:36
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.

2 participants