mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-12 07:08:41 +00:00
Add shadow-tls support
This commit is contained in:
parent
4d5c3195d2
commit
d6c2a9aab7
25 changed files with 1311 additions and 130 deletions
21
transport/internet/tls/custom.go
Normal file
21
transport/internet/tls/custom.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package tls
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
|
||||
"github.com/xtls/xray-core/common/net"
|
||||
)
|
||||
|
||||
type customClientKey struct{}
|
||||
|
||||
type CustomClientFunc func(conn net.Conn, config *tls.Config) net.Conn
|
||||
|
||||
func CustomClientFromContext(ctx context.Context) (CustomClientFunc, bool) {
|
||||
client, loaded := ctx.Value(customClientKey{}).(CustomClientFunc)
|
||||
return client, loaded
|
||||
}
|
||||
|
||||
func ContextWithCustomClient(ctx context.Context, customClient CustomClientFunc) context.Context {
|
||||
return context.WithValue(ctx, customClientKey{}, customClient)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue