Add custom TLS server support for http based v2ray transports

This commit is contained in:
世界
2023-02-28 12:29:02 +08:00
parent f15f525c5c
commit ed50257735
13 changed files with 768 additions and 146 deletions

View File

@@ -8,7 +8,6 @@ import (
"encoding/base64"
"encoding/hex"
"net"
"os"
"time"
"github.com/sagernet/reality"
@@ -135,7 +134,7 @@ func (c *RealityServerConfig) Config() (*tls.Config, error) {
}
func (c *RealityServerConfig) Client(conn net.Conn) (Conn, error) {
return nil, os.ErrInvalid
return ClientHandshake(context.Background(), conn, c)
}
func (c *RealityServerConfig) Start() error {
@@ -147,7 +146,7 @@ func (c *RealityServerConfig) Close() error {
}
func (c *RealityServerConfig) Server(conn net.Conn) (Conn, error) {
return nil, os.ErrInvalid
return ServerHandshake(context.Background(), conn, c)
}
func (c *RealityServerConfig) ServerHandshake(ctx context.Context, conn net.Conn) (Conn, error) {