跳转到主要内容

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 (19.3 kB 查看哈希值)

上传时间: 源代码