fix(dialer): add switchNetns stubs for all non-Linux platforms
The switchNetns function was only defined for linux (dialer_netns.go, build tag linux && !android) and android (dialer_android.go, stub). This left darwin, freebsd, openbsd, windows, and other platforms with an undefined symbol at dialer.go:55. Add no-op stubs to all remaining platform files so the dialer package compiles on every GOOS.
This commit is contained in:
@@ -35,3 +35,8 @@ func bindDevice(network, address string, fd uintptr, ifceName string) error {
|
||||
func setMark(fd uintptr, mark int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// switchNetns is a no-op stub — network namespace switching is a Linux-only feature.
|
||||
func switchNetns(name string) (restore func(), err error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -14,3 +14,8 @@ func setMark(fd uintptr, mark int) error {
|
||||
}
|
||||
return unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_USER_COOKIE, mark)
|
||||
}
|
||||
|
||||
// switchNetns is a no-op stub — network namespace switching is a Linux-only feature.
|
||||
func switchNetns(name string) (restore func(), err error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -14,3 +14,8 @@ func setMark(fd uintptr, mark int) error {
|
||||
}
|
||||
return unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_RTABLE, mark)
|
||||
}
|
||||
|
||||
// switchNetns is a no-op stub — network namespace switching is a Linux-only feature.
|
||||
func switchNetns(name string) (restore func(), err error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -9,3 +9,8 @@ func bindDevice(network, address string, fd uintptr, ifceName string) error {
|
||||
func setMark(fd uintptr, mark int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// switchNetns is a no-op stub — network namespace switching is a Linux-only feature.
|
||||
func switchNetns(name string) (restore func(), err error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -49,6 +49,11 @@ func setMark(fd uintptr, mark int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// switchNetns is a no-op stub — network namespace switching is a Linux-only feature.
|
||||
func switchNetns(name string) (restore func(), err error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func bindSocketToInterface4(handle windows.Handle, index uint32) error {
|
||||
// For IPv4, this parameter must be an interface index in network byte order.
|
||||
// Ref: https://learn.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options
|
||||
|
||||
Reference in New Issue
Block a user