inbound tfo
This commit is contained in:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user