chiark / gitweb /
wip
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 19 Mar 2017 12:00:45 +0000 (12:00 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 19 Mar 2017 12:00:45 +0000 (12:00 +0000)
PROTOCOL [new file with mode: 0644]
server [new file with mode: 0755]

diff --git a/PROTOCOL b/PROTOCOL
new file mode 100644 (file)
index 0000000..9969e61
--- /dev/null
+++ b/PROTOCOL
@@ -0,0 +1,27 @@
+Server maintains a queue of outbound packets for each user
+
+Packets which are older than MAX_QUEUE_TIME are discarded
+
+Each incoming request to the server takes up to MAX_BATCH_DOWN bytes
+from the queue and returns them as the POST response body payload
+
+Each incoming request contains up to MAX_BATCH_UP bytes of payload.
+It's a multipart/form-data.
+
+Authentication: for now, plaintext password
+
+Sever side configuration:
+ Per user but normally global
+  MAX_MAX_BATCH_DOWN MAX_MAX_QUEUE_TIME
+ Global
+  MTU
+ Per user
+  PASSWORD
+
+Client side configuration;
+ MAX_BATCH_DOWN MAX_QUEUE_TIME PASSWORD
+
+Routing assistance: none needed; secnet polypath will DTRT
+
+Client form parameters:
+ I MBD MQT P D
diff --git a/server b/server
new file mode 100755 (executable)
index 0000000..fcf7a81
--- /dev/null
+++ b/server
@@ -0,0 +1,48 @@
+#!/usr/bin/python2
+
+from twisted.web.server import Site
+from twisted.web.resource import Resource
+from twisted.web.server import NOT_DONE_YET
+from twisted.internet import reactor
+
+import ConfigParser
+
+import cgi
+
+clients = { }
+
+def ipaddress(input):
+  try:
+    r = IPv4Address(input)
+  except AddressValueError:
+    r = IPv6Address(input)
+  return r
+
+def ipnetwork(input):
+  try:
+    r = IPv4Network(input)
+  except NetworkValueError:
+    r = IPv6Network(input)
+  return r
+
+def process_cfg():
+  global network
+  global ourself
+
+  network = ipnetwork(cfg.get('virtual','network')
+  try:
+    ourself = cfg.get('virtual','server')
+  except ConfigParser.NoOptionError:
+    ourself = network.hosts().next()
+
+  
+
+class Client():
+  def __init__(ip):
+  # instance data members
+  #  ._ip
+    self._ip = IPv4Address(ip)
+    clients 
+
+class FormPage(Resource):
+  def render_POST(self, request):