Add support for ech retry configs

This commit is contained in:
neletor 2025-08-11 21:18:34 +08:00 committed by 世界
parent 2b14292e6b
commit 8fd51eb2a2
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
2 changed files with 10 additions and 1 deletions

View File

@ -2,6 +2,8 @@ package tls
import (
"context"
"crypto/tls"
"errors"
"net"
"os"
@ -41,6 +43,12 @@ func ClientHandshake(ctx context.Context, conn net.Conn, config Config) (Conn, e
ctx, cancel := context.WithTimeout(ctx, C.TCPTimeout)
defer cancel()
tlsConn, err := aTLS.ClientHandshake(ctx, conn, config)
var echErr *tls.ECHRejectionError
if errors.As(err, &echErr) && len(echErr.RetryConfigList) > 0 {
if echConfig, isECH := config.(ECHCapableConfig); isECH {
echConfig.SetECHConfigList(echErr.RetryConfigList)
}
}
if err != nil {
return nil, err
}

View File

@ -2,6 +2,7 @@ package ssmapi
import (
"net/http"
"strconv"
C "github.com/sagernet/sing-box/constant"
"github.com/sagernet/sing/common/logger"
@ -156,7 +157,7 @@ func (s *APIServer) deleteUser(writer http.ResponseWriter, request *http.Request
}
func (s *APIServer) getStats(writer http.ResponseWriter, request *http.Request) {
requireClear := chi.URLParam(request, "clear") == "true"
requireClear, _ := strconv.ParseBool(chi.URLParam(request, "clear"))
users := s.user.List()
s.traffic.ReadUsers(users)