Просмотр исходного кода

Fix: restore Conjure vendor patch 49bc95e9

Rod Hynes 2 лет назад
Родитель
Сommit
46d1fc6ab4

+ 2 - 3
vendor/github.com/refraction-networking/conjure/pkg/transports/connecting/dtls/nat.go

@@ -5,7 +5,6 @@ import (
 	"fmt"
 	"net"
 	"os"
-	"syscall"
 	"time"
 
 	"github.com/pion/stun"
@@ -58,7 +57,7 @@ func openUDPLimitTTL(ctx context.Context, laddr, addr string, dialer dialFunc) e
 	defer fd.Close()
 
 	// Set the TTL
-	err = syscall.SetsockoptInt(int(fd.Fd()), syscall.IPPROTO_IP, syscall.IP_TTL, ttl)
+	err = setSocketTTL(fd, ttl)
 	if err != nil {
 		return err
 	}
@@ -70,7 +69,7 @@ func openUDPLimitTTL(ctx context.Context, laddr, addr string, dialer dialFunc) e
 	}
 
 	// reset TTL
-	err = syscall.SetsockoptInt(int(fd.Fd()), syscall.IPPROTO_IP, syscall.IP_TTL, defaultTTL)
+	err = setSocketTTL(fd, defaultTTL)
 	if err != nil {
 		return err
 	}

+ 12 - 0
vendor/github.com/refraction-networking/conjure/pkg/transports/connecting/dtls/setsockopt_other.go

@@ -0,0 +1,12 @@
+//go:build !windows
+
+package dtls
+
+import (
+	"os"
+	"syscall"
+)
+
+func setSocketTTL(f *os.File, ttl int) error {
+	return syscall.SetsockoptInt(int(f.Fd()), syscall.IPPROTO_IP, syscall.IP_TTL, ttl)
+}

+ 12 - 0
vendor/github.com/refraction-networking/conjure/pkg/transports/connecting/dtls/setsockopt_windows.go

@@ -0,0 +1,12 @@
+//go:build windows
+
+package dtls
+
+import (
+	"os"
+	"syscall"
+)
+
+func setSocketTTL(f *os.File, ttl int) error {
+	return syscall.SetsockoptInt(syscall.Handle(f.Fd()), syscall.IPPROTO_IP, syscall.IP_TTL, ttl)
+}