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

proposal: crypto/tls: add DialWithConn(conn net.Conn, timeout time.Duration, addr string, config *Config) (*Conn, error) #31848

Closed
mei-rune opened this issue May 6, 2019 · 2 comments
Labels
FrozenDueToAge Proposal Proposal-Crypto Proposal related to crypto packages or other security issues
Milestone

Comments

@mei-rune
Copy link

mei-rune commented May 6, 2019

I need build a tls conn on the windows namepipe, but DialWithDialer is insufflcient, becase net.Dialer isnot a interface, I cannot replace it with my Dialer.

similar, I run tls conn on other conn also, like serial port ...

@mei-rune mei-rune changed the title x/crypto/tls: Can add DialWithConn(conn net.Conn, timeout time.Duration, addr string, config *Config) (*Conn, error) { x/crypto/tls: Can add DialWithConn(conn net.Conn, timeout time.Duration, addr string, config *Config) (*Conn, error) May 6, 2019
@mei-rune mei-rune changed the title x/crypto/tls: Can add DialWithConn(conn net.Conn, timeout time.Duration, addr string, config *Config) (*Conn, error) crypto/tls: Can add DialWithConn(conn net.Conn, timeout time.Duration, addr string, config *Config) (*Conn, error) May 6, 2019
@andybons andybons changed the title crypto/tls: Can add DialWithConn(conn net.Conn, timeout time.Duration, addr string, config *Config) (*Conn, error) proposal: crypto/tls: add DialWithConn(conn net.Conn, timeout time.Duration, addr string, config *Config) (*Conn, error) May 8, 2019
@andybons andybons added Proposal Proposal-Crypto Proposal related to crypto packages or other security issues labels May 8, 2019
@gopherbot gopherbot added this to the Proposal milestone May 8, 2019
@bronze1man
Copy link
Contributor

Here is a workaround:
From the source code of DialWithDialer https://golang.org/src/crypto/tls/tls.go?s=3677:3769#L98
You can write DialWithConn outside the package crypto/tls with tls.Client .

@FiloSottile
Copy link
Contributor

Indeed, this is an edge case, and should be handled by dialing your own connection, and then wrapping it with tls.Client.

@golang golang locked and limited conversation to collaborators Mar 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge Proposal Proposal-Crypto Proposal related to crypto packages or other security issues
Projects
None yet
Development

No branches or pull requests

5 participants