MCPcopy Create free account
hub / github.com/XTLS/Go / checkALPN

Function checkALPN

handshake_client.go:752–765  ·  view source on GitHub ↗

checkALPN ensure that the server's choice of ALPN protocol is compatible with the protocols that we advertised in the Client Hello.

(clientProtos []string, serverProto string)

Source from the content-addressed store, hash-verified

750// checkALPN ensure that the server's choice of ALPN protocol is compatible with
751// the protocols that we advertised in the Client Hello.
752func checkALPN(clientProtos []string, serverProto string) error {
753 if serverProto == "" {
754 return nil
755 }
756 if len(clientProtos) == 0 {
757 return errors.New("tls: server advertised unrequested ALPN extension")
758 }
759 for _, proto := range clientProtos {
760 if proto == serverProto {
761 return nil
762 }
763 }
764 return errors.New("tls: server selected unadvertised ALPN protocol")
765}
766
767func (hs *clientHandshakeState) readFinished(out []byte) error {
768 c := hs.c

Callers 2

processServerHelloMethod · 0.85
readServerParametersMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…