GithubHelp home page GithubHelp logo

p2p-today / p2p-project Goto Github PK

View Code? Open in Web Editor NEW
73.0 73.0 15.0 3.05 MB

A peer-to-peer networking framework to work across languages

Home Page: https://dev-docs.p2p.today/

License: GNU Lesser General Public License v3.0

PowerShell 2.19% Makefile 19.33% Java 32.56% Shell 7.98% Batchfile 6.29% Smalltalk 31.65%
chords distributed distributed-database distributed-hash-table javascript mesh-networks multi-language networking p2p peer-to-peer python synchronization synchronized-database

p2p-project's People

Contributors

livinthelookingglass avatar the-zebulan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

p2p-project's Issues

Implement chord DHT

  • connection method
  • join method
  • handshakes
  • correct routing tables
  • periodic network updates
  • storage
  • retreival
  • unit tests

Improve readability of net.py

  • Make more variables private
  • Centralize imports
  • Reorder functions in "who's called first" order
  • Clear up if statements in recv()
  • Add comment documentation
  • Try to shorten code

Decision: Build number based on which CI?

Currently I'm leaning towards AppVeyor, as it allows me to reset the count on each version change.

That might be a bad thing, though, as it means the build number will not be unique. It may be better to go for a unique, constantly increasing build number, so that people can more easily track API changes.

Of the two remaining, Shippable will be the best at keeping build numbers unique, as it will always be higher than Travis. This breaks if you pull from an active branch, but does not if releases are done properly.

Deprecate net.py

Warnings already added to develop branch. Deprecation scheduled for two releases from now.

As in, the next release will contain warnings, the release after will remove.

Depend on base58 instead of defining it myself?

One thing to make sure of would be that a copy is kept on my account in case base58 disappears from pypi. It would be good to see if conditional installations can work with setup.py before proceeding.

Improve handshake density in net.py

The following code should help out:

import struct

def key_to_bin(key):
    arr = []
    while key:
        arr = [key % 256] + arr
        key //= 256
    return struct.pack("!" + "B" * len(arr), *arr)

def key_from_bin(key):
    arr = struct.unpack("!" + "B" * len(key), key)
    i = 0
    for n in arr:
        i *= 256
        i += n
    return i

def predict_len(keysize):
    length = (keysize + 7) // 8
    return length

def test(iters):
    for i in range(1, iters + 1):
        test = 2**i - 1
        assert test == key_from_bin(key_to_bin(test))
        assert len(key_to_bin(test)) == predict_len(i)

Using Q instead of B may improve CPU time, at the cost of ~8 bytes average. This effect should be minimal, however, depending on how struct works internally. If it works in the naive way I think it does, then this just reduces its workload proportional to this method's increased workload.

CI test test_propagation_* fails on pypy2/pypy3; locally does not

Build:

As of this issue's creation, Windows has not yet completed its run. If it also fails, this issue will receive an additional label.

This error appears to not be the key-storage bug that was affecting python 3.3+, so this will need to be debugged on a local system. My best guess is that it's a timing issue, since there will almost certainly be thread clutter. Figuring out how to clean these up better will help, though it may not solve the problem.

allow for ssl encryption

Step 1: figure out how to generate a self signed certificate with the fewest dependencies possible (and a range of them, where any are needed)

Current candidates: PyOpenSSL, cryptography, PyCrypto?

Step 2: figure out a way to guarantee the removal of certificate files after exit, or find a way to feed it as an object instead

Debug network recovery failure

Pursuant to the completion of #38

Note that this is likely not a concurrency limitation, as the bug also occurs when testing via multiprocessing.

Connection bug

Steps to reproduce:

  1. Start three instances of python, two python2, one python3
  2. Connect python3 to python2a
  3. Connect python2b to python2a
  4. Watch python2b connect to, then disconnect from python3

What's going on here? It looks as if python2b is closing the socket first, but I can't see an explanation why. Furthermore, if you reverse the order of connection, the bug doesn't seem to occur. When it does occur, no exceptions are added to the queue.

Network Unit Testing

There needs to be testing for the various network functions. Unfortunately, the CIs don't seem to like this very much.

Can't run on Qpython/SL4A

Looks like they just don't have bz2. If that's all it is, I'm happy to add a try-catch to fix that.

(Practically) remove message size limit

Proposal: add 1 byte to size header which describes the length of the size header and packet header. New structure would be roughly:

  1. 1 byte describing header length
  2. X bytes describing message length
  3. Xn bytes describing packet layout
  4. Packets

For automated messages this saves ~11 bytes each. It also expands the possible message size/packet length from 2564-1 to 256255-1.

The question is, does this render a sufficiently large increase in complexity that it's not worth it? For instance, this means that struct will no longer work for the purpose. This will have lots of effects on how fast/slow the program becomes, and it may not be worth it.

Strangely, this may make the Javascript side easier, as it forces me to remove a dependency.

Add mesh_socket unit tests

Plaintext:

  • Propagation
  • Protocol Rejection
  • Response
  • Socket disconnect recovery
  • Socket shutdown recovery
  • Message reply
  • Custom handler registry
  • Inactive socket test
  • Compression renegotiation

SSL

  • Propagation
  • Protocol Rejection
  • Response
  • Socket disconnect recovery
  • Socket shutdown recovery
  • Message reply
  • Custom handler registry
  • Inactive socket test
  • Compression renegotiation

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.