Add custom tls client support for v2ray h2/grpclite transports

This commit is contained in:
世界
2022-09-11 10:22:52 +08:00
parent 7e09beb0c3
commit a2d1f89922
14 changed files with 211 additions and 129 deletions

View File

@@ -17,6 +17,8 @@ import (
M "github.com/sagernet/sing/common/metadata"
N "github.com/sagernet/sing/common/network"
sHttp "github.com/sagernet/sing/protocol/http"
"golang.org/x/net/http2"
)
var _ adapter.V2RayServerTransport = (*Server)(nil)
@@ -87,6 +89,10 @@ func (s *Server) Serve(listener net.Listener) error {
if s.httpServer.TLSConfig == nil {
return s.httpServer.Serve(listener)
} else {
err := http2.ConfigureServer(s.httpServer, &http2.Server{})
if err != nil {
return err
}
return s.httpServer.ServeTLS(listener, "", "")
}
}