Skip to main content

A primitive zero-configuration local network protocol purely written in python, originally intended for tinkering with your office mates over LAN!

Project description

stmp logo

STMP : Sitty Talky Messaging Protocol

⚠️ Work In Progress

STMP: Sitty Talky Messaging Protocol : A primitive zero-configuration local network protocol purely written in python, originally intended for tinkering with your office mates over LAN! Created as part of my side project Sitty Talky (hence the name).

pypi Release pylint Release


Features

  • Yet another zero-configuraion protocol
  • A unique peer discovery mechanism (not thaat special though!)
  • Message broadcasting facility over UDP
  • An end-to-end encrypted peer to peer messaging facility over TCP (I mean real end-to-end encryption)
  • Support middlewares and message routing
  • Support automated peer discovery
  • Single threaded, the system can be clubbed with other asyncio eventloops
  • STMP uses multicasting for message broadcasting and peer discovery, reducing network traffic.. (me being a responsible citizen)

Requirements

  • Python>=3.11 (As it currently uses loop.sock_recvfrom in asyncio the minimum python version requirement is 3.11, Otherwise should go with the loop.run_in_executor based implementation, which I'm not interested in (anyway it will reduce the requirement to py3.7))

  • Internally uses Pycryptodome for rsa cryptography.

  • Unix (probably) as the system is tested only on Unix (GNU/Linux to be specific)

Installation

STMP package can be installed from PyPi using

pip install stmp-server

Or directly from github using

pip install 'stmp-server @ git+https://github.com/bRuttaZz/stmp.git'

Usage

An example use case is demonstrated bellow. (see example)

Start a listener process

from stmp import STMPServer
from stmp.interfaces import Packet, Peer

app = STMPServer()

@app.route("/test-route")
def test_route_func(packet:Packet):
    print(f"Message got from {packet.headers.user}@{packet.sender} : {packet.data}")

# bind events
@app.on_peer_list_update
def peer_list_change(new_peer:Peer, removed_peers:list[Peer]):
    print(f"Peer list changed : new peer -> {new_peer.user}@{new_peer.ip}" +
                f" : removed peers -> {len(removed_peers)}")
    
if __name__=="__main__":
    print(f"starting server ...")
    app.run()

Send messages to it using another client over a LAN network

from stmp import STMPServer

app = STMPServer()
    
if __name__=="__main__":
    app.broadcast("/test-route", "hi dear")
    # app.send_to_peer() # work only if peers are discovered (uses TCP)

The module architecture

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stmp_server-0.0.3.tar.gz (83.7 kB view details)

Uploaded Source

Built Distribution

stmp_server-0.0.3-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file stmp_server-0.0.3.tar.gz.

File metadata

  • Download URL: stmp_server-0.0.3.tar.gz
  • Upload date:
  • Size: 83.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.9

File hashes

Hashes for stmp_server-0.0.3.tar.gz
Algorithm Hash digest
SHA256 fb2d1c6d5a475efaf60366931b64d9d095c13fe5d2a5d1e875966bdf7b106450
MD5 80304107a13391a08d918ca91c1cbf2d
BLAKE2b-256 1c3e26e51a12790dd720c201b749caa2f33fcd05a603679491b117dc4a8ed963

See more details on using hashes here.

File details

Details for the file stmp_server-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: stmp_server-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.9

File hashes

Hashes for stmp_server-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 952754af7064d1b4ef11b7a36a569d791911427e7370b0644794d9328ff72888
MD5 5a9f5d078adf3398ac7711faab24b6a0
BLAKE2b-256 55e72b41ec69f731a81230cd3ed0f05b3bbc06fa41cc4b32fb49c80b790ed23e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page