Coder Social home page Coder Social logo

tno-mpc / communication Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 0.0 216 KB

TNO PET Lab - secure Multi-Party Computation (MPC) - Communication

Home Page: https://docs.pet.tno.nl/mpc/communication

License: Apache License 2.0

Python 100.00%
tno mpc multi-party-computation communication mpc-lab pet-lab

communication's People

Contributors

thomastno avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

communication's Issues

Party behind port forwarder uses wrong ip handler

The server port is send as a cookie to the client. It uses the port that is used when creating the HTTPServer for this:

cookies = {"server_port": str(self.pool.http_server.port)}

We run the player behind a port forwarder, meaning that the port the HTTPServer listens too is not the same port the other parties can reach this server. We hacked a way of changing this behaviour by monkey patching the HTTPClient:

def new_http_client_init(self, pool, addr: str, port: int,
                         ssl_ctx: Optional[ssl.SSLContext]):
    self.pool = pool
    self.addr = addr
    self.port = port
    self.ssl_ctx = ssl_ctx
    if self.pool.http_server is None:
        raise AttributeError("No HTTP Server initialized (yet).")
    # self.session
    cookies = {"server_port": str(self.pool.external_port)}
    if self.pool.loop.is_running():
        self.pool.loop.create_task(self._create_client_session(cookies))
    else:
        self.pool.loop.run_until_complete(self._create_client_session(cookies))
    self.msg_send_counter = 0
    self.total_bytes_sent = 0
    self.msg_recv_counter = 0
    self.send_lock = threading.Lock()
    self.recv_lock = threading.Lock()
    self.buffer = {}


tno.mpc.communication.httphandlers.HTTPClient.__init__ = new_http_client_init

Would it be possible to allow to set an external port when creating the HTTPServer?

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.