Skip to content

[feature] Add (*Conn) NetConn() net.Conn method #766

@ghost

Description

Go 1.18 adds the NetConn method to *tls.Conn. The new method is identical in purpose to the websocket connection's UnderlyingConn method.

To align the method names with the standard library, add a NetConn method to *Conn and deprecate UnderlyingConn:

// NetConn returns the underlying connection that is wrapped by c.
// Note that writing to or reading from this connection directly will corrupt the
// WebSocket connection.
func (c *Conn) NetConn() net.Conn {
	return c.conn
}

// UnderlyingConn returns the internal net.Conn. This can be used to further
// modifications to connection specific flags.
// Deprecated: Use the NetConn method.
func (c *Conn) UnderlyingConn() net.Conn {
	return c.conn
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions