-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathEXAMPLE
More file actions
81 lines (55 loc) · 2.96 KB
/
EXAMPLE
File metadata and controls
81 lines (55 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Example setup of a sphinxmix mixnet
===================================
For a minimal setup, let's consider five entities: the server, three sphinxmix
mixers, and an end user.
First set up the server database with:
PANORAMIX_DATABASE=<db_file_path> panoramix-manage migrate
The database will be automatically created at the location specified by the
PANORAMIX_DATABASE environment variable.
Then, start the server with:
PANORAMIX_DATABASE=<db_file_path> panoramix-manage runserver --nothreading
We will run the mixers and the end user in separate terminals, each with
its own configuration: set environment variable PANORAMIX_CONFIG to some
different file in each terminal.
Run three instances of panoramix-wizard. Choose role 'admin' for the first
and 'contrib' for the rest. The wizards must be run interactively.
All three wizards set off by creating a crypto key and registering it to the
server. The admin wizard must then collect off-line the PEER_IDs of all the
mixers and register them (including its own):
MIXERS: PEER_ID1,PEER_ID2,PEER_ID3
The admin must then set the name of the mixnet, and the minimum number of
messages per mix cycle (MIN_SIZE). This configures the mixnet, registering
all related endpoints on the server.
The contrib wizards must then enter the exact same values for the mixnet
name and the min size as the admin.
Once set up, the mixnet waits for input at the endpoint:
http://127.0.0.1:8000/panoramix/endpoints/<mixnet_name>/
and outputs the mixed messages at the endpoint:
http://127.0.0.1:8000/panoramix/endpoints/<mixnet_name>_output/
You have set up a sphinxmix network with three mixes, in a static
configuration.
As for the end user, in a separate terminal with its own PANORAMIX_CONFIG
setting, run sphimxmix-agent and initialize it with the mixnet URL mentioned
above. In another terminal with the same PANORAMIX_CONFIG as the agent, run
panoramix-client and send some messages through the mixnet.
You can choose any string as recipient. After you send MIN_SIZE messages,
you can notice at the wizard terminals that the messages are being
processed.
Mixing is done in cycles. Messages that arrive at the input endpoint are
marked with the current cycle. After the required number of messages is
collected, the mixnet admin marks the cycle as ready for mixing and starts a
new cycle. Similarly, mixers process the messages in their respective cycles.
Messages are not actually sent to a recipient, but you can review the mixnet
output with:
panoramix-client --output <cycle_id>
You can then acknowledge retrieving the messages, so that the mixnet can
safely delete them.
panoramix-client --ack <cycle_id>
Cycle ids are integer serials, starting from 1.
One can operate the client programmatically:
PANORAMIX_CONFIG=<client_config_file> python
> from panoramix.agent import client
> client.send_message(text='the text, recipient='recipient')
# Use text=None, recipient=None for interactive mode
> client.output_cycle(1)
> client.ack_cycle(1)