Exemplo n.º 1
0
def connect(port):
    factory = example.ProtocolFactory()
    factory.address = "www.google.com"
    factory.port = port
    
    configuration = \
    {
        "PROXY_SERVERS":
        [
            {
                "TYPE": "HTTPS",
                "ADDRESS": "127.0.0.1",
                "PORT": 8443
            },
            {
                "TYPE": "SOCKS5",
                "ADDRESS": "127.0.0.1",
                "PORT": 1080
            }
        ]
    }
    
    contextFactory = None
    if factory.port == 443:
        contextFactory = ssl.ClientContextFactory()
    
    tunnel = proxy_server.createTunnel(configuration)
    tunnel.connect(factory.address, factory.port, factory, contextFactory)
Exemplo n.º 2
0
def connect(port):
    factory = example.ProtocolFactory()
    factory.address = "www.google.com"
    factory.port = port

    configuration = \
    {
        "PROXY_SERVERS": []
    }

    contextFactory = None
    if factory.port == 443:
        contextFactory = ssl.ClientContextFactory()

    tunnel = proxy_server.createTunnel(configuration)
    tunnel.connect(factory.address, factory.port, factory, contextFactory)