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

net: DialContextTCP() #21231

Closed
gobwas opened this issue Jul 31, 2017 · 6 comments
Closed

net: DialContextTCP() #21231

gobwas opened this issue Jul 31, 2017 · 6 comments

Comments

@gobwas
Copy link

gobwas commented Jul 31, 2017

Hello! I've search for some similar issues and found this one but looks like it is stale now.

My issue points to inability to dial via tcp with custom context.Context passed.

Current implementation of net.DialTCP() (actually net.dialTCP) is absolutely ready to receive context for dial, but has no exported wrapper that can receive it.

@fraenkel
Copy link
Contributor

Did you miss https://golang.org/pkg/net/#Dialer.DialContext ?

@gobwas
Copy link
Author

gobwas commented Jul 31, 2017

@fraenkel no.

conn, err := dialer.DialContext(...)

Does not allow me to setup local address for connection.

@fraenkel
Copy link
Contributor

Sure it can. Set the LocalAddress in the Dialer.

@gobwas
Copy link
Author

gobwas commented Jul 31, 2017

@fraenkel wow. Thanks! Seems like I really missed this. 👍
By the way, should the net.DialContextTCP() appear?

@fraenkel
Copy link
Contributor

I don't think so. We just need to adequately highlight the proper APIs that people should use. The original ones were modified to leverage the Context based ones but cannot be removed for compatibility reasons.

@ianlancetaylor
Copy link
Contributor

Closing since there doesn't seem to be anything to do here.

@golang golang locked and limited conversation to collaborators Aug 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants