spoguļota no
https://github.com/XTLS/Xray-core.git
sinhronizēta 2025-07-03 00:24:15 +00:00
Add shadow-tls support
Šis iesūtījums ir iekļauts:
vecāks
4d5c3195d2
iesūtījums
d6c2a9aab7
25 izmainītas datnes ar 1311 papildinājumiem un 130 izdzēšanām
21
transport/internet/tls/custom.go
Parasta datne
21
transport/internet/tls/custom.go
Parasta datne
|
@ -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)
|
||||
}
|
Notiek ielāde…
Pievienot tabulu
Pievienot saiti
Atsaukties jaunā pieteikumā