mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-06 09:16:58 +08:00
Refactor(core): with error callback
This commit is contained in:
@@ -7,13 +7,13 @@ import (
|
||||
"github.com/xjasonlyu/tun2socks/v2/component/dialer"
|
||||
"github.com/xjasonlyu/tun2socks/v2/core"
|
||||
"github.com/xjasonlyu/tun2socks/v2/core/device"
|
||||
"github.com/xjasonlyu/tun2socks/v2/core/option"
|
||||
_ "github.com/xjasonlyu/tun2socks/v2/dns"
|
||||
"github.com/xjasonlyu/tun2socks/v2/log"
|
||||
"github.com/xjasonlyu/tun2socks/v2/proxy"
|
||||
"github.com/xjasonlyu/tun2socks/v2/stats"
|
||||
"github.com/xjasonlyu/tun2socks/v2/tunnel"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/tcpip"
|
||||
"gvisor.dev/gvisor/pkg/tcpip/stack"
|
||||
)
|
||||
|
||||
@@ -169,6 +169,12 @@ func (e *engine) applyStack() (err error) {
|
||||
}
|
||||
}()
|
||||
|
||||
e.stack, err = core.CreateStackWithOptions(e.device, &fakeTunnel{}, option.WithDefault())
|
||||
e.stack, err = core.CreateStack(&core.Config{
|
||||
LinkEndpoint: e.device,
|
||||
TransportHandler: &fakeTunnel{},
|
||||
ErrorFunc: func(err tcpip.Error) {
|
||||
log.Warnf("[STACK] %s", err)
|
||||
},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user