From 8f620566fca7a92cb693d144ad3fdaa53b3132d2 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 14 Aug 2019 14:52:19 +0100 Subject: [PATCH] Separate proxy port --- daemon.py | 8 ++++---- epicyon.py | 13 ++++++++++++- tests.py | 9 ++++++--- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/daemon.py b/daemon.py index 6565e66c..0bc42448 100644 --- a/daemon.py +++ b/daemon.py @@ -2663,7 +2663,7 @@ class PubServer(BaseHTTPRequestHandler): def runDaemon(instanceId,clientToServer: bool, \ baseDir: str,domain: str, \ - port=80,httpPrefix='https', \ + port=80,proxyPort=80,httpPrefix='https', \ fedList=[],noreply=False,nolike=False,nopics=False, \ noannounce=False,cw=False,ocapAlways=False, \ useTor=False,maxReplies=64, \ @@ -2676,7 +2676,7 @@ def runDaemon(instanceId,clientToServer: bool, \ print('Invalid domain: ' + domain) return - serverAddress = ('', port) + serverAddress = ('', proxyPort) httpd = ThreadingHTTPServer(serverAddress, PubServer) # max POST size of 10M httpd.maxPostLength=1024*1024*10 @@ -2741,7 +2741,7 @@ def runDaemon(instanceId,clientToServer: bool, \ allowDeletion,debug,httpd.acceptedCaps),daemon=True) httpd.thrInboxQueue.start() if clientToServer: - print('Running ActivityPub client on ' + domain + ' port ' + str(port)) + print('Running ActivityPub client on ' + domain + ' port ' + str(proxyPort)) else: - print('Running ActivityPub server on ' + domain + ' port ' + str(port)) + print('Running ActivityPub server on ' + domain + ' port ' + str(proxyPort)) httpd.serve_forever() diff --git a/epicyon.py b/epicyon.py index 04d3fac0..f942652e 100644 --- a/epicyon.py +++ b/epicyon.py @@ -99,6 +99,8 @@ parser.add_argument('-d','--domain', dest='domain', type=str,default=None, \ help='Domain name of the server') parser.add_argument('-p','--port', dest='port', type=int,default=None, \ help='Port number to run on') +parser.add_argument('--proxy', dest='proxyPort', type=int,default=None, \ + help='Proxy port number to run on') parser.add_argument('--path', dest='baseDir', \ type=str,default=os.getcwd(), \ help='Directory in which to store posts') @@ -376,6 +378,12 @@ if configPort: else: port=8085 +configProxyPort=getConfigParam(baseDir,'proxyPort') +if configProxyPort: + proxyPort=configProxyPort +else: + proxyPort=port + nickname=None if args.nickname: nickname=nickname @@ -767,6 +775,9 @@ if args.domain: if args.port: port=args.port setConfigParam(baseDir,'port',port) +if args.proxyPort: + proxyPort=args.proxyPort + setConfigParam(baseDir,'proxyPort',proxyPort) ocapAlways=False if args.ocap: ocapAlways=args.ocap @@ -1247,7 +1258,7 @@ if args.testdata: setConfigParam(baseDir,'admin',nickname) runDaemon(instanceId,args.client,baseDir, \ - domain,port,httpPrefix, \ + domain,port,proxyPort,httpPrefix, \ federationList, \ args.noreply,args.nolike,args.nopics, \ args.noannounce,args.cw,ocapAlways, \ diff --git a/tests.py b/tests.py index d03ec1be..caef877e 100644 --- a/tests.py +++ b/tests.py @@ -191,7 +191,8 @@ def createServerAlice(path: str,domain: str,port: int,federationList: [], \ global testServerAliceRunning testServerAliceRunning = True print('Server running: Alice') - runDaemon("instanceId",False,path,domain,port,httpPrefix,federationList, \ + runDaemon("instanceId",False,path,domain,port,port, \ + httpPrefix,federationList, \ noreply,nolike,nopics,noannounce,cw,ocapAlways, \ useTor,maxReplies, \ domainMaxPostsPerDay,accountMaxPostsPerDay, \ @@ -243,7 +244,8 @@ def createServerBob(path: str,domain: str,port: int,federationList: [], \ global testServerBobRunning testServerBobRunning = True print('Server running: Bob') - runDaemon("instanceId",False,path,domain,port,httpPrefix,federationList, \ + runDaemon("instanceId",False,path,domain,port,port, \ + httpPrefix,federationList, \ noreply,nolike,nopics,noannounce,cw,ocapAlways, \ useTor,maxReplies, \ domainMaxPostsPerDay,accountMaxPostsPerDay, \ @@ -275,7 +277,8 @@ def createServerEve(path: str,domain: str,port: int,federationList: [], \ global testServerEveRunning testServerEveRunning = True print('Server running: Eve') - runDaemon("instanceId",False,path,domain,port,httpPrefix,federationList, \ + runDaemon("instanceId",False,path,domain,port,port, \ + httpPrefix,federationList, \ noreply,nolike,nopics,noannounce,cw,ocapAlways, \ useTor,maxReplies,allowDeletion,True)