replace tpt.ConnWrap by a tcpConn
The tpt.ConnWrap is being removed from go-libp2p-transport
@@ -199,9 +199,9 @@ func (d *tcpDialer) DialContext(ctx context.Context, raddr ma.Multiaddr) (tpt.Co
return nil, err
}
- return &tpt.ConnWrap{
+ return &tcpConn{
Conn: c,
- Tpt: d.transport,
+ t: d.transport,
}, nil
}
@@ -250,9 +250,9 @@ func (d *tcpListener) Accept() (tpt.Conn, error) {
return nil, err
}
- return &tpt.ConnWrap{
+ return &tcpConn{
Conn: c,
- Tpt: d.transport,
+ t: d.transport,
}, nil
}
@@ -271,3 +271,15 @@ func (t *tcpListener) NetListener() net.Listener {
func (d *tcpListener) Close() error {
return d.list.Close()
}
+
+type tcpConn struct {
+ manet.Conn
+ t tpt.Transport
+}
+
+var _ tpt.Conn = &tcpConn{}
+var _ tpt.SingleStreamConn = &tcpConn{}
+
+func (c *tcpConn) Transport() tpt.Transport {
+ return c.t
+}
