mirror of
https://github.com/status-im/status-go.git
synced 2025-02-22 19:58:29 +00:00
Update vendor Integrate rendezvous into status node Add a test with failover using rendezvous Use multiple servers in client Use discovery V5 by default and test that node can be started with rendezvous discovet Fix linter Update rendezvous client to one with instrumented stream Address feedback Fix test with updated topic limits Apply several suggestions Change log to debug for request errors because we continue execution Remove web3js after rebase Update rendezvous package
42 lines
947 B
Go
42 lines
947 B
Go
package peerstream_multiplex
|
|
|
|
import (
|
|
"net"
|
|
|
|
smux "github.com/libp2p/go-stream-muxer"
|
|
mp "github.com/whyrusleeping/go-multiplex" // Conn is a connection to a remote peer.
|
|
)
|
|
|
|
type conn struct {
|
|
*mp.Multiplex
|
|
}
|
|
|
|
func (c *conn) Close() error {
|
|
return c.Multiplex.Close()
|
|
}
|
|
|
|
func (c *conn) IsClosed() bool {
|
|
return c.Multiplex.IsClosed()
|
|
}
|
|
|
|
// OpenStream creates a new stream.
|
|
func (c *conn) OpenStream() (smux.Stream, error) {
|
|
return c.Multiplex.NewStream()
|
|
}
|
|
|
|
// AcceptStream accepts a stream opened by the other side.
|
|
func (c *conn) AcceptStream() (smux.Stream, error) {
|
|
return c.Multiplex.Accept()
|
|
}
|
|
|
|
// Transport is a go-peerstream transport that constructs
|
|
// multiplex-backed connections.
|
|
type Transport struct{}
|
|
|
|
// DefaultTransport has default settings for multiplex
|
|
var DefaultTransport = &Transport{}
|
|
|
|
func (t *Transport) NewConn(nc net.Conn, isServer bool) (smux.Conn, error) {
|
|
return &conn{mp.NewMultiplex(nc, isServer)}, nil
|
|
}
|