mirror of
https://github.com/cedar2025/hysteria.git
synced 2025-09-09 18:11:46 +00:00
refactor: re-org packages
This commit is contained in:
22
core/sockopt/sockopt_linux.go
Normal file
22
core/sockopt/sockopt_linux.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package sockopt
|
||||
|
||||
import (
|
||||
"net"
|
||||
"syscall"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func bindRawConn(network string, c syscall.RawConn, bindIface *net.Interface) error {
|
||||
var err1, err2 error
|
||||
err1 = c.Control(func(fd uintptr) {
|
||||
if bindIface != nil {
|
||||
err2 = unix.BindToDevice(int(fd), bindIface.Name)
|
||||
}
|
||||
})
|
||||
if err1 != nil {
|
||||
return err1
|
||||
} else {
|
||||
return err2
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user