stmp-server


Namestmp-server JSON
Version 0.0.3 PyPI version JSON
download
home_pageNone
SummaryA primitive zero-configuration local network protocol purely written in python, originally intended for tinkering with your office mates over LAN!
upload_time2024-06-18 19:47:14
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseMIT License Copyright (c) 2024 Agraj P Das Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords stmp sitty-talky sittytalky lan wlan peer-discovery messaging protocol multicast dns dns udp tcp
VCS
bugtrack_url
requirements pycryptodome
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <img src="./.assets/logo.png" alt="stmp logo" width="160" align="right">

# 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](https://github.com/bruttaZz/sittytalky) (hence the name).

[![pypi](https://img.shields.io/pypi/v/stmp-server.svg)](https://pypi.org/project/stmp-server/)
[![Release](https://img.shields.io/github/release/bruttazz/stmp.svg)](https://github.com/bruttazz/stmp/releases/latest)
[![pylint](https://github.com/bruttazz/stmp/actions/workflows/pylint.yml/badge.svg)](https://github.com/bRuttaZz/stmp/actions/workflows/pylint.yml)
[![Release](https://github.com/bruttazz/stmp/actions/workflows/releasebuild.yml/badge.svg)](https://github.com/bRuttaZz/stmp/actions/workflows/releasebuild.yml)



---

### 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](https://pypi.org/project/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
```sh
pip install stmp-server
```

Or directly from github using 
```sh
pip install 'stmp-server @ git+https://github.com/bRuttaZz/stmp.git'
```


### Usage
An example use case is demonstrated bellow. ([see example](https://github.com/bRuttaZz/stmp/tree/main/examples/listener-sender))

Start a listener process
```py
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
```py
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

<img src="./.assets/stmp.excalidraw.svg">



            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "stmp-server",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "stmp, sitty-talky, sittytalky, LAN, WLAN, peer-discovery, Messaging, protocol, multicast dns, dns, udp, tcp",
    "author": null,
    "author_email": "\"@bRuttaZz\" <agrajpdasprivate@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/1c/3e/26e51a12790dd720c201b749caa2f33fcd05a603679491b117dc4a8ed963/stmp_server-0.0.3.tar.gz",
    "platform": null,
    "description": "<img src=\"./.assets/logo.png\" alt=\"stmp logo\" width=\"160\" align=\"right\">\n\n# STMP : Sitty Talky Messaging Protocol\n\n\u26a0\ufe0f **Work In Progress**\n\n**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](https://github.com/bruttaZz/sittytalky) (hence the name).\n\n[![pypi](https://img.shields.io/pypi/v/stmp-server.svg)](https://pypi.org/project/stmp-server/)\n[![Release](https://img.shields.io/github/release/bruttazz/stmp.svg)](https://github.com/bruttazz/stmp/releases/latest)\n[![pylint](https://github.com/bruttazz/stmp/actions/workflows/pylint.yml/badge.svg)](https://github.com/bRuttaZz/stmp/actions/workflows/pylint.yml)\n[![Release](https://github.com/bruttazz/stmp/actions/workflows/releasebuild.yml/badge.svg)](https://github.com/bRuttaZz/stmp/actions/workflows/releasebuild.yml)\n\n\n\n---\n\n### Features\n\n- Yet another zero-configuraion protocol\n- A unique peer discovery mechanism (not thaat special though!)\n- Message broadcasting facility over UDP\n- An end-to-end encrypted peer to peer messaging facility over TCP (I mean real end-to-end encryption)\n- Support middlewares and message routing\n- Support automated peer discovery\n- Single threaded, the system can be clubbed with other asyncio eventloops\n- STMP uses multicasting for message broadcasting and peer discovery, reducing network traffic.. (me being a responsible citizen)\n\n\n### Requirements\n- **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*))\n\n- Internally uses **[Pycryptodome](https://pypi.org/project/pycryptodome/)** for rsa cryptography.\n- **Unix** (probably) as the system is tested only on Unix (GNU/Linux to be specific)\n\n\n### Installation\nSTMP package can be installed from PyPi using\n```sh\npip install stmp-server\n```\n\nOr directly from github using \n```sh\npip install 'stmp-server @ git+https://github.com/bRuttaZz/stmp.git'\n```\n\n\n### Usage\nAn example use case is demonstrated bellow. ([see example](https://github.com/bRuttaZz/stmp/tree/main/examples/listener-sender))\n\nStart a listener process\n```py\nfrom stmp import STMPServer\nfrom stmp.interfaces import Packet, Peer\n\napp = STMPServer()\n\n@app.route(\"/test-route\")\ndef test_route_func(packet:Packet):\n    print(f\"Message got from {packet.headers.user}@{packet.sender} : {packet.data}\")\n\n# bind events\n@app.on_peer_list_update\ndef peer_list_change(new_peer:Peer, removed_peers:list[Peer]):\n    print(f\"Peer list changed : new peer -> {new_peer.user}@{new_peer.ip}\" +\n                f\" : removed peers -> {len(removed_peers)}\")\n    \nif __name__==\"__main__\":\n    print(f\"starting server ...\")\n    app.run()\n```\n\nSend messages to it using another client over a LAN network\n```py\nfrom stmp import STMPServer\n\napp = STMPServer()\n    \nif __name__==\"__main__\":\n    app.broadcast(\"/test-route\", \"hi dear\")\n    # app.send_to_peer() # work only if peers are discovered (uses TCP)\n```\n\n### The module architecture\n\n<img src=\"./.assets/stmp.excalidraw.svg\">\n\n\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Agraj P Das  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A primitive zero-configuration local network protocol purely written in python, originally intended for tinkering with your office mates over LAN!",
    "version": "0.0.3",
    "project_urls": {
        "Documentation": "https://pypi.org/project/stmp-server/",
        "Homepage": "https://github.com/bRuttaZz/stmp",
        "Issues": "https://github.com/bRuttaZz/stmp/issues",
        "Repository": "https://github.com/bRuttaZz/stmp.git"
    },
    "split_keywords": [
        "stmp",
        " sitty-talky",
        " sittytalky",
        " lan",
        " wlan",
        " peer-discovery",
        " messaging",
        " protocol",
        " multicast dns",
        " dns",
        " udp",
        " tcp"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "55e72b41ec69f731a81230cd3ed0f05b3bbc06fa41cc4b32fb49c80b790ed23e",
                "md5": "5a9f5d078adf3398ac7711faab24b6a0",
                "sha256": "952754af7064d1b4ef11b7a36a569d791911427e7370b0644794d9328ff72888"
            },
            "downloads": -1,
            "filename": "stmp_server-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5a9f5d078adf3398ac7711faab24b6a0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 17570,
            "upload_time": "2024-06-18T19:47:12",
            "upload_time_iso_8601": "2024-06-18T19:47:12.528606Z",
            "url": "https://files.pythonhosted.org/packages/55/e7/2b41ec69f731a81230cd3ed0f05b3bbc06fa41cc4b32fb49c80b790ed23e/stmp_server-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1c3e26e51a12790dd720c201b749caa2f33fcd05a603679491b117dc4a8ed963",
                "md5": "80304107a13391a08d918ca91c1cbf2d",
                "sha256": "fb2d1c6d5a475efaf60366931b64d9d095c13fe5d2a5d1e875966bdf7b106450"
            },
            "downloads": -1,
            "filename": "stmp_server-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "80304107a13391a08d918ca91c1cbf2d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 83720,
            "upload_time": "2024-06-18T19:47:14",
            "upload_time_iso_8601": "2024-06-18T19:47:14.051225Z",
            "url": "https://files.pythonhosted.org/packages/1c/3e/26e51a12790dd720c201b749caa2f33fcd05a603679491b117dc4a8ed963/stmp_server-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-18 19:47:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bRuttaZz",
    "github_project": "stmp",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "pycryptodome",
            "specs": [
                [
                    "==",
                    "3.20.0"
                ]
            ]
        }
    ],
    "lcname": "stmp-server"
}
        
Elapsed time: 0.30265s