Chore(core): use config.PrintFunc

This commit is contained in:
xjasonlyu
2022-03-31 17:48:52 +08:00
parent ccf53dcb88
commit 21232703af
4 changed files with 14 additions and 14 deletions

View File

@@ -39,7 +39,7 @@ const (
tcpKeepaliveInterval = 30 * time.Second
)
func withTCPHandler(handle func(adapter.TCPConn), callback func(tcpip.Error)) option.Option {
func withTCPHandler(handle func(adapter.TCPConn), printf func(string, ...any)) option.Option {
return func(s *stack.Stack) error {
tcpForwarder := tcp.NewForwarder(s, defaultWndSize, maxConnAttempts, func(r *tcp.ForwarderRequest) {
var (
@@ -50,7 +50,7 @@ func withTCPHandler(handle func(adapter.TCPConn), callback func(tcpip.Error)) op
defer func() {
if err != nil {
callback(err)
printf("forward tcp request: %s", err)
}
}()