mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-12-01 14:18:36 +00:00
fix: Preserve TrustTunnel streams after sniff timeout
This commit is contained in:
@@ -27,7 +27,6 @@ import (
|
||||
aTLS "github.com/sagernet/sing/common/tls"
|
||||
|
||||
"golang.org/x/net/http2"
|
||||
"golang.org/x/net/http2/h2c"
|
||||
)
|
||||
|
||||
func RegisterInbound(registry *inbound.Registry) {
|
||||
@@ -104,8 +103,13 @@ func (h *Inbound) Start(stage adapter.StartStage, scope *adapter.Scope) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
protocols := new(http.Protocols)
|
||||
protocols.SetHTTP1(true)
|
||||
protocols.SetUnencryptedHTTP2(true)
|
||||
h.httpServer = &http.Server{
|
||||
Handler: h2c.NewHandler(h.service, &http2.Server{}),
|
||||
Handler: h.service,
|
||||
IdleTimeout: trusttunnel.DefaultSessionTimeout,
|
||||
Protocols: protocols,
|
||||
BaseContext: func(net.Listener) context.Context {
|
||||
return h.ctx
|
||||
},
|
||||
@@ -150,14 +154,15 @@ func (h *Inbound) Start(stage adapter.StartStage, scope *adapter.Scope) error {
|
||||
return err
|
||||
}
|
||||
h.http3Server = &http3.Server{
|
||||
Handler: h.service,
|
||||
Handler: h.service,
|
||||
IdleTimeout: trusttunnel.DefaultSessionTimeout,
|
||||
ConnContext: func(ctx context.Context, conn *quic.Conn) context.Context {
|
||||
conn.SetCongestionControl(congestionControlFactory(conn))
|
||||
return ctx
|
||||
},
|
||||
}
|
||||
quicListener, err := qtls.ListenEarly(udpConn, h.http3TLSConfig, &quic.Config{
|
||||
MaxIdleTimeout: trusttunnel.DefaultSessionTimeout * 2,
|
||||
MaxIdleTimeout: 2 * (trusttunnel.DefaultConnectionTimeout + trusttunnel.DefaultHealthCheckTimeout),
|
||||
MaxIncomingStreams: 1 << 60,
|
||||
Allow0RTT: true,
|
||||
DisablePathMTUDiscovery: h.options.DisablePathMTUDiscovery,
|
||||
|
||||
Reference in New Issue
Block a user