Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Maslakov committed Nov 5, 2015
1 parent c6c7a5b commit 35773d1
Showing 1 changed file with 54 additions and 32 deletions.
86 changes: 54 additions & 32 deletions OpenVpnManagement/Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,78 +30,100 @@ public void Manager(String host = "localhost", int port = 1194, int timeout = 10
}
}

public String GetStatus() {
var a = this.SendCommand("status");
public string GetStatus() {
return this.SendCommand("status");
}

public String GetStats() {
var a = this.SendCommand("load-stats"); //todo? doesn't exist?
/// <summary>
/// State
/// </summary>
/// <returns></returns>
public string GetState() {
return this.SendCommand("state");
}

public string GetState(int n = 1) {
return this.SendCommand(string.Format("state {}", n.ToString());
}

public string GetStateAll() {
return this.SendCommand("state all");
}

public string SetStateOn() {
return this.SendCommand("state on");
}

public string SetStateOnAll() {
return this.SendCommand("state on all");
}

public string GetStateOff() {
return this.SendCommand("state off");
}

public String GetVersion() {



public string GetVersion() {
return this.SendCommand("version");
}

public String GetGetPid() {
public string GetGetPid() {
return this.SendCommand("pid");
}

public String SendSignal(Signal sgn) {
public string SendSignal(Signal sgn) {
return this.SendCommand(string.Format("SIG{}", sgn.ToString().ToUpper());
}

public String Mute() {
public string Mute() {
return this.SendCommand("pid");
}

public String GetEcho() {
public string GetEcho() {
return this.SendCommand("echo");
}

public String GetHelp() {
public string GetHelp() {
return this.SendCommand("help");
}

public String Kill() {
public string Kill() {

}

public String Net() {
public string Net() {

}



public String GetState() {
return this.SendCommand("state");
}

public String GetState(int n) {
return this.SendCommand("state " + n.ToString());
}

public String GetStateAll() {
return this.SendCommand("state all");
/// <summary>
/// Logs
/// </summary>
/// <returns></returns>
public string GetLogAll() {
return this.SendCommand("state off");
}

public String SetStateOn() {
return this.SendCommand("state on");
public string SetLogOn() {
return this.SendCommand("log on");
}

public String SetStateOnAll() {
return this.SendCommand("state on all");
public string SetLogOnAll() {
return this.SendCommand("log on all");
}

public String SetStateOff() {
return this.SendCommand("state off");
public string SetLogOff() {
return this.SendCommand("log off");
}

public String GetLog() {
return this.SendCommand("state off");
public string GetLog(int n = 1) {
return this.SendCommand(string.Format("log {}", n));
}


private String SendCommand(String cmd) {
private string SendCommand(String cmd) {
byte[] buffer = Encoding.Default.GetBytes(cmd);
socket.Send(buffer, 0, buffer.Length, 0);
buffer = new byte[255];
Expand Down

0 comments on commit 35773d1

Please sign in to comment.