[Pkg-privacy-commits] [pyptlib] 28/136: Added high-level API
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 13:25:03 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository pyptlib.
commit 8626b130f9d7ebd4ffb42cce9e61393a4490eaf5
Author: Brandon Wiley <brandon at blanu.net>
Date: Fri Jun 29 13:52:34 2012 -0500
Added high-level API
---
src/{ => pyptlib/easy}/__init__.py | 0
src/pyptlib/easy/client.py | 40 +++++++++++++++++++++++++++++++++++++
src/pyptlib/easy/server.py | 41 ++++++++++++++++++++++++++++++++++++++
3 files changed, 81 insertions(+)
diff --git a/src/__init__.py b/src/pyptlib/easy/__init__.py
similarity index 100%
copy from src/__init__.py
copy to src/pyptlib/easy/__init__.py
diff --git a/src/pyptlib/easy/client.py b/src/pyptlib/easy/client.py
new file mode 100644
index 0000000..7f4129d
--- /dev/null
+++ b/src/pyptlib/easy/client.py
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import os
+import sys
+
+import argparse
+
+from struct import unpack
+from socket import inet_ntoa
+
+from pyptlib.config import EnvException
+from pyptlib.client import ClientConfig
+
+def init(transports):
+ supportedTransportVersion = '1'
+ config = ClientConfig()
+
+ if config.checkManagedTransportVersion(supportedTransportVersion):
+ config.writeVersion(supportedTransportVersion)
+ else:
+ config.writeVersionError()
+ return []
+
+ matchedTransports=[]
+ for transport in transports:
+ if config.checkTransportEnabled(supportedTransport):
+ matchedTransports.append(transport)
+
+ return matchedTransports
+
+def reportSuccess(name, socksVersion, address, args, optArgs):
+ config.writeMethod(name, socksVersion, address, args, optArgs)
+
+def reportFailure(name, message):
+ config.writeMethodError(name, message)
+
+def reportEnd():
+ config.writeMethodEnd()
+
diff --git a/src/pyptlib/easy/server.py b/src/pyptlib/easy/server.py
new file mode 100644
index 0000000..e916007
--- /dev/null
+++ b/src/pyptlib/easy/server.py
@@ -0,0 +1,41 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import os
+import sys
+
+import argparse
+
+from struct import unpack
+from socket import inet_ntoa
+
+from pyptlib.config import EnvException
+from pyptlib.client import ServerConfig
+
+def init(transports):
+ supportedTransportVersion = '1'
+ config = ServerConfig()
+
+ if config.checkManagedTransportVersion(supportedTransportVersion):
+ config.writeVersion(supportedTransportVersion)
+ else:
+ config.writeVersionError()
+ return []
+
+ matchedTransports=[]
+ for transport in transports:
+ if config.checkTransportEnabled(supportedTransport):
+ matchedTransports.append(transport)
+
+ return matchedTransports
+
+def reportSuccess(name, address, args, options):
+ config.writeMethod(name, address, options)
+
+def reportFailure(name, message):
+ config.writeMethodError(name, message)
+
+def reportEnd():
+ config.writeMethodEnd()
+
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/pyptlib.git
More information about the Pkg-privacy-commits
mailing list