Unverified Commit cc53c4f8 authored by Marten Seemann's avatar Marten Seemann Committed by GitHub

Merge pull request #32 from libp2p/alpn

set an ALPN value in the tls.Config
parents b3618ca6 5294b2b9
...@@ -21,6 +21,7 @@ import ( ...@@ -21,6 +21,7 @@ import (
const certValidityPeriod = 100 * 365 * 24 * time.Hour // ~100 years const certValidityPeriod = 100 * 365 * 24 * time.Hour // ~100 years
const certificatePrefix = "libp2p-tls-handshake:" const certificatePrefix = "libp2p-tls-handshake:"
const alpn string = "libp2p"
var extensionID = getPrefixedExtensionID([]int{1, 1}) var extensionID = getPrefixedExtensionID([]int{1, 1})
...@@ -50,6 +51,7 @@ func NewIdentity(privKey ic.PrivKey) (*Identity, error) { ...@@ -50,6 +51,7 @@ func NewIdentity(privKey ic.PrivKey) (*Identity, error) {
VerifyPeerCertificate: func(_ [][]byte, _ [][]*x509.Certificate) error { VerifyPeerCertificate: func(_ [][]byte, _ [][]*x509.Certificate) error {
panic("tls config not specialized for peer") panic("tls config not specialized for peer")
}, },
NextProtos: []string{alpn},
SessionTicketsDisabled: true, SessionTicketsDisabled: true,
}, },
}, nil }, nil
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment