mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-06-09 12:58:15 +03:00
Add TLS fragment support
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
|
||||
"github.com/sagernet/sing-box/adapter"
|
||||
"github.com/sagernet/sing-box/common/dialer"
|
||||
"github.com/sagernet/sing-box/common/tlsfragment"
|
||||
C "github.com/sagernet/sing-box/constant"
|
||||
"github.com/sagernet/sing/common"
|
||||
"github.com/sagernet/sing/common/buf"
|
||||
@@ -78,6 +79,21 @@ func (m *ConnectionManager) NewConnection(ctx context.Context, this N.Dialer, co
|
||||
m.logger.ErrorContext(ctx, err)
|
||||
return
|
||||
}
|
||||
if metadata.TLSFragment {
|
||||
fallbackDelay := metadata.TLSFragmentFallbackDelay
|
||||
if fallbackDelay == 0 {
|
||||
fallbackDelay = C.TLSFragmentFallbackDelay
|
||||
}
|
||||
var newConn *tf.Conn
|
||||
newConn, err = tf.NewConn(remoteConn, ctx, fallbackDelay)
|
||||
if err != nil {
|
||||
conn.Close()
|
||||
remoteConn.Close()
|
||||
m.logger.ErrorContext(ctx, err)
|
||||
return
|
||||
}
|
||||
remoteConn = newConn
|
||||
}
|
||||
m.access.Lock()
|
||||
element := m.connections.PushBack(conn)
|
||||
m.access.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user