inbound tfo

This commit is contained in:
zhudan
2022-07-22 15:16:09 +08:00
parent b0fd50453a
commit 143c5de51d
8 changed files with 43 additions and 12 deletions

View File

@ -1,6 +1,8 @@
package socks
import (
"context"
"github.com/database64128/tfo-go"
"io"
"net"
@ -34,8 +36,11 @@ func (l *Listener) Close() error {
return l.listener.Close()
}
func New(addr string, in chan<- C.ConnContext) (*Listener, error) {
l, err := net.Listen("tcp", addr)
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)
if err != nil {
return nil, err
}