Skip to content

Latest commit

 

History

History
55 lines (36 loc) · 1.33 KB

README.md

File metadata and controls

55 lines (36 loc) · 1.33 KB

YggPeer

YggPeer is a Python library for peer-to-peer communication over the Yggdrasil network, providing easy-to-use tools for status management, messaging, and chat between peers.

Features

  • Integration with Yggdrasil
  • Peer-to-peer messaging
  • Status management (available, busy, etc.)

Installation

Install YggPeer using pip:

pip install yggpeer

Example

You may run up two instances of the following script to chat between two peers. Screenshot of the chat between two peers

from yggpeer import PeerManager
import time

def example_chat():
    peer_manager = PeerManager(local_port=12345, discovery_port=10799)

    # Add a peer (Yggdrasil IP and chat port)
    peer_manager.add_peer("Yggdrasil_IP_of_Peer", 12345)

    # Start the PeerManager services
    peer_manager.start()

    # Start sending messages to the peer
    time.sleep(2)  # Wait for the services to initialize

    while True:
        message = input("You: ")
        if message.lower() == 'quit':
            print("Exiting chat...")
            break
        peer_manager.send_message("Yggdrasil_IP_of_Peer", message)

if __name__ == "__main__":
    example_chat()

License

This project is licensed under the MIT License - see the LICENSE file for details.