definition of the routing string to be deleted for wg and ikev2 connections
This commit is contained in:
parent
4abfc58ad0
commit
0d0c29493b
8 changed files with 111 additions and 60 deletions
|
|
@ -175,31 +175,38 @@ ErrorCode WireguardProtocol::start()
|
|||
{
|
||||
//TODO:FIXME: without some ugly sleep we have't get a adapter parametrs
|
||||
std::this_thread::sleep_for(std::chrono::seconds(4));
|
||||
std::string p1{},p2{};//,p3;
|
||||
std::string p1{},p2{},p3;
|
||||
const auto &ret = adpInfo.get_adapter_info("WireGuard Tunnel");//serviceName().toStdString());//("AmneziaVPN IKEv2");
|
||||
if (std::get<0>(ret) == false){
|
||||
p1 = adpInfo.get_adapter_route_gateway();
|
||||
p2 = adpInfo.get_adapter_local_address();
|
||||
//p3 = adpInfo.get_adapter_local_gateway();
|
||||
p3 = adpInfo.get_adapter_local_gateway();
|
||||
m_routeGateway = QString::fromStdString(p1);
|
||||
m_vpnLocalAddress = QString::fromStdString(p2);
|
||||
m_vpnGateway = protocols::wireguard::defaultSubnetAddress;//QString::fromStdString(p3);
|
||||
m_vpnGateway = QString::fromStdString(p3);
|
||||
qDebug()<<"My wireguard m_routeGateway "<<m_routeGateway;
|
||||
qDebug()<<"My wireguard m_vpnLocalAddress "<<m_vpnLocalAddress;
|
||||
qDebug()<<"My wireguard m_vpnGateway "<< m_vpnGateway;
|
||||
auto ret = adpinfo::get_route_table();
|
||||
qDebug()<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
|
||||
auto ret = adpinfo::get_route_table(p2.c_str());
|
||||
{
|
||||
for (const auto &itret: ret){
|
||||
const auto ip = std::get<0>(itret);
|
||||
const auto msk = std::get<1>(itret);
|
||||
const auto gw = std::get<2>(itret);
|
||||
const auto itf = std::get<3>(itret);
|
||||
qDebug()<<"IP["<<ip.c_str()<<"]"<<"Mask["<<msk.c_str()<<"]"<<"gateway["<<gw.c_str()<<"]"<<"Interface["<<itf.c_str()<<"]";
|
||||
}
|
||||
|
||||
for (const auto &itret: ret){
|
||||
const auto ip = itret.szDestIp;//std::get<0>(itret);
|
||||
const auto msk = itret.szMaskIp;//std::get<1>(itret);
|
||||
const auto gw = itret.szGatewayIp;//std::get<2>(itret);
|
||||
const auto itf = itret.szInterfaceIp;//std::get<3>(itret);
|
||||
const auto itfInd = itret.ulIfIndex;
|
||||
qDebug()<<"IP["<<ip.c_str()<<"]"<<"Mask["<<msk.c_str()<<"]"<<"gateway["<<gw.c_str()<<"]"<<"Interface["<<itf.c_str()<<"]"<<"Interface index["<<itfInd<<"]";
|
||||
emit route_avaible(QString::fromStdString(ip),
|
||||
QString::fromStdString(msk),
|
||||
QString::fromStdString(gw),
|
||||
QString::fromStdString(itf),
|
||||
itfInd);
|
||||
//m_vpnGateway = QString::fromStdString(gw);
|
||||
}
|
||||
}
|
||||
qDebug()<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
|
||||
//qDebug()<<"My wireguard m_routeGateway "<<m_routeGateway;
|
||||
//qDebug()<<"My wireguard m_vpnLocalAddress "<<m_vpnLocalAddress;
|
||||
//qDebug()<<"My wireguard m_vpnGateway "<< m_vpnGateway;
|
||||
}
|
||||
else{
|
||||
qDebug()<<"We can't get information about active adapter:"<<QString::fromStdString(std::get<1>(ret));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue