|
@ -7,18 +7,24 @@ import json |
|
|
from Basis.Logger import logging |
|
|
from Basis.Logger import logging |
|
|
from Basis.Process import Process |
|
|
from Basis.Process import Process |
|
|
from Basis.Methods import plugins |
|
|
from Basis.Methods import plugins |
|
|
from Basis.Functions import genFlag, getAvailablePort |
|
|
from Basis.Functions import genFlag |
|
|
|
|
|
from Basis.Functions import ipFormat |
|
|
|
|
|
from Basis.Functions import getAvailablePort |
|
|
|
|
|
|
|
|
settings = { |
|
|
settings = { |
|
|
'serverBind': '127.0.0.1', |
|
|
'serverBind': '127.0.0.1', |
|
|
'workDir': '/tmp/ProxyC', |
|
|
'workDir': '/tmp/ProxyC', |
|
|
|
|
|
'site': 'www.bing.com', |
|
|
|
|
|
'host': '343.re', |
|
|
|
|
|
'cert': '/etc/ssl/certs/343.re/fullchain.pem', |
|
|
|
|
|
'key': '/etc/ssl/certs/343.re/privkey.pem', |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
pluginParams = { |
|
|
pluginParams = { |
|
|
'SITE': 'www.bing.com', |
|
|
'SITE': settings['site'], |
|
|
'HOST': '343.re', |
|
|
'HOST': settings['host'], |
|
|
'CERT': '/etc/ssl/certs/343.re/fullchain.pem', |
|
|
'CERT': settings['cert'], |
|
|
'KEY': '/etc/ssl/certs/343.re/privkey.pem', |
|
|
'KEY': settings['key'], |
|
|
'PATH': '/' + genFlag(length = 6), |
|
|
'PATH': '/' + genFlag(length = 6), |
|
|
'PASSWD': genFlag(length = 8), |
|
|
'PASSWD': genFlag(length = 8), |
|
|
} |
|
|
} |
|
@ -270,7 +276,7 @@ def ssInject(server: Process, pluginInfo: dict) -> Process: |
|
|
ssConfig = json.loads(server.file[0]['content']) # modify origin config |
|
|
ssConfig = json.loads(server.file[0]['content']) # modify origin config |
|
|
ssConfig.pop('plugin') # remove plugin option |
|
|
ssConfig.pop('plugin') # remove plugin option |
|
|
ssConfig.pop('plugin_opts') |
|
|
ssConfig.pop('plugin_opts') |
|
|
rabbitBind = ('[%s]' if ':' in ssConfig['server'] else '%s') % ssConfig['server'] # ipv4 / [ipv6] |
|
|
rabbitBind = ipFormat(ssConfig['server'], v6Bracket = True) # ipv4 / [ipv6] |
|
|
rabbitPort = ssConfig['server_port'] |
|
|
rabbitPort = ssConfig['server_port'] |
|
|
ssConfig['server'] = '127.0.0.1' # SIP003 use ipv4 localhost for communication |
|
|
ssConfig['server'] = '127.0.0.1' # SIP003 use ipv4 localhost for communication |
|
|
ssConfig['server_port'] = int(pluginInfo['server']['param']) # aka ${RABBIT_PORT} |
|
|
ssConfig['server_port'] = int(pluginInfo['server']['param']) # aka ${RABBIT_PORT} |
|
|