Skip to content

Commit

Permalink
refactor: TestFakeDNS
Browse files Browse the repository at this point in the history
  • Loading branch information
chsbuffer committed Nov 14, 2020
1 parent ea0dd3c commit 850393a
Showing 1 changed file with 1 addition and 23 deletions.
24 changes: 1 addition & 23 deletions Netch/Controllers/TUNTAPController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,33 +228,11 @@ private bool ClearRouteTable()

public bool TestFakeDNS()
{
var exited = false;
var helpStr = new StringBuilder();
try
{
void OnOutputDataReceived(object sender, DataReceivedEventArgs e)
{
if (e.Data == null)
{
exited = true;
return;
}

helpStr.Append(e.Data);
}

InitInstance("-h");
// Instance.OutputDataReceived += OnOutputDataReceived;
Instance.ErrorDataReceived += OnOutputDataReceived;
Instance.Start();
Instance.BeginOutputReadLine();
Instance.BeginErrorReadLine();
while (!exited)
{
Thread.Sleep(200);
}

return helpStr.ToString().Contains("-fakeDns");
return Instance.StandardError.ReadToEnd().Contains("-fakeDns");
}
catch
{
Expand Down

0 comments on commit 850393a

Please sign in to comment.