You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2021/06/26 01:29:58 UTC

[GitHub] [couchdb] jiahuili430 commented on a change in pull request #3643: Contribute Custom Erlang network protocol to Apache

jiahuili430 commented on a change in pull request #3643:
URL: https://github.com/apache/couchdb/pull/3643#discussion_r659100179



##########
File path: rel/overlay/etc/vm.args
##########
@@ -60,3 +60,24 @@
 
 # Set maximum SSL session lifetime to reap terminated replication readers
 -ssl session_lifetime 300
+
+# TLS distribution
+#-pa <%= @tls_dir %>
+#-proto_dist cloudant

Review comment:
       Removed

##########
File path: src/couch/src/couch_ssl_dist.erl
##########
@@ -0,0 +1,87 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may not
+% use this file except in compliance with the License. You may obtain a copy of
+% the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations under
+% the License.
+
+-module(couch_ssl_dist).
+
+-export([childspecs/0, listen/1, accept/1, accept_connection/5,
+    setup/5, close/1, select/1, is_node_name/1]).
+
+childspecs() ->
+    {ok, [{ssl_dist_sup, {ssl_dist_sup, start_link, []},
+        permanent, infinity, supervisor, [ssl_dist_sup]}]}.
+
+listen(Name) ->
+    inet_tls_dist:listen(Name).
+
+
+accept(Listen) ->
+    inet_tls_dist:accept(Listen).
+
+
+accept_connection(AcceptPid, Socket, MyNode, Allowed, SetupTime) ->
+    case no_tls(MyNode) of
+        true ->
+            inet_tcp_dist:accept_connection(
+                AcceptPid, Socket, MyNode, Allowed, SetupTime);
+        false ->
+            inet_tls_dist:accept_connection(
+                AcceptPid, Socket, MyNode, Allowed, SetupTime)
+    end.
+
+
+setup(Node, Type, MyNode, LongOrShortNames, SetupTime) ->
+    case no_tls(Node) of
+        true ->
+            inet_tcp_dist:setup(
+                Node, Type, MyNode, LongOrShortNames, SetupTime);
+        false ->
+            inet_tls_dist:setup(
+                Node, Type, MyNode, LongOrShortNames, SetupTime)
+    end.
+
+
+close(Socket) ->
+    inet_tls_dist:close(Socket).
+
+
+select(Node) ->
+    inet_tls_dist:select(Node).
+
+
+is_node_name(Node) ->
+    inet_tls_dist:is_node_name(Node).
+
+
+no_tls(Name) when is_atom(Name) ->
+    no_tls(atom_to_list(Name));
+
+no_tls(Name) when is_list(Name) ->
+    {ok, Args} = init:get_argument(cloudant),

Review comment:
       Removed




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org