summaryrefslogtreecommitdiff
path: root/bonafide/src/leap
diff options
context:
space:
mode:
Diffstat (limited to 'bonafide/src/leap')
-rw-r--r--bonafide/src/leap/bonafide/_protocol.py2
-rw-r--r--bonafide/src/leap/bonafide/_srp.py2
-rw-r--r--bonafide/src/leap/bonafide/ssh_service.py2
-rw-r--r--bonafide/src/leap/bonafide/ws_service.py1
-rw-r--r--bonafide/src/leap/bonafide/zmq_service.py14
5 files changed, 16 insertions, 5 deletions
diff --git a/bonafide/src/leap/bonafide/_protocol.py b/bonafide/src/leap/bonafide/_protocol.py
index b093b9c..6a1c3d2 100644
--- a/bonafide/src/leap/bonafide/_protocol.py
+++ b/bonafide/src/leap/bonafide/_protocol.py
@@ -115,7 +115,7 @@ class BonafideProtocol(object):
return d
def do_stats(self):
- log.msg('Calculating Bonafide STATS')
+ log.msg('Calculating Bonafide Service STATS')
mem = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
return '[+] Bonafide service: [%s sessions] [Mem usage: %s KB]' % (
len(self._sessions), mem / 1024)
diff --git a/bonafide/src/leap/bonafide/_srp.py b/bonafide/src/leap/bonafide/_srp.py
index 4f4a605..1c711f3 100644
--- a/bonafide/src/leap/bonafide/_srp.py
+++ b/bonafide/src/leap/bonafide/_srp.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# srp_auth.py
+# _srp.py
# Copyright (C) 2015 LEAP
#
# This program is free software: you can redistribute it and/or modify
diff --git a/bonafide/src/leap/bonafide/ssh_service.py b/bonafide/src/leap/bonafide/ssh_service.py
new file mode 100644
index 0000000..3777b10
--- /dev/null
+++ b/bonafide/src/leap/bonafide/ssh_service.py
@@ -0,0 +1,2 @@
+# TODO expose bonafide protocol through ssh, accessible through a hidden
+# service
diff --git a/bonafide/src/leap/bonafide/ws_service.py b/bonafide/src/leap/bonafide/ws_service.py
new file mode 100644
index 0000000..feaa4b0
--- /dev/null
+++ b/bonafide/src/leap/bonafide/ws_service.py
@@ -0,0 +1 @@
+# TODO expose bonafide protocol through websockets
diff --git a/bonafide/src/leap/bonafide/zmq_service.py b/bonafide/src/leap/bonafide/zmq_service.py
index df8e234..38c0305 100644
--- a/bonafide/src/leap/bonafide/zmq_service.py
+++ b/bonafide/src/leap/bonafide/zmq_service.py
@@ -14,11 +14,13 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
"""
Bonafide ZMQ Service.
"""
+
from leap.bonafide import config
-from leap.bonafide.protocol import BonafideProtocol, COMMANDS
+from leap.bonafide._protocol import BonafideProtocol, COMMANDS
from txzmq import ZmqEndpoint, ZmqFactory, ZmqREPConnection
@@ -27,6 +29,8 @@ from twisted.internet import reactor
from twisted.python import log
+# TODO [] should shutdown all the ongoing connections when stopping the service
+
class BonafideZMQService(service.Service):
def __init__(self):
@@ -36,9 +40,14 @@ class BonafideZMQService(service.Service):
def startService(self):
zf = ZmqFactory()
e = ZmqEndpoint("bind", config.ENDPOINT)
+
self._conn = _BonafideZmqREPConnection(zf, e, self._bonafide)
reactor.callWhenRunning(self._conn.do_greet)
+ #def stopService(self):
+ # pass
+
+
class _BonafideZmqREPConnection(ZmqREPConnection):
@@ -50,7 +59,7 @@ class _BonafideZmqREPConnection(ZmqREPConnection):
print "Bonafide service running..."
def do_bye(self):
- print "[+] Bonafide service stopped. Have a nice day."
+ print "Bonafide service stopped. Have a nice day."
reactor.stop()
def gotMessage(self, msgId, *parts):
@@ -59,7 +68,6 @@ class _BonafideZmqREPConnection(ZmqREPConnection):
def log_err(failure):
log.err(failure)
- print "FAILURE", failure
defer_reply("ERROR: %r" % failure)
cmd = parts[0]