aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas "Cakeisalie5" Touhey <thomas@touhey.fr>2019-02-19 16:49:06 +0100
committerThomas "Cakeisalie5" Touhey <thomas@touhey.fr>2019-02-19 16:49:06 +0100
commit06d367ff9230ecd337e1bfd25219aa8bbe92679c (patch)
treee6f71871a03b38d41392b2c0b523d53a49beef3a
parent0db67b78f9c89950e4e0430f80012e549e8b4cfd (diff)
Latest edits.
-rw-r--r--.env.template2
-rw-r--r--.gitignore1
-rw-r--r--Pipfile1
-rw-r--r--Pipfile.lock9
-rw-r--r--README.rst17
-rwxr-xr-xfingerd/__init__.py12
6 files changed, 27 insertions, 15 deletions
diff --git a/.env.template b/.env.template
index 3192cf0..869fd37 100644
--- a/.env.template
+++ b/.env.template
@@ -30,9 +30,9 @@ BIND=localhost:79
# endpoints are received. This endpoint is using nanomsg's REQREP protocol,
# so a nanomsg URI is expected, amongst:
+#FINGER_INCOMING=ipc:///var/run/fingerd.sock
#FINGER_INCOMING=tcp://127.0.0.1:5560
#FINGER_INCOMING=tcp://[::1]:5560
#FINGER_INCOMING=tcp://localhost:5560
-#FINGER_INCOMING=ipc:///tmp/fingerd.sock
# That's it, your done with the finger server configuration! :-)
diff --git a/.gitignore b/.gitignore
index de07bcf..fcd882a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
/build
/dist
/*.egg-info
+/.eggs
__pycache__
*.pyc
diff --git a/Pipfile b/Pipfile
index d100846..4e7ff94 100644
--- a/Pipfile
+++ b/Pipfile
@@ -8,6 +8,7 @@ python_version = '3.7'
[packages]
python-dotenv = '*'
+nanomsg = '*'
toml = '*'
[dev-packages]
diff --git a/Pipfile.lock b/Pipfile.lock
index f01ccff..52725e2 100644
--- a/Pipfile.lock
+++ b/Pipfile.lock
@@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
- "sha256": "7d79e943e2d9d046a5200b71472e1a01b6af52e1caa9c2a89dacf90abae916a8"
+ "sha256": "1a79f711f5df0c3b10df0726b65cf6eca08ca0ea83658766d717b348d1844728"
},
"pipfile-spec": 6,
"requires": {
@@ -16,6 +16,13 @@
]
},
"default": {
+ "nanomsg": {
+ "hashes": [
+ "sha256:843be41258219d9d319cf434a68cac7669834ab9c993ea4bab5b3d87f62a7a13"
+ ],
+ "index": "pypi",
+ "version": "==1.0"
+ },
"python-dotenv": {
"hashes": [
"sha256:a84569d0e00d178bc5b957f7ff208bf49287cbf61857c31c258c4a91f571527b",
diff --git a/README.rst b/README.rst
index 72a1375..42665bb 100644
--- a/README.rst
+++ b/README.rst
@@ -22,6 +22,11 @@ by appending a rule in ``iptables``:
iptables -t nat -A OUTPUT -p tcp [-s <source ip>] [-d <destination ip>] \
--dport 79 -j DNAT --to '<ip:port>'
+Where ``<source ip>`` is the source IP address or network that are redirected,
+``<destination ip>`` is the destination IP address or network for which the
+requests are redirected and ``<ip:port>`` is the IP and port
+you want to forward the packets to, e.g. ``127.0.0.1:4000``.
+
For example, for running the server locally on port 3999 and only accepting
requests from the same machine (on IPv4 and IPv6):
@@ -32,11 +37,6 @@ requests from the same machine (on IPv4 and IPv6):
ip6tables -t nat -A OUTPUT -p tcp -s ::1 -d ::1 \
--dport 79 -j DNAT --to '[::1]:3999'
-Where ``<source ip>`` is the source IP address or network that are redirected,
-``<destination ip>`` is the destination IP address or network for which the
-requests are redirected and ``<ip:port>`` is the IP and port
-you want to forward the packets to, e.g. ``127.0.0.1:4000``.
-
Run the application
-------------------
@@ -67,10 +67,10 @@ its comments.
Bind on all addresses that ``example.com`` resolve as (IPv4 and IPv6),
port 1234.
- ``1.2.3.4``
+ ``1.2.3.4`` or ``[1.2.3.4]``
Bind on ``1.2.3.4`` (IPv4), port 79.
- ``1.2.3.4:1234``
+ ``1.2.3.4:1234`` or ``[1.2.3.4]:1234``
Bind on ``1.2.3.4`` (IPv4), port 1234.
``::1:2:3:4`` or ``[::1:2:3:4]``
@@ -111,6 +111,9 @@ required:
``FINGER_SCENARIO``
The scenario path (see :ref:`actions` for the format).
+``FINGER_INCOMING``
+ The finger live action source (see :ref:`live`).
+
.. _actions:
Scenarios
diff --git a/fingerd/__init__.py b/fingerd/__init__.py
index c967e8f..74e7288 100755
--- a/fingerd/__init__.py
+++ b/fingerd/__init__.py
@@ -78,21 +78,21 @@ def _get_server():
src = _environ.get('FINGER_INCOMING', 'ipc:///var/run/fingerd.sock')
if iface == 'native':
- iface = _FingerNativeInterface()
+ iface = FingerNativeInterface()
elif iface in ('actions', 'scenario'):
- fic = _FingerFiction()
+ fic = FingerFiction()
fic.load(scpt)
- iface = _FingerFictionInterface(fic)
+ iface = FingerFictionInterface(fic)
elif iface == 'live':
- iface = _FingerLiveInterface(src)
+ iface = FingerLiveInterface(src)
else:
if iface != 'dummy':
print("warning: unknown interface type, falling back on dummy",
file = _stderr)
- iface = _FingerInterface()
+ iface = FingerInterface()
- return _FingerServer(bind = bind, host = host, interface = iface)
+ return FingerServer(bind = bind, host = host, interface = iface)
def run():
""" Main function for the module. """