status-go/vendor/github.com/libp2p/go-libp2p-transport-upgrader/conn.go

36 lines
647 B
Go
Raw Normal View History

package stream
import (
"fmt"
inet "github.com/libp2p/go-libp2p-net"
transport "github.com/libp2p/go-libp2p-transport"
smux "github.com/libp2p/go-stream-muxer"
)
type transportConn struct {
smux.Conn
inet.ConnMultiaddrs
inet.ConnSecurity
transport transport.Transport
}
func (t *transportConn) Transport() transport.Transport {
return t.transport
}
func (t *transportConn) String() string {
ts := ""
if s, ok := t.transport.(fmt.Stringer); ok {
ts = "[" + s.String() + "]"
}
return fmt.Sprintf(
"<stream.Conn%s %s (%s) <-> %s (%s)>",
ts,
t.LocalMultiaddr(),
t.LocalPeer(),
t.RemoteMultiaddr(),
t.RemotePeer(),
)
}