Esempio n. 1
0
def open_proxy_backend(backend,
                       target,
                       name,
                       client,
                       use_ssl=False,
                       ssl_opts=None):
    proxy = eventlet.connect(backend)
    if use_ssl:
        ssl_opts = ssl_opts or {}
        proxy = eventlet.wrap_ssl(proxy, server_side=False, **ssl_opts)
    proxy.sendall(protocol.version)
    protocol.send_message(proxy,
                          protocol.proxy_request(
                              name=name,
                              client=client,
                          ))
    reply = protocol.recv_message(proxy)
    if reply and 'proxy' in reply:
        try:
            local = eventlet.connect(target)
            util.join_sockets(proxy, local)
        except IOError:
            proxy.close()
    elif reply and 'error' in reply:
        print "  ERROR: {0}".format(reply['error'])
        return
    else:
        pass
Esempio n. 2
0
def open_proxy_backend(backend, target, name, client, use_ssl=False, ssl_opts=None):
    proxy = eventlet.connect(backend)
    if use_ssl:
        ssl_opts = ssl_opts or {}
        proxy = eventlet.wrap_ssl(proxy, server_side=False, **ssl_opts)
    proxy.sendall(protocol.version)
    protocol.send_message(proxy, protocol.proxy_request(name=name, client=client))
    reply = protocol.recv_message(proxy)
    if reply and "proxy" in reply:
        try:
            local = eventlet.connect(target)
            util.join_sockets(proxy, local)
        except IOError:
            proxy.close()
    elif reply and "error" in reply:
        print "  ERROR: {0}".format(reply["error"])
        return
    else:
        pass
Esempio n. 3
0
def open_proxy_backend(backend, target, name, client):
    proxy = eventlet.connect(backend)
    proxy.sendall(protocol.version)
    protocol.send_message(proxy,
        protocol.proxy_request(
            name=name,
            client=client,
    ))
    reply = protocol.recv_message(proxy)
    if reply and 'proxy' in reply:
        try:
            local = eventlet.connect(target)
            util.join_sockets(proxy, local)
        except IOError:
            proxy.close()
    elif reply and 'error' in reply:
        print "  ERROR: {0}".format(reply['error'])
        return
    else:
        pass
Esempio n. 4
0
def open_proxy_backend(backend, port, name, client):
    proxy = eventlet.connect(backend)
    proxy.sendall(protocol.version)
    protocol.send_message(proxy, 
        protocol.proxy_request(
            name=name, 
            client=client,
    ))
    reply = protocol.recv_message(proxy)
    if reply and 'proxy' in reply:
        try:
            local = eventlet.connect(('0.0.0.0', port))
            util.join_sockets(proxy, local)
        except IOError:
            proxy.close()
    elif reply and 'error' in reply:
        print "  ERROR: {0}".format(reply['error'])
        return
    else:
        pass