MCPcopy
hub / github.com/grpc/grpc-go / tlsServerHandshake

Function tlsServerHandshake

credentials/credentials_test.go:295–310  ·  view source on GitHub ↗
(conn net.Conn)

Source from the content-addressed store, hash-verified

293}
294
295func tlsServerHandshake(conn net.Conn) (AuthInfo, error) {
296 cert, err := tls.LoadX509KeyPair(testdata.Path("x509/server1_cert.pem"), testdata.Path("x509/server1_key.pem"))
297 if err != nil {
298 return nil, err
299 }
300 serverTLSConfig := &tls.Config{
301 Certificates: []tls.Certificate{cert},
302 NextProtos: []string{"h2"},
303 }
304 serverConn := tls.Server(conn, serverTLSConfig)
305 err = serverConn.Handshake()
306 if err != nil {
307 return nil, err
308 }
309 return TLSInfo{State: serverConn.ConnectionState(), CommonAuthInfo: CommonAuthInfo{SecurityLevel: PrivacyAndIntegrity}}, nil
310}
311
312func tlsClientHandshake(conn net.Conn, _ string) (AuthInfo, error) {
313 clientTLSConfig := &tls.Config{

Callers

nothing calls this directly

Calls 1

PathFunction · 0.92

Tested by

no test coverage detected