chore: better tfo inbound code

This commit is contained in:
wwqgtxx
2022-11-16 10:43:16 +08:00
parent 03645fb235
commit 1880a485f8
11 changed files with 55 additions and 64 deletions

View File

@ -1,8 +1,6 @@
package socks
import (
"context"
"github.com/database64128/tfo-go/v2"
"io"
"net"
@ -36,11 +34,8 @@ func (l *Listener) Close() error {
return l.listener.Close()
}
func New(addr string, inboundTfo bool, in chan<- C.ConnContext) (*Listener, error) {
lc := tfo.ListenConfig{
DisableTFO: !inboundTfo,
}
l, err := lc.Listen(context.Background(), "tcp", addr)
func New(addr string, in chan<- C.ConnContext) (*Listener, error) {
l, err := inbound.Listen("tcp", addr)
if err != nil {
return nil, err
}