public bool DoWork(Util.UpdateStatusDelegate SetStatus, Util.ShouldCancelDelegate ShouldCancel) { SetStatus("Connecting to SSH...", 0); using (VyattaShell Shell = new VyattaShell(Data.Address, Data.Username, Data.Password)) { SetStatus("Killing DNSCrypt if running...", 10); RouterEnableDNSCrypt.KillDNSCrypt(Shell); SetStatus("Killing DNSCrypt if running...", 30); Shell.RunCommand("configure"); Shell.RunCommand("delete service dns forwarding options"); SetStatus("Committing changes...", 60); Shell.RunCommand("commit"); Shell.RunCommand("save"); Shell.RunCommand("exit"); SetStatus("Restarting dnsmasq...", 80); Shell.RunCommand("sudo /etc/init.d/dnsmasq restart"); } SetStatus("Completed.", 100); return(true); }
private void enableDNSCryptToolStripMenuItem_Click(object sender, EventArgs e) { if (MessageBox.Show( "You are about to enable DNSCrypt that will encrypt your DNS traffic\n" + "so that it cannot be snooped on by your ISP.\n" + "This process takes a while and could possibly go wrong\n" + "leaving your router in an unknown state.\n" + "Are you sure you wish to continue?", "Confirm enabling DNS crypt?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) { var Command = new RouterEnableDNSCrypt(Data, this); Busy BusyWorker = new Busy(Command); if (BusyWorker.ShowDialog() == DialogResult.OK) { MessageBox.Show("DNSCrypt has been enabled!\nIt is recommended that you now confirm this\nby using DNSLeakTest.com", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }