@@ -31,6 +31,7 @@ import (
31
31
"github.com/libp2p/go-libp2p/p2p/protocol/ping"
32
32
"github.com/libp2p/go-libp2p/p2p/security/noise"
33
33
tls "github.com/libp2p/go-libp2p/p2p/security/tls"
34
+ "github.com/libp2p/go-libp2p/p2p/transport/tcp"
34
35
libp2pwebrtc "github.com/libp2p/go-libp2p/p2p/transport/webrtc"
35
36
"go.uber.org/mock/gomock"
36
37
@@ -116,6 +117,41 @@ var transportsToTest = []TransportTestCase{
116
117
return h
117
118
},
118
119
},
120
+ {
121
+ Name : "TCP-Shared-WithMetrics / TLS / Yamux" ,
122
+ HostGenerator : func (t * testing.T , opts TransportTestCaseOpts ) host.Host {
123
+ libp2pOpts := transformOpts (opts )
124
+ libp2pOpts = append (libp2pOpts , libp2p .ShareTCPListener ())
125
+ libp2pOpts = append (libp2pOpts , libp2p .Security (tls .ID , tls .New ))
126
+ libp2pOpts = append (libp2pOpts , libp2p .Muxer (yamux .ID , yamux .DefaultTransport ))
127
+ libp2pOpts = append (libp2pOpts , libp2p .Transport (tcp .NewTCPTransport , tcp .WithMetrics ()))
128
+ if opts .NoListen {
129
+ libp2pOpts = append (libp2pOpts , libp2p .NoListenAddrs )
130
+ } else {
131
+ libp2pOpts = append (libp2pOpts , libp2p .ListenAddrStrings ("/ip4/127.0.0.1/tcp/0" ))
132
+ }
133
+ h , err := libp2p .New (libp2pOpts ... )
134
+ require .NoError (t , err )
135
+ return h
136
+ },
137
+ },
138
+ {
139
+ Name : "TCP-WithMetrics / TLS / Yamux" ,
140
+ HostGenerator : func (t * testing.T , opts TransportTestCaseOpts ) host.Host {
141
+ libp2pOpts := transformOpts (opts )
142
+ libp2pOpts = append (libp2pOpts , libp2p .Security (tls .ID , tls .New ))
143
+ libp2pOpts = append (libp2pOpts , libp2p .Muxer (yamux .ID , yamux .DefaultTransport ))
144
+ libp2pOpts = append (libp2pOpts , libp2p .Transport (tcp .NewTCPTransport , tcp .WithMetrics ()))
145
+ if opts .NoListen {
146
+ libp2pOpts = append (libp2pOpts , libp2p .NoListenAddrs )
147
+ } else {
148
+ libp2pOpts = append (libp2pOpts , libp2p .ListenAddrStrings ("/ip4/127.0.0.1/tcp/0" ))
149
+ }
150
+ h , err := libp2p .New (libp2pOpts ... )
151
+ require .NoError (t , err )
152
+ return h
153
+ },
154
+ },
119
155
{
120
156
Name : "WebSocket-Shared" ,
121
157
HostGenerator : func (t * testing.T , opts TransportTestCaseOpts ) host.Host {
0 commit comments