Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ghost opened this issue Feb 20, 2022 · 0 comments · Fixed by #773
Closed

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

ghost opened this issue Feb 20, 2022 · 0 comments · Fixed by #773

Comments

@ghost
Copy link

ghost commented Feb 20, 2022

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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant