tcp: unexport TcpTransport.Upgrader (#1596)

This commit is contained in:
Marten Seemann 2022-06-23 19:37:07 +02:00 committed by GitHub
parent 86aad883c8
commit 56cc37ad46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -111,7 +111,7 @@ func WithConnectionTimeout(d time.Duration) Option {
type TcpTransport struct { type TcpTransport struct {
// Connection upgrader for upgrading insecure stream connections to // Connection upgrader for upgrading insecure stream connections to
// secure multiplex connections. // secure multiplex connections.
Upgrader transport.Upgrader upgrader transport.Upgrader
// Explicitly disable reuseport. // Explicitly disable reuseport.
disableReuseport bool disableReuseport bool
@ -133,7 +133,7 @@ func NewTCPTransport(upgrader transport.Upgrader, rcmgr network.ResourceManager,
rcmgr = network.NullResourceManager rcmgr = network.NullResourceManager
} }
tr := &TcpTransport{ tr := &TcpTransport{
Upgrader: upgrader, upgrader: upgrader,
connectTimeout: defaultConnectTimeout, // can be set by using the WithConnectionTimeout option connectTimeout: defaultConnectTimeout, // can be set by using the WithConnectionTimeout option
rcmgr: rcmgr, rcmgr: rcmgr,
} }
@ -199,7 +199,7 @@ func (t *TcpTransport) Dial(ctx context.Context, raddr ma.Multiaddr, p peer.ID)
if ok, isClient, _ := network.GetSimultaneousConnect(ctx); ok && !isClient { if ok, isClient, _ := network.GetSimultaneousConnect(ctx); ok && !isClient {
direction = network.DirInbound direction = network.DirInbound
} }
return t.Upgrader.Upgrade(ctx, t, c, direction, p, connScope) return t.upgrader.Upgrade(ctx, t, c, direction, p, connScope)
} }
// UseReuseport returns true if reuseport is enabled and available. // UseReuseport returns true if reuseport is enabled and available.
@ -221,7 +221,7 @@ func (t *TcpTransport) Listen(laddr ma.Multiaddr) (transport.Listener, error) {
return nil, err return nil, err
} }
list = newTracingListener(&tcpListener{list, 0}) list = newTracingListener(&tcpListener{list, 0})
return t.Upgrader.UpgradeListener(t, list), nil return t.upgrader.UpgradeListener(t, list), nil
} }
// Protocols returns the list of terminal protocols this transport can dial. // Protocols returns the list of terminal protocols this transport can dial.