Created
September 5, 2024 20:27
-
-
Save WindyNova/8d78effdfa1d2e3c403109a507ed872b to your computer and use it in GitHub Desktop.
Is it problematic for Tailscale?
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
| // https://github.com/tailscale/tailscale/blob/e7b5e8c8cd9f88bb39442e099a237a2fcd75b180/net/netmon/state.go#L56 | |
| package main | |
| import ( | |
| "fmt" | |
| "net" | |
| "runtime" | |
| "strings" | |
| ) | |
| func isProblematicInterface(nif *net.Interface) bool { | |
| name := nif.Name | |
| // Don't try to send disco/etc packets over zerotier; they effectively | |
| // DoS each other by doing traffic amplification, both of them | |
| // preferring/trying to use each other for transport. See: | |
| // https://github.com/tailscale/tailscale/issues/1208 | |
| if strings.HasPrefix(name, "zt") || (runtime.GOOS == "windows" && strings.Contains(name, "ZeroTier")) { | |
| return true | |
| } | |
| return false | |
| } | |
| func main() { | |
| ifaces, err := net.Interfaces() | |
| if err != nil { | |
| fmt.Println("Error getting interfaces:", err) | |
| return | |
| } | |
| for _, iface := range ifaces { | |
| if isProblematicInterface(&iface) { | |
| fmt.Printf("Interface %s is problematic.\n", iface.Name) | |
| } else { | |
| fmt.Printf("Interface %s is not problematic.\n", iface.Name) | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment