def run(self): sock = sockschain.socksocket() if self.proto in ('ircs', 'ssl'): if sockschain.HAVE_SSL: chain = ['default'] chain.append('ssl!%s!%s' % (self.hostname, self.port)) for hop in chain: sock.addproxy(*sockschain.parseproxy(hop)) try: sock.connect((self.hostname, self.port)) sock.setblocking(0) self.callback_ok(sock) except: if self.callback_err: self.callback_err(sock)
def parse_proxy_list(serverchain): chain=[] hops=serverchain.split(',') for hop in hops: chain.append(socks.parseproxy(hop)) return chain