diff --git a/internal/ffmpeg/device/device_freebsd.go b/internal/ffmpeg/device/device_bsd.go similarity index 97% rename from internal/ffmpeg/device/device_freebsd.go rename to internal/ffmpeg/device/device_bsd.go index f3a26a304..27d5b6154 100644 --- a/internal/ffmpeg/device/device_freebsd.go +++ b/internal/ffmpeg/device/device_bsd.go @@ -1,3 +1,5 @@ +//go:build freebsd || netbsd || openbsd || dragonfly + package device import ( diff --git a/internal/ffmpeg/device/device_darwin.go b/internal/ffmpeg/device/device_darwin.go index ac9b5e431..ba97c0aa9 100644 --- a/internal/ffmpeg/device/device_darwin.go +++ b/internal/ffmpeg/device/device_darwin.go @@ -1,3 +1,5 @@ +//go:build darwin || ios + package device import ( diff --git a/internal/ffmpeg/device/device_linux.go b/internal/ffmpeg/device/device_unix.go similarity index 96% rename from internal/ffmpeg/device/device_linux.go rename to internal/ffmpeg/device/device_unix.go index d1228b157..7b62187f3 100644 --- a/internal/ffmpeg/device/device_linux.go +++ b/internal/ffmpeg/device/device_unix.go @@ -1,3 +1,5 @@ +//go:build unix && !darwin && !freebsd && !netbsd && !openbsd && !dragonfly + package device import ( diff --git a/internal/ffmpeg/device/device_windows.go b/internal/ffmpeg/device/device_windows.go index c14630d35..ff3283117 100644 --- a/internal/ffmpeg/device/device_windows.go +++ b/internal/ffmpeg/device/device_windows.go @@ -1,3 +1,5 @@ +//go:build windows + package device import ( diff --git a/internal/ffmpeg/hardware/hardware_freebsd.go b/internal/ffmpeg/hardware/hardware_bsd.go similarity index 96% rename from internal/ffmpeg/hardware/hardware_freebsd.go rename to internal/ffmpeg/hardware/hardware_bsd.go index 6ef753acd..de24ac5c8 100644 --- a/internal/ffmpeg/hardware/hardware_freebsd.go +++ b/internal/ffmpeg/hardware/hardware_bsd.go @@ -1,3 +1,5 @@ +//go:build freebsd || netbsd || openbsd || dragonfly + package hardware import ( diff --git a/internal/ffmpeg/hardware/hardware_darwin.go b/internal/ffmpeg/hardware/hardware_darwin.go index 8392d2b11..b15055128 100644 --- a/internal/ffmpeg/hardware/hardware_darwin.go +++ b/internal/ffmpeg/hardware/hardware_darwin.go @@ -1,3 +1,5 @@ +//go:build darwin || ios + package hardware import ( diff --git a/internal/ffmpeg/hardware/hardware_linux.go b/internal/ffmpeg/hardware/hardware_unix.go similarity index 97% rename from internal/ffmpeg/hardware/hardware_linux.go rename to internal/ffmpeg/hardware/hardware_unix.go index f0d4858e1..4f688ce40 100644 --- a/internal/ffmpeg/hardware/hardware_linux.go +++ b/internal/ffmpeg/hardware/hardware_unix.go @@ -1,3 +1,5 @@ +//go:build unix && !darwin && !freebsd && !netbsd && !openbsd && !dragonfly + package hardware import ( diff --git a/internal/ffmpeg/hardware/hardware_windows.go b/internal/ffmpeg/hardware/hardware_windows.go index c22639f55..cdf0e12cc 100644 --- a/internal/ffmpeg/hardware/hardware_windows.go +++ b/internal/ffmpeg/hardware/hardware_windows.go @@ -1,3 +1,5 @@ +//go:build windows + package hardware import "github.com/AlexxIT/go2rtc/internal/api" diff --git a/pkg/mdns/syscall_linux.go b/pkg/mdns/syscall.go similarity index 78% rename from pkg/mdns/syscall_linux.go rename to pkg/mdns/syscall.go index fc0caeb05..0e50535ad 100644 --- a/pkg/mdns/syscall_linux.go +++ b/pkg/mdns/syscall.go @@ -1,3 +1,5 @@ +//go:build !(darwin || ios || freebsd || openbsd || netbsd || dragonfly || windows) + package mdns import ( diff --git a/pkg/mdns/syscall_darwin.go b/pkg/mdns/syscall_bsd.go similarity index 90% rename from pkg/mdns/syscall_darwin.go rename to pkg/mdns/syscall_bsd.go index c1f1225b3..6ebb0c93a 100644 --- a/pkg/mdns/syscall_darwin.go +++ b/pkg/mdns/syscall_bsd.go @@ -1,3 +1,5 @@ +//go:build darwin || ios || freebsd || openbsd || netbsd || dragonfly + package mdns import ( diff --git a/pkg/mdns/syscall_freebsd.go b/pkg/mdns/syscall_freebsd.go deleted file mode 100644 index c1f1225b3..000000000 --- a/pkg/mdns/syscall_freebsd.go +++ /dev/null @@ -1,24 +0,0 @@ -package mdns - -import ( - "syscall" -) - -func SetsockoptInt(fd uintptr, level, opt int, value int) (err error) { - // change SO_REUSEADDR and REUSEPORT flags simultaneously for BSD-like OS - // https://github.com/AlexxIT/go2rtc/issues/626 - // https://stackoverflow.com/questions/14388706/how-do-so-reuseaddr-and-so-reuseport-differ/14388707 - if opt == syscall.SO_REUSEADDR { - if err = syscall.SetsockoptInt(int(fd), level, opt, value); err != nil { - return - } - - opt = syscall.SO_REUSEPORT - } - - return syscall.SetsockoptInt(int(fd), level, opt, value) -} - -func SetsockoptIPMreq(fd uintptr, level, opt int, mreq *syscall.IPMreq) (err error) { - return syscall.SetsockoptIPMreq(int(fd), level, opt, mreq) -} diff --git a/pkg/mdns/syscall_windows.go b/pkg/mdns/syscall_windows.go index be283655b..770510cf7 100644 --- a/pkg/mdns/syscall_windows.go +++ b/pkg/mdns/syscall_windows.go @@ -1,3 +1,5 @@ +//go:build windows + package mdns import "syscall"