remove the unneeded connSecurityMultiaddrs interface

This commit is contained in:
Marten Seemann 2022-09-07 10:19:30 +03:00
parent ef657d6d7c
commit d2b47dd539
3 changed files with 7 additions and 12 deletions

View File

@ -10,12 +10,7 @@ import (
ma "github.com/multiformats/go-multiaddr"
)
type connSecurityMultiaddrs interface {
network.ConnMultiaddrs
network.ConnSecurity
}
type connSecurityMultiaddrsImpl struct {
type connSecurityMultiaddrs struct {
network.ConnSecurity
network.ConnMultiaddrs
}
@ -30,7 +25,7 @@ func (c *connMultiaddrs) LocalMultiaddr() ma.Multiaddr { return c.local }
func (c *connMultiaddrs) RemoteMultiaddr() ma.Multiaddr { return c.remote }
type conn struct {
connSecurityMultiaddrs
*connSecurityMultiaddrs
transport tpt.Transport
session *webtransport.Session
@ -40,7 +35,7 @@ type conn struct {
var _ tpt.CapableConn = &conn{}
func newConn(tr tpt.Transport, sess *webtransport.Session, sconn connSecurityMultiaddrs, scope network.ConnScope) *conn {
func newConn(tr tpt.Transport, sess *webtransport.Session, sconn *connSecurityMultiaddrs, scope network.ConnScope) *conn {
return &conn{
connSecurityMultiaddrs: sconn,
transport: tr,

View File

@ -171,7 +171,7 @@ func (l *listener) Accept() (tpt.CapableConn, error) {
}
}
func (l *listener) handshake(ctx context.Context, sess *webtransport.Session) (connSecurityMultiaddrs, error) {
func (l *listener) handshake(ctx context.Context, sess *webtransport.Session) (*connSecurityMultiaddrs, error) {
local, err := toWebtransportMultiaddr(sess.LocalAddr())
if err != nil {
return nil, fmt.Errorf("error determiniting local addr: %w", err)
@ -194,7 +194,7 @@ func (l *listener) handshake(ctx context.Context, sess *webtransport.Session) (c
return nil, err
}
return &connSecurityMultiaddrsImpl{
return &connSecurityMultiaddrs{
ConnSecurity: c,
ConnMultiaddrs: &connMultiaddrs{local: local, remote: remote},
}, nil

View File

@ -179,7 +179,7 @@ func (t *transport) dial(ctx context.Context, addr string, certHashes []multihas
return sess, err
}
func (t *transport) upgrade(ctx context.Context, sess *webtransport.Session, p peer.ID, certHashes []multihash.DecodedMultihash) (connSecurityMultiaddrs, error) {
func (t *transport) upgrade(ctx context.Context, sess *webtransport.Session, p peer.ID, certHashes []multihash.DecodedMultihash) (*connSecurityMultiaddrs, error) {
local, err := toWebtransportMultiaddr(sess.LocalAddr())
if err != nil {
return nil, fmt.Errorf("error determiniting local addr: %w", err)
@ -215,7 +215,7 @@ func (t *transport) upgrade(ctx context.Context, sess *webtransport.Session, p p
if err != nil {
return nil, err
}
return &connSecurityMultiaddrsImpl{
return &connSecurityMultiaddrs{
ConnSecurity: c,
ConnMultiaddrs: &connMultiaddrs{local: local, remote: remote},
}, nil