Skip to content

iljah/p2pIM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

See README

Topics

Resources

Stars

Watchers

Forks

Languages