/usr/share/doc/python-pyptlib/examples/client.py is in python-pyptlib 0.0.6-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""This is a client-side example of the pyptlib API."""
import sys
from pyptlib.client import ClientTransportPlugin
from pyptlib.config import EnvError
if __name__ == '__main__':
client = ClientTransportPlugin()
try:
client.init(["blackfish", "bluefish"])
except EnvError, err:
print "pyptlib could not bootstrap ('%s')." % str(err)
sys.exit(1)
for transport in client.getTransports():
# Spawn all the transports in the list, and for each spawned
# transport report back the port where it is listening, and
# the SOCKS version it supports.
try:
socks_version, bind_addrport = your_function_that_launches_transports(transport)
except YourFailException, err:
reportFailure(transport, "Failed to launch ('%s')." % str(err))
continue
client.reportMethodSuccess(transport, socks_version, bind_addrport, None, None)
# After spawning our transports, report that we are done.
client.reportMethodsEnd()
|