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

Support TLS Connections #30

Closed
mmmries opened this issue Mar 30, 2017 · 1 comment · Fixed by #37
Closed

Support TLS Connections #30

mmmries opened this issue Mar 30, 2017 · 1 comment · Fixed by #37
Assignees

Comments

@mmmries
Copy link
Collaborator

mmmries commented Mar 30, 2017

No description provided.

@mmmries
Copy link
Collaborator Author

mmmries commented Apr 3, 2017

I got a quick proof-of-concept working for upgrading the tcp connection to SSL. I'm going to wait for #36 to get merged before I start full support though since all of the handshake code is still in flux

require Logger

{:ok, tcp} = :gen_tcp.connect('127.0.0.1', 4222, [:binary])
receive do
  {:tcp, _port, "INFO "<>_} -> :cool
  other -> Logger.error "unexpected message: #{inspect other}"
  after 500 -> raise "didn't receive INFO"
end

:ok = :inet.setopts(tcp, [active: true])
case :ssl.connect(tcp, [], 1_000) do
  {:ok, port} -> :cool
  other -> Logger.error "unexpected message: #{inspect other}"
  {:error, why} -> raise "SSL handshake failed: #{inspect why}"
end

Logger.info "finished ssl handshake"

@mmmries mmmries self-assigned this Apr 3, 2017
@mmmries mmmries mentioned this issue Apr 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant