hostnameInSNI converts name into an appropriate hostname for SNI. Literal IP addresses and absolute FQDNs are not permitted as SNI values. See RFC 6066, Section 3.
(name string)
| 1300 | // Literal IP addresses and absolute FQDNs are not permitted as SNI values. |
| 1301 | // See RFC 6066, Section 3. |
| 1302 | func hostnameInSNI(name string) string { |
| 1303 | host := name |
| 1304 | if len(host) > 0 && host[0] == '[' && host[len(host)-1] == ']' { |
| 1305 | host = host[1 : len(host)-1] |
| 1306 | } |
| 1307 | if i := strings.LastIndex(host, "%"); i > 0 { |
| 1308 | host = host[:i] |
| 1309 | } |
| 1310 | if net.ParseIP(host) != nil { |
| 1311 | return "" |
| 1312 | } |
| 1313 | for len(name) > 0 && name[len(name)-1] == '.' { |
| 1314 | name = name[:len(name)-1] |
| 1315 | } |
| 1316 | return name |
| 1317 | } |
| 1318 | |
| 1319 | func computeAndUpdatePSK(m *clientHelloMsg, binderKey []byte, transcript hash.Hash, finishedHash func([]byte, hash.Hash) []byte) error { |
| 1320 | helloBytes, err := m.marshalWithoutBinders() |
no outgoing calls
no test coverage detected
searching dependent graphs…