-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net/tcp: don't use MD5 signature and bind to device on non-Linux OS
- Loading branch information
1 parent
3f5d7cf
commit f71bc38
Showing
6 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
//go:build linux | ||
|
||
package tcp | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//go:build !linux | ||
|
||
package tcp | ||
|
||
import ( | ||
"fmt" | ||
"net" | ||
) | ||
|
||
func setTCPMD5Option(fd int, addr net.IP, md5secret string) error { | ||
return fmt.Errorf("setting md5 is not supported") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//go:build linux | ||
|
||
package tcp | ||
|
||
import "golang.org/x/sys/unix" | ||
|
||
// bindToDev sets the SO_BINDTODEVICE option | ||
func bindToDev(fd int, devName string) error { | ||
return unix.SetsockoptString(fd, unix.IPPROTO_TCP, unix.SO_BINDTODEVICE, devName) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//go:build !linux | ||
|
||
package tcp | ||
|
||
import "fmt" | ||
|
||
// bindToDev sets the SO_BINDTODEVICE option | ||
func bindToDev(fd int, devName string) error { | ||
return fmt.Errorf("binding to device is not supported") | ||
} |