From 6b9aed37222089f539f675791eca5e5dfcab7360 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 25 Apr 2018 13:01:59 -0400 Subject: [PATCH] Afetr some feedback, rename it 'collective' --- .../confluent/{swarm => collective}/__init__.py | 0 .../confluent/{swarm => collective}/invites.py | 0 .../confluent/{swarm => collective}/manager.py | 10 +++++----- confluent_server/confluent/sockapi.py | 12 +++++++----- 4 files changed, 12 insertions(+), 10 deletions(-) rename confluent_server/confluent/{swarm => collective}/__init__.py (100%) rename confluent_server/confluent/{swarm => collective}/invites.py (100%) rename confluent_server/confluent/{swarm => collective}/manager.py (91%) diff --git a/confluent_server/confluent/swarm/__init__.py b/confluent_server/confluent/collective/__init__.py similarity index 100% rename from confluent_server/confluent/swarm/__init__.py rename to confluent_server/confluent/collective/__init__.py diff --git a/confluent_server/confluent/swarm/invites.py b/confluent_server/confluent/collective/invites.py similarity index 100% rename from confluent_server/confluent/swarm/invites.py rename to confluent_server/confluent/collective/invites.py diff --git a/confluent_server/confluent/swarm/manager.py b/confluent_server/confluent/collective/manager.py similarity index 91% rename from confluent_server/confluent/swarm/manager.py rename to confluent_server/confluent/collective/manager.py index cbac994a..1b64bc3f 100644 --- a/confluent_server/confluent/swarm/manager.py +++ b/confluent_server/confluent/collective/manager.py @@ -23,7 +23,7 @@ import eventlet.green.ssl as ssl try: import OpenSSL.crypto as crypto except ImportError: - # while not always required, we use pyopenssl required for at least swarm + # while not always required, we use pyopenssl required for at least collective crypto = None swarmcerts = {} @@ -39,7 +39,7 @@ def handle_connection(connection, cert, swarmrequest, local=False): if 'invite' == operation: name = swarmrequest['invite']['name'] invitation = invites.create_server_invitation(name) - tlvdata.send(connection, {'swarm': {'invitation': invitation}}) + tlvdata.send(connection, {'collective': {'invitation': invitation}}) if 'join' == operation: invitation = swarmrequest['invitation'] invitation = base64.b64decode(invitation) @@ -60,10 +60,10 @@ def handle_connection(connection, cert, swarmrequest, local=False): invitation, mycert, cert)) tlvdata.recv(remote) # ignore banner tlvdata.recv(remote) # ignore authpassed: 0 - tlvdata.send(remote, {'swarm': {'operation': 'joinchallenge', + tlvdata.send(remote, {'collective': {'operation': 'joinchallenge', 'name': name, 'hmac': proof}}) rsp = tlvdata.recv(remote) - proof = rsp['swarm']['approval'] + proof = rsp['collective']['approval'] j = invites.check_server_proof(invitation, mycert, cert, proof) if not j: return @@ -77,6 +77,6 @@ def handle_connection(connection, cert, swarmrequest, local=False): return myrsp = base64.b64encode(myrsp) swarmcerts[swarmrequest['name']] = cert - tlvdata.send(connection, {'swarm': {'approval': myrsp}}) + tlvdata.send(connection, {'collective': {'approval': myrsp}}) clientready = tlvdata.recv(connection) print(repr(clientready)) diff --git a/confluent_server/confluent/sockapi.py b/confluent_server/confluent/sockapi.py index ef5f11e1..044c371b 100644 --- a/confluent_server/confluent/sockapi.py +++ b/confluent_server/confluent/sockapi.py @@ -44,7 +44,7 @@ import confluent.exceptions as exc import confluent.log as log import confluent.core as pluginapi import confluent.shellserver as shellserver -import confluent.swarm.manager as swarm +import confluent.collective.manager as collective tracelog = None auditlog = None @@ -116,8 +116,9 @@ def sessionhdl(connection, authname, skipauth=False, cert=None): while not authenticated: # prompt for name and passphrase send_data(connection, {'authpassed': 0}) response = tlvdata.recv(connection) - if 'swarm' in response: - return swarm.handle_connection(connection, cert, response['swarm']) + if 'collective' in response: + return collective.handle_connection(connection, cert, + response['collective']) authname = response['username'] passphrase = response['password'] # note(jbjohnso): here, we need to authenticate, but not @@ -133,8 +134,9 @@ def sessionhdl(connection, authname, skipauth=False, cert=None): cfm = authdata[1] send_data(connection, {'authpassed': 1}) request = tlvdata.recv(connection) - if 'swarm' in request and skipauth: - swarm.handle_connection(connection, None, request['swarm'], local=True) + if 'collective' in request and skipauth: + collective.handle_connection(connection, None, request['collective'], + local=True) while request is not None: try: process_request(