-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
55 lines (34 loc) · 1.41 KB
/
README
File metadata and controls
55 lines (34 loc) · 1.41 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
p2pIM
=====
Peer-to-peer Internet messaging system using proof-of-work (PoW)
for spam protection. Larger messages require larger PoW and it
decays with time, making room for new messages.
Usage
-----
Print message with payload `hello world` using generate1.py:
$ ./generate1.py "hello world"
["0","20251109124254","aaaaaaaaaa","b94d27b9934d","hello world"]
Start server1.py in one tab:
./server1.py
and send it message(s) in another tab using generate1.py and socat:
$ ./generate1.py test1 | tr -d \\n | socat - TCP:localhost:8765
ok
$ ./generate1.py test2 | tr -d \\n | socat - TCP:localhost:8765
ok
Query messages from server1.py with control message __message__:
$ ./generate1.py __messages__ | tr -d \\n | socat - TCP:localhost:8765
["0","20251109105926","aaaaaaaaaa","1b4f0e985197","test1"]
["0","20251109105930","aaaaaaaaaa","60303ae22b99","test2"]
See `./generate1.py --help` for options.
Transferring messages between servers
-------------------------------------
Start another server1.py on port 8764:
./server1.py --port 8764
and send it all messages from first server running on port 8765:
$ for m in $(./generate1.py __messages__ | tr -d \\n | socat - TCP:localhost:8765); do echo $m | tr -d \\n | socat - TCP:localhost:8764; done
ok
ok
Implementation / specification
------------------------------
See Message_v0 class in messages.py for description of message format
and `./server1.py --help` for options.