Example #1
0
    def __init__(self):
        self.handler = SocksHandler()

        self.supportedTransports = {
            "dummy": DummyClient,
            "rot13": Rot13Client,
            "dust": DustClient,
            "obfs3": Obfs3Client,
        }

        matchedTransports = init(self.supportedTransports.keys())
        for transport in matchedTransports:
            try:
                logging.error("Launching %s" % transport)
                self.launchClient(transport, 8182)
                reportSuccess(transport, 5, ("127.0.0.1", 8182), None, None)
            except TransportLaunchException:
                reportFailure(transport, "Failed to launch")
        reportEnd()

        eventloop.run()
Example #2
0
    def __init__(self):
        self.handler = SocksHandler()

        self.supportedTransports = {
            'dummy': DummyClient,
            'rot13': Rot13Client,
            'dust': DustClient,
            'obfs3': Obfs3Client,
        }

        matchedTransports = init(self.supportedTransports.keys())
        for transport in matchedTransports:
            try:
                logging.error('Launching %s' % transport)
                self.launchClient(transport, 8182)
                reportSuccess(transport, 5, ('127.0.0.1', 8182), None, None)
            except TransportLaunchException:
                reportFailure(transport, 'Failed to launch')
        reportEnd()

        eventloop.run()
Example #3
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

""" This is an example client which shows how to call the pyptlib.easy high-level API. """

from pyptlib.easy.client import init, reportSuccess, reportFailure, reportEnd


class TransportLaunchException(Exception):

    pass


def launchClient(self, name, port):
    if name != "dummy":
        raise TransportLaunchException("Tried to launch unsupported transport %s" % name)


if __name__ == "__main__":
    supportedTransports = ["dummy", "rot13"]

    matchedTransports = init(supportedTransports)
    for transport in matchedTransports:
        try:
            launchClient(transport, 8182)
            reportSuccess(transport, 5, ("127.0.0.1", 8182), None, None)
        except TransportLaunchException:
            reportFailure(transport, "Failed to launch")
    reportEnd()