Skip to content
This repository was archived by the owner on Aug 19, 2022. It is now read-only.

Commit 7c3be52

Browse files
use TLS session resumption, store session tickets in the peerstore
1 parent ef83371 commit 7c3be52

File tree

5 files changed

+238
-87
lines changed

5 files changed

+238
-87
lines changed

crypto.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
const certValidityPeriod = 100 * 365 * 24 * time.Hour // ~100 years
2323
const certificatePrefix = "libp2p-tls-handshake:"
2424
const alpn string = "libp2p"
25+
const peerStoreKey = "libp2p-tls-session-cache"
2526

2627
var extensionID = getPrefixedExtensionID([]int{1, 1})
2728

@@ -52,7 +53,7 @@ func NewIdentity(privKey ic.PrivKey) (*Identity, error) {
5253
panic("tls config not specialized for peer")
5354
},
5455
NextProtos: []string{alpn},
55-
SessionTicketsDisabled: true,
56+
SessionTicketsDisabled: false,
5657
},
5758
}, nil
5859
}

go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ module github.com/libp2p/go-libp2p-tls
33
go 1.14
44

55
require (
6-
github.com/libp2p/go-libp2p-core v0.3.0
6+
github.com/libp2p/go-libp2p-core v0.6.1
7+
github.com/libp2p/go-libp2p-peerstore v0.2.6
78
github.com/onsi/ginkgo v1.12.0
89
github.com/onsi/gomega v1.9.0
9-
golang.org/x/sys v0.0.0-20191206220618-eeba5f6aabab
10+
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5
1011
)

0 commit comments

Comments
 (0)