MCPcopy Create free account
hub / github.com/celzero/midway / TlsConfig

Function TlsConfig

midway/env/util.go:15–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13)
14
15func TlsConfig() *tls.Config {
16 // ref: cs.opensource.google/go/go/+/refs/tags/go1.18:src/net/http/h2_bundle.go;drc=refs%2Ftags%2Fgo1.18;l=3983
17 certificate, _ := TlsCerts()
18 if certificate == nil {
19 log.Print("empty cert")
20 return nil
21 }
22 c := []tls.Certificate{*certificate}
23
24 alpn := []string{"h2", "http/1.1"}
25
26 // ref: github.com/caddyserver/caddy/blob/c48fadc/modules/caddytls/connpolicy.go#L441
27 // ref: github.com/folbricht/routedns/blob/35c9051/tls.go#L12
28 return &tls.Config{
29 Certificates: c,
30 MinVersion: tls.VersionTLS12,
31 NextProtos: alpn,
32 }
33}
34
35func sni(cx *tls.Certificate) []string {
36 // ref: cs.opensource.google/go/go/+/refs/tags/go1.18.1:src/crypto/tls/tls.go;drc=860704317e02d699e4e4a24103853c4782d746c1;l=252

Callers 2

asTLSConnFunction · 0.92
NewTlsListenerFunction · 0.92

Calls 1

TlsCertsFunction · 0.85

Tested by

no test coverage detected