mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-08-16 07:17:36 +08:00
Add support for ech retry configs
This commit is contained in:
parent
2b14292e6b
commit
8fd51eb2a2
@ -2,6 +2,8 @@ package tls
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"crypto/tls"
|
||||||
|
"errors"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
@ -41,6 +43,12 @@ func ClientHandshake(ctx context.Context, conn net.Conn, config Config) (Conn, e
|
|||||||
ctx, cancel := context.WithTimeout(ctx, C.TCPTimeout)
|
ctx, cancel := context.WithTimeout(ctx, C.TCPTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
tlsConn, err := aTLS.ClientHandshake(ctx, conn, config)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package ssmapi
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
C "github.com/sagernet/sing-box/constant"
|
C "github.com/sagernet/sing-box/constant"
|
||||||
"github.com/sagernet/sing/common/logger"
|
"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) {
|
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()
|
users := s.user.List()
|
||||||
s.traffic.ReadUsers(users)
|
s.traffic.ReadUsers(users)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user