Giter Club home page Giter Club logo

dp5's Introduction

Running the servers

Configuration

  1. Set up a registration server.

    Create a file regserver.cfg (JSON) that is modeled after the following:

     	{
     		"server" : {	/* configuration values passed to cherrypy web server */
     			"server.socket_host": "0.0.0.0", 	/* bind to all IP interfaces */
     			"server.socket_port": 8443,			/* listen on port 8443 */
     			/* These are needed to support SSL; leave them out to use plain HTTP */
     			"server.ssl_module": "pyopenssl",
     			"server.ssl_certificate": "testcerts/server.crt",
     			"server.ssl_private_key": "testcerts/server.key"
     		},
     		"isRegServer": true,
     		"isLookupServer": false, 	/* set to true if you want this to also be a lookup server */
     		"regdir": "regdir", 		/* directory for storing registrations for next epoch */
     		"datadir": "datadir",		/* directory for storing presence database */
     		"epochLength" : 1800,		/* length in seconds of an epoch */
     		"dataEncSize" : 32,			/* length of ciphertext */
     		"combined" : false			/* combined registration for all contacts */
     	}
    

    (note: plaintext is 16 bytes shorter than ciphertext.) You will also need to create empty directories regdir/ and datadir/. If you are using SSL, you will need to generate a server key and obtain a certificate. (Could be self-signed.)

    To run the registration server, execute:

     	python dp5twistedserver.py regserver.cfg
    
  2. Set up one or more lookup servers.

    For each server, create a file lookupserver.cfg (JSON) similar to the following:

     	{
     		"server" : {	/* configuration values passed to cherrypy web server */
     			"server.socket_host": "0.0.0.0", 	/* bind to all IP interfaces */
     			"server.socket_port": 8444,			/* listen on port 8444 */
     			/* These are needed to support SSL; leave them out to use plain HTTP */
     			"server.ssl_module": "pyopenssl",
     			"server.ssl_certificate": "testcerts/server.crt",
     			"server.ssl_private_key": "testcerts/server.key"
     		},
     		"isRegServer": false,
     		"isLookupServer": true,
     		"regServer": "https://localhost:8443", 	/* address of the registration server */
     		"datadir": "lookupdatadir/",			/* directory for storing presence database */
     		"epochLength" : 1800,		/* length in seconds of an epoch */
     		"dataEncSize" : 32,			/* length of ciphertext */
     		"combined" : false			/* combined registration for all contacts */
     	}
    

    Once again, you will need to create a data directory (lookupdatadir/ in this case) and obtain a server certificate. The lookup servers need to be able to find the registration server to download the presence database. Start the servers by running:

     	python dp5twistedserver.py lookupserver.cfg
    

Running the Test Harness

Generating Users

The users.py script will generate a set of users and their buddies:

	python users.py 200 users.200

This will generate a database of 200 users and store it in a file users.200. Each user will be assigned up to MAX_BUDDIES (100) buddies at random.

Configuring the Client

The client configuration is stored in JSON, see servers.cfg for an example:

	{
		"regServer": "localhost:8443",  /* address of the registration server */
		"lookupServers":               	/* addresses of the lookup servers */
				[ "localhost:8444", "localhost:8445" ],
		"privacyLevel": 1,				/* maximum number servers that can collude */
		"epochLength" : 1800,		/* length in seconds of an epoch */
		"dataEncSize" : 32,			/* length of ciphertext */
		"combined" : false			/* combined registration for all contacts */

	}

The privacy level must be at most one less than the number of available lookup servers. Note: a combined registration/lookup client is not currently supported.

Running the Client

		python dp5client.py servers.cfg users.200

This will proceed to register each user in the users.200 file, then use a debugging command to advance the registration to the server, and then have each client look up all of its buddies using the lookup servers.

Caveats

The client will use a number of processes for querying (default: 5*number of CPUs) so this may add extra load on your machine. Also, the process pool doesn't always respond to Ctrl-C well, so I type Ctrl-Z followed by kill %%.

There is an interaction between the process pool on the client, the thread pool on the lookup server, and the urllib3 module that keeps connections open that can cause the lookup server to wait for a request on an idle connection while not servicing requests on other connections and get "stuck". You will notice that nothing is happening for about 10 seconds and then things move forward a bit. The simplest way to fix it is to increase the size of the cherrypy threadpool to match the number of client processes: add "server.thread_pool": 100 to the "server" section of lookupserver.cfg. We are working on a better longer-term solution.

dp5's People

Contributors

gdanezis avatar haraldh avatar nikitaborisov avatar

Watchers

 avatar  avatar  avatar

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.