MCPcopy Create free account
hub / github.com/M1r0ku/frp-Modify / readClientHello

Function readClientHello

frp-dev/pkg/util/vhost/https.go:49–67  ·  view source on GitHub ↗
(reader io.Reader)

Source from the content-addressed store, hash-verified

47}
48
49func readClientHello(reader io.Reader) (*tls.ClientHelloInfo, error) {
50 var hello *tls.ClientHelloInfo
51
52 // Note that Handshake always fails because the readOnlyConn is not a real connection.
53 // As long as the Client Hello is successfully read, the failure should only happen after GetConfigForClient is called,
54 // so we only care about the error if hello was never set.
55 err := tls.Server(readOnlyConn{reader: reader}, &tls.Config{
56 GetConfigForClient: func(argHello *tls.ClientHelloInfo) (*tls.Config, error) {
57 hello = &tls.ClientHelloInfo{}
58 *hello = *argHello
59 return nil, nil
60 },
61 }).Handshake()
62
63 if hello == nil {
64 return nil, err
65 }
66 return hello, nil
67}
68
69type readOnlyConn struct {
70 reader io.Reader

Callers 1

GetHTTPSHostnameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected