Loading projects/conjure/build +6 −1 Original line number Diff line number Diff line Loading @@ -16,9 +16,14 @@ tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.[% c('compress_ta cd /var/tmp/build/[% project %]-[% c('version') %] tar -xf $rootdir/[% c('input_files_by_name/go_vendor') %] [% IF c("var/windows") -%] pushd vendor/github.com/refraction-networking/conjure patch -p1 < $rootdir/conjure-pr-267.patch popd [% END -%] cd client go build -ldflags '-s' -tags 'protoreflect' go build -ldflags '-s[% IF c("var/android") %] -checklinkname=0[% END %]' -tags 'protoreflect' cp -a client[% IF c("var/windows") %].exe[% END %] $distdir/conjure-client[% IF c("var/windows") %].exe[% END %] cd .. Loading projects/conjure/config +6 −2 Original line number Diff line number Diff line # vim: filetype=yaml sw=2 version: '[% c("abbrev") %]' git_url: https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/conjure.git git_hash: b7d485734c3ab09ef3da818abb4b39ec27ef3a73 git_hash: 505cb48152e89e12a608ec6a0101af8a2d266fb1 container: use_container: 1 Loading @@ -19,6 +19,10 @@ steps: pkg_type: go_vendor project: conjure norec: sha256sum: 2b403d6edf075777003bf2194a43fb178a28a4eaa7d23ec8f104563d9bbd7e53 sha256sum: 8f33624ebabec17e09d9aeae8eb0bfc08b78b6089986f3fe9b7fde03a692a22b target_replace: '^torbrowser-(?!testbuild).*': 'torbrowser-linux-x86_64' # https://github.com/refraction-networking/conjure/pull/267 # Remove this once the depdency is updated. - filename: conjure-pr-267.patch enable: '[% c("var/windows") %]' projects/conjure/conjure-pr-267.patch 0 → 100644 +79 −0 Original line number Diff line number Diff line From e5968e71e3ce40e24a5108d2dea7a9bc1d050559 Mon Sep 17 00:00:00 2001 From: Rod Hynes <rod-hynes@users.noreply.github.com> Date: Mon, 29 Jan 2024 13:34:44 -0500 Subject: [PATCH] Fix Windows build --- pkg/transports/connecting/dtls/nat.go | 5 ++--- pkg/transports/connecting/dtls/setsockopt_other.go | 12 ++++++++++++ pkg/transports/connecting/dtls/setsockopt_windows.go | 12 ++++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 pkg/transports/connecting/dtls/setsockopt_other.go create mode 100644 pkg/transports/connecting/dtls/setsockopt_windows.go diff --git a/pkg/transports/connecting/dtls/nat.go b/pkg/transports/connecting/dtls/nat.go index 8860316b..ab3716b9 100644 --- a/pkg/transports/connecting/dtls/nat.go +++ b/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 } diff --git a/pkg/transports/connecting/dtls/setsockopt_other.go b/pkg/transports/connecting/dtls/setsockopt_other.go new file mode 100644 index 00000000..eeba1ed6 --- /dev/null +++ b/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) +} diff --git a/pkg/transports/connecting/dtls/setsockopt_windows.go b/pkg/transports/connecting/dtls/setsockopt_windows.go new file mode 100644 index 00000000..6ab835ea --- /dev/null +++ b/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) +} Loading
projects/conjure/build +6 −1 Original line number Diff line number Diff line Loading @@ -16,9 +16,14 @@ tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.[% c('compress_ta cd /var/tmp/build/[% project %]-[% c('version') %] tar -xf $rootdir/[% c('input_files_by_name/go_vendor') %] [% IF c("var/windows") -%] pushd vendor/github.com/refraction-networking/conjure patch -p1 < $rootdir/conjure-pr-267.patch popd [% END -%] cd client go build -ldflags '-s' -tags 'protoreflect' go build -ldflags '-s[% IF c("var/android") %] -checklinkname=0[% END %]' -tags 'protoreflect' cp -a client[% IF c("var/windows") %].exe[% END %] $distdir/conjure-client[% IF c("var/windows") %].exe[% END %] cd .. Loading
projects/conjure/config +6 −2 Original line number Diff line number Diff line # vim: filetype=yaml sw=2 version: '[% c("abbrev") %]' git_url: https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/conjure.git git_hash: b7d485734c3ab09ef3da818abb4b39ec27ef3a73 git_hash: 505cb48152e89e12a608ec6a0101af8a2d266fb1 container: use_container: 1 Loading @@ -19,6 +19,10 @@ steps: pkg_type: go_vendor project: conjure norec: sha256sum: 2b403d6edf075777003bf2194a43fb178a28a4eaa7d23ec8f104563d9bbd7e53 sha256sum: 8f33624ebabec17e09d9aeae8eb0bfc08b78b6089986f3fe9b7fde03a692a22b target_replace: '^torbrowser-(?!testbuild).*': 'torbrowser-linux-x86_64' # https://github.com/refraction-networking/conjure/pull/267 # Remove this once the depdency is updated. - filename: conjure-pr-267.patch enable: '[% c("var/windows") %]'
projects/conjure/conjure-pr-267.patch 0 → 100644 +79 −0 Original line number Diff line number Diff line From e5968e71e3ce40e24a5108d2dea7a9bc1d050559 Mon Sep 17 00:00:00 2001 From: Rod Hynes <rod-hynes@users.noreply.github.com> Date: Mon, 29 Jan 2024 13:34:44 -0500 Subject: [PATCH] Fix Windows build --- pkg/transports/connecting/dtls/nat.go | 5 ++--- pkg/transports/connecting/dtls/setsockopt_other.go | 12 ++++++++++++ pkg/transports/connecting/dtls/setsockopt_windows.go | 12 ++++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 pkg/transports/connecting/dtls/setsockopt_other.go create mode 100644 pkg/transports/connecting/dtls/setsockopt_windows.go diff --git a/pkg/transports/connecting/dtls/nat.go b/pkg/transports/connecting/dtls/nat.go index 8860316b..ab3716b9 100644 --- a/pkg/transports/connecting/dtls/nat.go +++ b/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 } diff --git a/pkg/transports/connecting/dtls/setsockopt_other.go b/pkg/transports/connecting/dtls/setsockopt_other.go new file mode 100644 index 00000000..eeba1ed6 --- /dev/null +++ b/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) +} diff --git a/pkg/transports/connecting/dtls/setsockopt_windows.go b/pkg/transports/connecting/dtls/setsockopt_windows.go new file mode 100644 index 00000000..6ab835ea --- /dev/null +++ b/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) +}