Feature: add fwmark support

This commit is contained in:
xjasonlyu
2021-02-10 15:46:55 +08:00
parent ea62deb0b6
commit 7f7f2913a8
11 changed files with 136 additions and 40 deletions

View File

@@ -1,8 +1,11 @@
package dialer
import "net"
import (
"net"
"sync"
)
var _boundInterface *net.Interface
var _bindOnce sync.Once
// BindToInterface binds dialer to specific interface.
func BindToInterface(name string) error {
@@ -10,6 +13,9 @@ func BindToInterface(name string) error {
if err != nil {
return err
}
_boundInterface = i
_bindOnce.Do(func() {
addControl(bindToInterface(i))
})
return nil
}