route delete fixed (Windows)

This commit is contained in:
pokamest 2021-03-18 22:13:05 +03:00
parent d831d68e73
commit c2f6c7d939
10 changed files with 24 additions and 15 deletions

View file

@ -298,6 +298,13 @@ void MainWindow::onPushButtonNewServerConnectWithNewData(bool)
serverCredentials.userName = ui->lineEdit_new_server_login->text();
if (ui->pushButton_new_server_connect_key->isChecked()){
QString key = ui->textEdit_new_server_ssh_key->toPlainText();
if (key.startsWith("ssh-rsa")) {
QMessageBox::warning(this, APPLICATION_NAME,
tr("It's public key. Private key required"));
return;
}
if (key.contains("OPENSSH") && key.contains("BEGIN") && key.contains("PRIVATE KEY")) {
key = OpenVpnConfigurator::convertOpenSShKey(key);
}
@ -833,7 +840,7 @@ void MainWindow::onPushButtonDeleteCustomSiteClicked(const QString &siteToDelete
updateSettings();
if (m_vpnConnection->connectionState() == VpnProtocol::ConnectionState::Connected) {
IpcClient::Interface()->routeDelete(ipToDelete);
IpcClient::Interface()->routeDelete(ipToDelete, "");
IpcClient::Interface()->flushDns();
}
}

View file

@ -40,11 +40,13 @@ void VpnConnection::onConnectionStateChanged(VpnProtocol::ConnectionState state)
IpcClient::Interface()->flushDns();
if (m_settings.customRouting()) {
IpcClient::Interface()->routeDelete("0.0.0.0", m_vpnProtocol->vpnGateway());
IpcClient::Interface()->routeAddList(m_vpnProtocol->vpnGateway(),
QStringList() << m_settings.primaryDns() << m_settings.secondaryDns());
const QStringList &black_custom = m_settings.customIps();
qDebug() << "onConnect :: adding custom black routes, count:" << black_custom.size();
qDebug() << "VpnConnection::onConnectionStateChanged :: adding custom routes, count:" << black_custom.size();
IpcClient::Interface()->routeAddList(m_vpnProtocol->vpnGateway(), black_custom);
}