GithubHelp home page GithubHelp logo

boxer's Introduction

Features

  • Fast UDP hole punching
  • Public Key based peer directory, with service descriptions
  • Ed25519 encrypted
  • jsonrpc 2.0
  • Fully async (trio v0.14)
  • Python 3

Dependencies

  • trio
  • triopatterns
  • pynacl

Install

Download this repo and cd into it.

pip install .

Run Server

python -m boxer.core

Boxer Protocol

Boxer is simple UDP hole punching protocol:

https://github.com/dwoz/python-nat-hole-punching https://bford.info/pub/net/p2pnat/

A Boxer server listens from incoming node "introductions" and broadcasts them to all conected nodes, based on their public key nodes can request "fights" where the server arranges for the exchange of external endpoint information between nodes and then through "punch" packets perform NAT traversal.

Look at PROTOCOL.txt for more information.

Boxer Node API

import trio

from boxer.node import BoxerNode


async def main():

    # Boxer makes heavy use of the trio async framework, when instantiating a
    # BoxerNode instance we must provide a `trio.Nursery` instance
    async def trio.open_nursery() as nursery:

        bnode = BoxerNode(
            ("127.0.0.1", 12000),  # boxer server addresss
            nursery
            )

        await bnode.introduction(
            "my_name",  # non unique name
            desc="my description"  # optional description
            )

        # get next node introduction event
        event = await bnode.events.receive()

        # to INITIATE fights:
        remote_ctx = await bnode.fight(event["pkey"])

        # to TAKE fights:
        fid, remote_ctx = await bnode.fights.receive()

        # remote context is a boxer.net.UDPContext instance
        # non connection with remote peer is open

        await remote_ctx.send_raw(b"hello from peer!")

        # to recieve messages use remote context inbound queue
        async with remote_ctx.inbound.subscribe(
            lambda *args: True
                ) as in_queue:

            msg = await in_queue.receive()

boxer's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

bellyfat

boxer's Issues

Troubleshooting help

Hi,

This is an awesome project. Are you still working on it?

I'm having trouble getting the minimum examples working.
PC1: external port 13000 forwarded to 21171 on PC1
PC2: in concept_client.pyserver_addr = ("PC1 pub ip", 13000)
There's no output on pc1. Running concept_client.py on pc1 works with ip = 0.0.0.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.