Add health check support for http-based v2ray transport

This commit is contained in:
世界
2023-03-11 15:49:02 +08:00
parent bdc620dab1
commit 6af9c2b3ca
7 changed files with 45 additions and 12 deletions

View File

@@ -8,6 +8,7 @@ import (
"net/url"
"os"
"strings"
"time"
"github.com/sagernet/sing-box/adapter"
"github.com/sagernet/sing-box/common/tls"
@@ -45,7 +46,9 @@ func NewServer(ctx context.Context, options option.V2RayGRPCOptions, tlsConfig t
tlsConfig: tlsConfig,
handler: handler,
path: fmt.Sprintf("/%s/Tun", url.QueryEscape(options.ServiceName)),
h2Server: new(http2.Server),
h2Server: &http2.Server{
IdleTimeout: time.Duration(options.IdleTimeout),
},
}
server.httpServer = &http.Server{
Handler: server,