与stunnel的python接口
pystunnel的Python项目详细描述
安装
使用您喜爱的安装程序安装pystunnel库和脚本。 例如:
$ pip install pystunnel
示例
从命令行:
$ pystunnel -c /path/to/stunnel.conf start started $ pystunnel -c /path/to/stunnel.conf check running $ pystunnel -c /path/to/stunnel.conf stop stopped
如果省略该命令,pystunnel将输入一个交互式shell:
$ pystunnel -c /path/to/stunnel.conf pystunnel> start started pystunnel> check running pystunnel> stop stopped pystunnel> quit $
来自python:
from pystunnel import Stunnel stunnel = Stunnel("/path/to/stunnel.conf") rc = stunnel.start() print("stunnel started with rc", rc) if stunnel.check() == 0: print("stunnel is running with pid", stunnel.getpid()) else: print("stunnel is not running") rc = stunnel.stop() print("stunnel stopped with rc", rc)
返回代码
0表示正常,1或更高表示错误。
更改日志
1.0a1-2016-03-14
- 初次发布。