Пример #1
0
def updown():
    form = UpDownForm()
    vpn = VpnServer()
    if form.validate_on_submit():
        if form.up.data and vpn.tunnel_up(form.tunnel_name.data):
            flash(u'隧道连接成功!', 'success')
        if form.down.data and vpn.tunnel_down(form.tunnel_name.data):
            flash(u'隧道断开成功!', 'success')
    return redirect(url_for('sts.index'))
Пример #2
0
def updown():
    form = UpDownForm()
    vpn = VpnServer()
    if form.validate_on_submit():
        if form.up.data and vpn.tunnel_up(form.tunnel_name.data):
            flash(u'隧道连接成功!', 'success')
        if form.down.data and vpn.tunnel_down(form.tunnel_name.data):
            flash(u'隧道断开成功!', 'success')
    return redirect(url_for('sts.index'))
Пример #3
0
def console():
    form = ConsoleForm()
    vpn = VpnServer()
    if form.validate_on_submit():
        if form.stop.data and vpn.stop:
            flash(u'VPN 服务停止成功!', 'success')
        if form.start.data and vpn.start:
            flash(u'VPN 服务启动成功!', 'success')
        if form.re_load.data and vpn.reload:
            flash(u'VPN 服务配置生效完成!', 'success')
    return render_template('sts/console.html', status=vpn.status, form=form)
Пример #4
0
def tunnel_up(tunnel_name):
    vpn = VpnServer()
    return jsonify({
        'result': vpn.tunnel_up(tunnel_name),
        'stdout': vpn.c_stdout
    })
Пример #5
0
def vpn_traffic(tunnel_name):
    vpn = VpnServer()
    return jsonify(vpn.tunnel_traffic(tunnel_name) or [])
Пример #6
0
def tunnel_up(tunnel_name):
    vpn = VpnServer()
    return jsonify({'result': vpn.tunnel_up(tunnel_name), 'stdout': vpn.c_stdout})
Пример #7
0
def vpn_traffic(tunnel_name):
    vpn = VpnServer()
    return jsonify(vpn.tunnel_traffic(tunnel_name) or [])