@@ -3,12 +3,15 @@ package peerstream_multiplex
3
3
import (
4
4
"context"
5
5
6
- "github.com/libp2p/go-libp2p-core/mux"
6
+ "github.com/libp2p/go-libp2p-core/network"
7
+
7
8
mp "github.com/libp2p/go-mplex"
8
9
)
9
10
10
11
type conn mp.Multiplex
11
12
13
+ var _ network.MuxedConn = & conn {}
14
+
12
15
func (c * conn ) Close () error {
13
16
return c .mplex ().Close ()
14
17
}
@@ -18,7 +21,7 @@ func (c *conn) IsClosed() bool {
18
21
}
19
22
20
23
// OpenStream creates a new stream.
21
- func (c * conn ) OpenStream (ctx context.Context ) (mux .MuxedStream , error ) {
24
+ func (c * conn ) OpenStream (ctx context.Context ) (network .MuxedStream , error ) {
22
25
s , err := c .mplex ().NewStream (ctx )
23
26
if err != nil {
24
27
return nil , err
@@ -27,7 +30,7 @@ func (c *conn) OpenStream(ctx context.Context) (mux.MuxedStream, error) {
27
30
}
28
31
29
32
// AcceptStream accepts a stream opened by the other side.
30
- func (c * conn ) AcceptStream () (mux .MuxedStream , error ) {
33
+ func (c * conn ) AcceptStream () (network .MuxedStream , error ) {
31
34
s , err := c .mplex ().Accept ()
32
35
if err != nil {
33
36
return nil , err
@@ -38,5 +41,3 @@ func (c *conn) AcceptStream() (mux.MuxedStream, error) {
38
41
func (c * conn ) mplex () * mp.Multiplex {
39
42
return (* mp .Multiplex )(c )
40
43
}
41
-
42
- var _ mux.MuxedConn = & conn {}
0 commit comments