与stunnel的python接口

pystunnel的Python项目详细描述


概述

在给定stunnel configuration file的情况下启动和停止stunnel实例。

可执行文件stunnel必须在系统路径上可用。 配置文件必须指定一个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

  • 初次发布。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java IBM Notes 9电子邮件问题。自动从我的收件箱转发到另一个收件人   Android上的java覆盖删除键?   java More JPanel和背景图像   java AStar寻路|六角夹点   java Android存档库(aar)与标准jar   java转换docx后没有空行   java如何搜索FTS3表,使搜索的单词显示在列表的顶部   java运算符重载STL的性能损失是什么   java在本机SQL Hibernate中使用addJoin   使用hibernate的java动态列   java为什么整数在放入数组后会改变值?   如何将|系列与Java正则表达式匹配?   java问题在binarySearch中传递参数   Java:关于导入语句中使用的路径的愚蠢新手问题   java无法在文本框安卓中显示数据库中的数据   使用Java中的旧文件详细信息创建文件   java按降序进行升序快速排序