-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ability to instance socket connection in order to test multiple c…
…onnections Signed-off-by: Connor Rigby <[email protected]>
- Loading branch information
Connor Rigby
committed
Jun 28, 2023
1 parent
65dec0d
commit ce07fd8
Showing
4 changed files
with
54 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
defmodule NervesHubLink.Configurator.LoadTest do | ||
@behaviour NervesHubLink.Configurator | ||
|
||
alias NervesHubLink.{Certificate, Configurator.Config} | ||
|
||
@impl NervesHubLink.Configurator | ||
def build(%Config{} = config) do | ||
ssl = | ||
config.ssl | ||
|> maybe_add_cacerts() | ||
|> maybe_add_sni(config) | ||
|
||
%{config | ssl: ssl} | ||
end | ||
|
||
defp maybe_add_cacerts(socket_opts) do | ||
Keyword.put_new(socket_opts, :cacerts, Certificate.ca_certs()) | ||
end | ||
|
||
defp maybe_add_sni(socket_opts, %{device_api_sni: sni}) do | ||
Keyword.put_new(socket_opts, :server_name_indication, to_charlist(sni)) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters