本文介绍了使用VB.NET的Openvpn GUI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在为我的团队创建VPN客户端。我已经完成了L2TP,PPTP和IKEv2部分。现在我需要实现OpenVPN。有人可以帮助我使用VB.net创建OpenVPN客户端。我几乎有代码。但是,它对我来说效果不佳。



这里process.start抛出未找到的文件。

Shell无法正常工作..显示不是方法

Interaction.shell工作但没有连接



我尝试过:



Hello, I am creating VPN client for my team. I have completed L2TP, PPTP and IKEv2 section. Now I need to implement OpenVPN. Can somebody help me with creating OpenVPN client using VB.net. I have the code almost. However, it is not working well for me.

Here process.start throws file not found.
Shell not working..showing is not a method
Interaction.shell working but not connecting

What I have tried:

Public Sub myConnection()
        proto = "udp"


        ' UDP Config File

        serverf = "--client --dev tun --remote " & IPServer & " --proto " & proto & " --port " & "1194" & "  --lport " & "1194" & _
    "--keepalive 20 60 --reneg-sec 432000 --resolv-retry infinite --cipher AES-128-CBC  --fast-io --pull --tun-mtu 1500 --auth-user-pass data\user.txt " & _
    "--persist-key --persist-tun --ca data\vpnbook.ca --verb 3 --redirect-gateway --route-delay 2 --explicit-exit-notify 2 " & _
    " --log data\logfile.tmp --status data\status.dat 1 "


        SelectServer = serverf

    End Sub







Private Sub ovconnection()
        loadsettings()
        tnew = 0
        Try

            pingurl = " -t"

        Catch ex As Exception

        End Try
        If lb_con.Content = "Connect" Then
            If tb1_server.Text = "" Then
                MessageBox.Show("Please select your server!")
            Else

                lb1.Content = "Connecting"
                lb_con.Content = "Connecting"
                myConnection()
                process.Start(Forms.Application.StartupPath & "\bin\openvpn " & SelectServer, AppWinStyle.Hide)
            End If
        ElseIf lb_con.Content = "Disconnect" Then
            Dim g As String
            g = "taskkill /f /im openvpn.exe"
            Interaction.Shell("cmd /c" & g, vbHide)
            g = "taskkill /f /im ping.exe"
            Interaction.Shell("cmd /c" & g, vbHide)
            lb1.Content = "Disconnected"
            lb_con.Content = "Connect"
        ElseIf lb_con.Content = "Connecting" Then
            If MsgBox("Do You want to Disconnect VPN", MsgBoxStyle.YesNo, "VPN") = vbYes Then
                c = 0
                Dim g As String
                g = "taskkill /f /im openvpn.exe"
                Interaction.Shell("cmd /c" & g, vbHide)
                g = "taskkill /f /im ping.exe"
                Interaction.Shell("cmd /c" & g, vbHide)
                lb1.Content = "Disconnected"
                lb_con.Content = "Connect"
            End If
        End If
    End Sub

推荐答案


这篇关于使用VB.NET的Openvpn GUI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-15 23:21