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

41 lines
742 B
Go

package stream
import (
"fmt"
"github.com/libp2p/go-libp2p-core/mux"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/transport"
)
type transportConn struct {
mux.MuxedConn
network.ConnMultiaddrs
network.ConnSecurity
transport transport.Transport
stat network.Stat
}
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(),
)
}
func (t *transportConn) Stat() network.Stat {
return t.stat
}