Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Maslakov committed Nov 6, 2015
1 parent 59a0fd7 commit b295396
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
12 changes: 7 additions & 5 deletions OpenVpnManagement/Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Net;

namespace OpenVpnManagement {
public class Manager {
public class Manager : IDisposable {

public enum Signal {
Hup,
Expand All @@ -16,9 +16,6 @@ public enum Signal {
Usr2
}

private String host;
private int port;
private int timeout;
private Socket socket;
private const int bufferSize = 1024;

Expand Down Expand Up @@ -96,7 +93,6 @@ public string GetNet() {
return this.SendCommand("net");
}


/// <summary>
/// Logs
/// </summary>
Expand Down Expand Up @@ -167,5 +163,11 @@ private string SendCommand(String cmd) {

return sb.ToString();
}

public void Dispose() {
if (socket != null) {
socket.Dispose();
}
}
}
}
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
# OpenVpnManagement
OpenVpnManagement
====

A library in C# for communicating with OpenVPN Management Interface

### Example
```
using (var mng = new Manager("127.0.0.1", 8888)) {
var res1 = mng.GetPid();
Console.WriteLine(res);
var res2 = mng.GetHelp();
Console.WriteLine(res2);
var res3 = mng.SendMalCommand();
// Exception is thrown
}
```

0 comments on commit b295396

Please sign in to comment.