示例#1
0
def run(cmdargs):
    args = [
        (cmdargs.localhost, cmdargs.localport),
        (cmdargs.remotehost, cmdargs.remoteport)
    ]
    kwargs = {}

    if cmdargs.sslboth:
        kwargs['ssl'] = True
        if not cmdargs.certfile or not cmdargs.keyfile:
            print ('You need to specify a valid certificate file and a key file!')
            sys.exit(1)
        kwargs['certfile'] = cmdargs.certfile
        kwargs['keyfile'] = cmdargs.keyfile
    elif cmdargs.sslout:
        kwargs['ssl_out_only'] = True

    kwargs['debug'] = False

    if cmdargs.username and cmdargs.password:
        credentials = store_credentials.StoreCredentials()
        credentials.username = cmdargs.username
        credentials.password = cmdargs.password
        credentials.stored = True
    else:
        credentials = credentials_emailing.StoreCredentials()
        #credentials.username = config.username
        #credentials.password = config.password
        credentials.stored = True
    kwargs['credential_validator'] = credentials

    server = ProxyServer(*args, **kwargs)
    server.run()
示例#2
0
def main():
    """Init and run HttpServer"""
    server = ProxyServer("config.json")
    server.run()
示例#3
0
def main():
    proxy = ProxyServer()
    proxy.run()
示例#4
0
def main():
    proxy_server = ProxyServer('localhost', 9001, 100, 4092)
    proxy_server.run()