Merge pull request #1071 from skrashevich/refactr-syscall-more-generic
refactor(sysctl): consolidate platform-specific syscall files
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
//go:build freebsd || netbsd || openbsd || dragonfly
|
||||
|
||||
package device
|
||||
|
||||
import (
|
||||
@@ -1,3 +1,5 @@
|
||||
//go:build darwin || ios
|
||||
|
||||
package device
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//go:build unix && !darwin && !freebsd && !netbsd && !openbsd && !dragonfly
|
||||
|
||||
package device
|
||||
|
||||
import (
|
||||
@@ -1,3 +1,5 @@
|
||||
//go:build windows
|
||||
|
||||
package device
|
||||
|
||||
import (
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
//go:build freebsd || netbsd || openbsd || dragonfly
|
||||
|
||||
package hardware
|
||||
|
||||
import (
|
||||
@@ -1,3 +1,5 @@
|
||||
//go:build darwin || ios
|
||||
|
||||
package hardware
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//go:build unix && !darwin && !freebsd && !netbsd && !openbsd && !dragonfly
|
||||
|
||||
package hardware
|
||||
|
||||
import (
|
||||
@@ -1,3 +1,5 @@
|
||||
//go:build windows
|
||||
|
||||
package hardware
|
||||
|
||||
import "github.com/AlexxIT/go2rtc/internal/api"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//go:build !(darwin || ios || freebsd || openbsd || netbsd || dragonfly || windows)
|
||||
|
||||
package mdns
|
||||
|
||||
import (
|
||||
@@ -1,3 +1,5 @@
|
||||
//go:build darwin || ios || freebsd || openbsd || netbsd || dragonfly
|
||||
|
||||
package mdns
|
||||
|
||||
import (
|
||||
@@ -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)
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
//go:build windows
|
||||
|
||||
package mdns
|
||||
|
||||
import "syscall"
|
||||
|
||||
Reference in New Issue
Block a user