This commit is contained in:
Eliezer Croitoru 2026-09-09 16:37:17 +03:00
parent 3a8850b8c2
commit c89cea01a6
5 changed files with 19 additions and 7 deletions

Binary file not shown.

Binary file not shown.

View File

@ -295,14 +295,17 @@ func NewTracer(
func (t *Tracer) Done() <-chan struct{} { return t.stopCh }
func (t *Tracer) Start() error {
if t.proto == "winapi" {
// Windows ICMP API manages its own sockets per probe.
// No raw socket, no receive loop, no cleanup loop needed.
go t.probeLoop()
return nil
}
if t.proto == "winapi" {
go t.probeLoop()
return nil
}
var err error
// ADD THIS:
if t.proto == "udp" {
udpModeWarning()
}
var err error
t.icmpConn, err = icmp.ListenPacket("ip4:icmp", "0.0.0.0")
if err != nil {
t.icmpConn, err = icmp.ListenPacket("udp4", "0.0.0.0:0")

View File

@ -13,3 +13,5 @@ func winAPIProbe(_ net.IP, _ int, _ time.Duration, _ []byte) (float64, string, u
}
func (t *Tracer) sendProbeWinAPI(_ int) {}
func udpModeWarning() {}

View File

@ -8,6 +8,7 @@ import (
"syscall"
"time"
"unsafe"
"os"
)
var (
@ -23,6 +24,12 @@ const (
ipReqTimedOut uint32 = 11010
)
func udpModeWarning() {
fmt.Fprintln(os.Stderr,
"Warning: UDP mode on Windows requires an inbound Windows Firewall rule "+
"to allow ICMP Time Exceeded (Type 11). Consider using -proto winapi instead.")
}
// mirrors IP_OPTION_INFORMATION from <ipexport.h>
type ipOptInfo struct {
Ttl uint8