2018-07-04 10:51:47 +00:00
|
|
|
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"
|
2018-07-04 10:51:47 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type transportConn struct {
|
2019-06-09 07:24:20 +00:00
|
|
|
mux.MuxedConn
|
|
|
|
network.ConnMultiaddrs
|
|
|
|
network.ConnSecurity
|
2018-07-04 10:51:47 +00:00
|
|
|
transport transport.Transport
|
2021-10-19 13:43:41 +00:00
|
|
|
stat network.Stat
|
2018-07-04 10:51:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|