refactor: re-org packages

This commit is contained in:
Toby
2022-11-24 00:22:44 -08:00
parent e338ed60cb
commit 3184c42956
70 changed files with 110 additions and 107 deletions

View 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
}
}