https://github.com/sdingcn/p2p-tree-relay
peer-to-peer message relay group (based on TCP)
https://github.com/sdingcn/p2p-tree-relay
networks p2p p2p-messenger python-gui-tkinter socket-programming tcp-protocol
Last synced: 27 days ago
JSON representation
peer-to-peer message relay group (based on TCP)
- Host: GitHub
- URL: https://github.com/sdingcn/p2p-tree-relay
- Owner: sdingcn
- Created: 2023-07-17T09:01:09.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-21T14:30:55.000Z (11 months ago)
- Last Synced: 2025-05-19T19:21:17.887Z (10 months ago)
- Topics: networks, p2p, p2p-messenger, python-gui-tkinter, socket-programming, tcp-protocol
- Language: Python
- Homepage:
- Size: 245 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# p2p-tree-relay

This is a peer-to-peer (P2P) group message application based on TCP.
Group members are "nodes" where every node is an instance
of the program (`node.py`) and acts as both server and client.
Groups are formed by invitations and each member only maintains
connections with its invited members and the member that invited it.
The first member of a group has no inviter.
A group's topology is a tree and messages are relayed by nodes on the tree.
## usage
There are two modes of usage: GUI and CLI.
GUI supports one-line messages (including empty lines)
while CLI only supports non-empty one-line messages
because empty lines are used to signal termination.
The encoded line (including a header) must not exceed 128 bytes.
Otherwise, only the first 128 bytes will be relayed.
Run `python3 node.py` to see the usage (command line arguments).
See `test.py` for multi-node examples.
## tests
`python3 test.py`
## dependency
+ Python >= 3.10
+ IPv4 (it should be easy to change it to IPv6 or both)
## packets
Packets (over TCP) are of fixed-length (128 bytes).
## stability
The disconnection of one node may split the group (tree)
into multiple smaller groups.
## TODOs
Encryption and NAT hole punching are currently not supported.