mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
A little doc cleanup; load named key from config.
This commit is contained in:
parent
244d71bdb2
commit
8d44a5c12a
@ -1,38 +1,35 @@
|
|||||||
#! /usr/bin/python -*- mode: python; mode: auto-fill; fill-column: 80; -*-
|
#! /usr/bin/python -*- mode: python; mode: auto-fill; fill-column: 80; -*-
|
||||||
|
|
||||||
"""A simple Santiago service.
|
"""The Santiago service.
|
||||||
|
|
||||||
Start me with:
|
Start me with:
|
||||||
|
|
||||||
$ python -i simplesantiago.py
|
$ python -i santiago.py
|
||||||
|
|
||||||
This will provide you with a running Santiago service. The important tags in
|
The first Santiago service queries another's index with a request. That request
|
||||||
this file are:
|
is handled and a request is returned. Then, the reply is handled. The upshot
|
||||||
|
is that we learn a new set of locations for the service.
|
||||||
|
|
||||||
- query
|
We don't:
|
||||||
- request
|
|
||||||
- index
|
|
||||||
- handle_request
|
|
||||||
- handle_reply
|
|
||||||
|
|
||||||
They operate, essentially, in that order. The first Santiago service queries
|
|
||||||
another's index with a request. That request is handled and a request is
|
|
||||||
returned. Then, the reply is handled. The upshot is that we learn a new set of
|
|
||||||
locations for the service.
|
|
||||||
|
|
||||||
We also don't:
|
|
||||||
|
|
||||||
- Proxy requests.
|
- Proxy requests.
|
||||||
- Use a reasonable data-store.
|
- Use a reasonable data-store.
|
||||||
- Have a decent control mechanism.
|
- Have a decent control (rate-limiting) mechanism.
|
||||||
|
|
||||||
:TODO: add doctests
|
:TODO: add doctests
|
||||||
:TODO: move to santiago.py, merge the documentation.
|
|
||||||
:FIXME: allow multiple listeners and senders per protocol (with different
|
:FIXME: allow multiple listeners and senders per protocol (with different
|
||||||
proxies)
|
proxies)
|
||||||
|
|
||||||
This dead-drop is what came of my trying to learn from bug 4185.
|
This dead-drop is what came of my trying to learn from bug 4185.
|
||||||
|
|
||||||
|
Santiago, he
|
||||||
|
smiles like a Buddah, 'neath
|
||||||
|
his red sombrero.
|
||||||
|
|
||||||
|
This file is distributed under the GNU Affero General Public License, Version 3
|
||||||
|
or later. A copy of GPLv3 is available [from the Free Software Foundation]
|
||||||
|
<http://www.gnu.org/licenses/gpl.html>.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import ast
|
import ast
|
||||||
@ -259,7 +256,7 @@ class Santiago(object):
|
|||||||
|
|
||||||
if unpacked["locations"]:
|
if unpacked["locations"]:
|
||||||
logging.debug("santiago.Santiago.incoming_request: handling reply")
|
logging.debug("santiago.Santiago.incoming_request: handling reply")
|
||||||
|
|
||||||
self.handle_reply(
|
self.handle_reply(
|
||||||
unpacked["from"], unpacked["to"],
|
unpacked["from"], unpacked["to"],
|
||||||
unpacked["host"], unpacked["client"],
|
unpacked["host"], unpacked["client"],
|
||||||
@ -514,20 +511,19 @@ class SantiagoSender(SantiagoConnector):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
logging.getLogger().setLevel(logging.DEBUG)
|
logging.getLogger().setLevel(logging.DEBUG)
|
||||||
logging.raiseExceptions = False
|
|
||||||
|
|
||||||
cert = "santiago.crt"
|
cert = "santiago.crt"
|
||||||
|
mykey = load_config("production.cfg").get("pgpprocessor", "keyid")
|
||||||
|
|
||||||
listeners = { "https": { "socket_port": 8080,
|
listeners = { "https": { "socket_port": 8080,
|
||||||
"ssl_certificate": cert,
|
"ssl_certificate": cert,
|
||||||
"ssl_private_key": cert }, }
|
"ssl_private_key": cert }, }
|
||||||
senders = { "https": { "proxy_host": "localhost",
|
senders = { "https": { "proxy_host": "localhost",
|
||||||
"proxy_port": 8118} }
|
"proxy_port": 8118} }
|
||||||
mykey = "D95C32042EE54FFDB25EC3489F2733F40928D23A"
|
|
||||||
|
|
||||||
hosting = { mykey: { "santiago": set( ["https://localhost:8080",
|
hosting = { mykey: { "santiago": set( ["https://localhost:8080",
|
||||||
"https://somestuff" ] )}}
|
"https://somestuff" ] )}}
|
||||||
consuming = { "santiago": { mykey: set( ["https://localhost:8080"] )}}
|
consuming = { "santiago": { mykey: set( ["https://localhost:8080"] )}}
|
||||||
|
|
||||||
# load the Santiago
|
# load the Santiago
|
||||||
santiago_b = Santiago(listeners, senders,
|
santiago_b = Santiago(listeners, senders,
|
||||||
hosting, consuming, mykey)
|
hosting, consuming, mykey)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user