From 27cfd3f4edee0f702fac02311cc29a7506859159 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Wed, 27 Apr 2022 12:00:11 +0200 Subject: [PATCH] switch from github.com/libp2p/go-libp2p-tls to p2p/security/tls --- defaults.go | 2 +- go.mod | 4 ++-- p2p/security/tls/cmd/tlsdiag.go | 2 +- p2p/security/tls/cmd/tlsdiag/client.go | 3 ++- p2p/security/tls/cmd/tlsdiag/server.go | 3 ++- p2p/security/tls/transport.go | 2 +- p2p/transport/quic/listener.go | 4 ++-- p2p/transport/quic/transport.go | 4 ++-- 8 files changed, 13 insertions(+), 11 deletions(-) diff --git a/defaults.go b/defaults.go index 759955a9..7cca89a6 100644 --- a/defaults.go +++ b/defaults.go @@ -8,6 +8,7 @@ import ( "github.com/libp2p/go-libp2p/p2p/muxer/yamux" "github.com/libp2p/go-libp2p/p2p/net/connmgr" "github.com/libp2p/go-libp2p/p2p/security/noise" + tls "github.com/libp2p/go-libp2p/p2p/security/tls" quic "github.com/libp2p/go-libp2p/p2p/transport/quic" "github.com/libp2p/go-libp2p/p2p/transport/tcp" ws "github.com/libp2p/go-libp2p/p2p/transport/websocket" @@ -16,7 +17,6 @@ import ( "github.com/libp2p/go-libp2p-peerstore/pstoremem" rcmgr "github.com/libp2p/go-libp2p-resource-manager" - tls "github.com/libp2p/go-libp2p-tls" "github.com/multiformats/go-multiaddr" ) diff --git a/go.mod b/go.mod index 77aa4075..edef69c5 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,6 @@ require ( github.com/libp2p/go-libp2p-pnet v0.2.0 github.com/libp2p/go-libp2p-resource-manager v0.2.1 github.com/libp2p/go-libp2p-testing v0.9.2 - github.com/libp2p/go-libp2p-tls v0.4.1 github.com/libp2p/go-mplex v0.7.0 github.com/libp2p/go-msgio v0.2.0 github.com/libp2p/go-netroute v0.2.0 @@ -52,6 +51,7 @@ require ( github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 golang.org/x/sync v0.0.0-20210220032951-036812b2e83c + golang.org/x/sys v0.0.0-20220412211240-33da011f77ad ) require ( @@ -82,6 +82,7 @@ require ( github.com/libp2p/go-libp2p-blankhost v0.3.0 // indirect github.com/libp2p/go-libp2p-quic-transport v0.17.0 // indirect github.com/libp2p/go-libp2p-swarm v0.10.2 // indirect + github.com/libp2p/go-libp2p-tls v0.4.1 // indirect github.com/libp2p/go-libp2p-transport-upgrader v0.7.1 // indirect github.com/libp2p/go-libp2p-yamux v0.9.1 // indirect github.com/libp2p/go-nat v0.1.0 // indirect @@ -117,7 +118,6 @@ require ( go.uber.org/zap v1.21.0 // indirect golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect golang.org/x/net v0.0.0-20220418201149-a630d4f3e7a2 // indirect - golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect golang.org/x/tools v0.1.10 // indirect golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect google.golang.org/grpc v1.45.0 // indirect diff --git a/p2p/security/tls/cmd/tlsdiag.go b/p2p/security/tls/cmd/tlsdiag.go index 4aa2f2f0..d6f7bac6 100644 --- a/p2p/security/tls/cmd/tlsdiag.go +++ b/p2p/security/tls/cmd/tlsdiag.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "github.com/libp2p/go-libp2p-tls/cmd/tlsdiag" + "github.com/libp2p/go-libp2p/p2p/security/tls/cmd/tlsdiag" ) func main() { diff --git a/p2p/security/tls/cmd/tlsdiag/client.go b/p2p/security/tls/cmd/tlsdiag/client.go index 9bf2e69c..b902f509 100644 --- a/p2p/security/tls/cmd/tlsdiag/client.go +++ b/p2p/security/tls/cmd/tlsdiag/client.go @@ -8,8 +8,9 @@ import ( "net" "time" + libp2ptls "github.com/libp2p/go-libp2p/p2p/security/tls" + "github.com/libp2p/go-libp2p-core/peer" - libp2ptls "github.com/libp2p/go-libp2p-tls" ) func StartClient() error { diff --git a/p2p/security/tls/cmd/tlsdiag/server.go b/p2p/security/tls/cmd/tlsdiag/server.go index 6934f103..5f85bc72 100644 --- a/p2p/security/tls/cmd/tlsdiag/server.go +++ b/p2p/security/tls/cmd/tlsdiag/server.go @@ -7,8 +7,9 @@ import ( "net" "time" + libp2ptls "github.com/libp2p/go-libp2p/p2p/security/tls" + "github.com/libp2p/go-libp2p-core/peer" - libp2ptls "github.com/libp2p/go-libp2p-tls" ) func StartServer() error { diff --git a/p2p/security/tls/transport.go b/p2p/security/tls/transport.go index fcdbd3c6..f8911fc9 100644 --- a/p2p/security/tls/transport.go +++ b/p2p/security/tls/transport.go @@ -93,7 +93,7 @@ func (t *Transport) handshake(ctx context.Context, tlsConn *tls.Conn, keyCh <-ch default: } if remotePubKey == nil { - return nil, errors.New("go-libp2p-tls BUG: expected remote pub key to be set") + return nil, errors.New("go-libp2p tls BUG: expected remote pub key to be set") } return t.setupConn(tlsConn, remotePubKey) diff --git a/p2p/transport/quic/listener.go b/p2p/transport/quic/listener.go index d6a20d22..293fa031 100644 --- a/p2p/transport/quic/listener.go +++ b/p2p/transport/quic/listener.go @@ -5,13 +5,13 @@ import ( "crypto/tls" "net" + p2ptls "github.com/libp2p/go-libp2p/p2p/security/tls" + ic "github.com/libp2p/go-libp2p-core/crypto" "github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p-core/peer" tpt "github.com/libp2p/go-libp2p-core/transport" - p2ptls "github.com/libp2p/go-libp2p-tls" - "github.com/lucas-clemente/quic-go" ma "github.com/multiformats/go-multiaddr" ) diff --git a/p2p/transport/quic/transport.go b/p2p/transport/quic/transport.go index fbc8abc7..a36b3e58 100644 --- a/p2p/transport/quic/transport.go +++ b/p2p/transport/quic/transport.go @@ -12,6 +12,8 @@ import ( "golang.org/x/crypto/hkdf" + p2ptls "github.com/libp2p/go-libp2p/p2p/security/tls" + "github.com/libp2p/go-libp2p-core/connmgr" ic "github.com/libp2p/go-libp2p-core/crypto" "github.com/libp2p/go-libp2p-core/network" @@ -19,8 +21,6 @@ import ( "github.com/libp2p/go-libp2p-core/pnet" tpt "github.com/libp2p/go-libp2p-core/transport" - p2ptls "github.com/libp2p/go-libp2p-tls" - ma "github.com/multiformats/go-multiaddr" mafmt "github.com/multiformats/go-multiaddr-fmt" manet "github.com/multiformats/go-multiaddr/net"