Python的stunnel接口
项目描述
概述
给定一个stunnel配置文件,启动和停止一个stunnel实例。
stunnel可执行文件必须在系统PATH上可用。配置文件必须指定PID文件。
安装
使用您喜欢的安装程序安装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
初始版本。
项目详情
关闭
pystunnel-1.0a1.zip 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | a9c8c4079843fe7413e792c6989a94d7c9ed7e10d6ffc011b32addf50a904de1 |
|
MD5 | dfa73edba10021b4dd8cc08324a7aaf7 |
|
BLAKE2b-256 | 6905b7b0c19422dbb5cc6f9f0c568c532eaf7e973e2e8e4cdac4ca1cb1710f9b |