tno-mpc / communication Goto Github PK
View Code? Open in Web Editor NEWTNO PET Lab - secure Multi-Party Computation (MPC) - Communication
Home Page: https://docs.pet.tno.nl/mpc/communication
License: Apache License 2.0
TNO PET Lab - secure Multi-Party Computation (MPC) - Communication
Home Page: https://docs.pet.tno.nl/mpc/communication
License: Apache License 2.0
Would be nice if we could also specify the external_port
when using the method .add_http_server(...)
Originally posted by @frankcorneliusmartin in #1 (comment)
The server port is send as a cookie to the client. It uses the port that is used when creating the HTTPServer
for this:
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
?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.