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

41 lines
742 B
Go
Raw Normal View History

package stream
import (
"fmt"
2019-06-09 07:24:20 +00:00
"github.com/libp2p/go-libp2p-core/mux"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/transport"
)
type transportConn struct {
2019-06-09 07:24:20 +00:00
mux.MuxedConn
network.ConnMultiaddrs
network.ConnSecurity
transport transport.Transport
2021-10-19 13:43:41 +00:00
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(),
)
}
2021-10-19 13:43:41 +00:00
func (t *transportConn) Stat() network.Stat {
return t.stat
}