Release 1.1 (#5)

* Crash fix in management server

* Openvpn scripts fixes
some refactoring

* deploy fix

* Scripts fix for macos

* OpenVpn runtime error codes handling

* MacOS deploy script fix

* easyrsa scripts for MacOS

* Refactoring
Ui improvements
Bug fixes

* new server page fix

* Fix some warnings, fix installation scripts (macOS)

* Fix crash on fatal error, remove moc files from Windows installation

* ss files

* Fix issue with easyrsa

* ss files

* shadowsocks impl

* ss fix

* ui fix

* Macos doc icon

* travis scripts

* server scripts fix

* icon changed

* Server scripts fix

* travis fix

* Bug fixes:
- auto install tap
- share connectionState
- service crash fix

* travis release

* macos deploy
This commit is contained in:
pokamest 2021-01-27 00:57:02 +03:00 committed by GitHub
parent c2a7d66cb4
commit 0569c6411e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
80 changed files with 2881 additions and 321 deletions

View file

@ -111,3 +111,71 @@ bool Utils::processIsRunning(const QString& fileName)
#endif
}
QString Utils::getIPAddress(const QString& host)
{
//TODO rewrite to api calls
qDebug().noquote() << "GetIPAddress: checking " + host;
if(host.isEmpty()) {
qDebug().noquote() << "GetIPAddress: host is empty.";
return QString();
}
if(checkIPFormat(host)) {
qDebug().noquote() << "GetIPAddress host is ip:" << host << host;
return host; // it is a ip address.
}
QProcess ping;
#ifdef Q_OS_MACX
ping.start("ping", QStringList() << "-c1" << host);
#endif
#ifdef Q_OS_WIN
ping.start("ping", QStringList() << QString("/n") << "1" << QString("/w") << "1" << host);
#endif
ping.waitForStarted();
QEventLoop loop;
loop.connect(&ping, SIGNAL(finished(int)), &loop, SLOT(quit()));
loop.exec();
QString d = ping.readAll();
if(d.size() == 0)
return QString();
qDebug().noquote() << d;
QString ip;
#ifdef Q_OS_MACX
ip = getStringBetween(d, "(", ")");
#endif
#ifdef Q_OS_WIN
ip = getStringBetween(d, "[", "]");
#endif
qDebug().noquote() << "GetIPAddress:" << host << ip;
return ip;
}
QString Utils::getStringBetween(const QString& s, const QString& a, const QString& b)
{
int ap = s.indexOf(a), bp = s.indexOf(b, ap + a.length());
if(ap < 0 || bp < 0)
return QString();
ap += a.length();
if(bp - ap <= 0)
return QString();
return s.mid(ap, bp - ap).trimmed();
}
bool Utils::checkIPFormat(const QString& ip)
{
int count = ip.count(".");
if(count != 3)
return false;
QStringList list = ip.trimmed().split(".");
foreach(QString it, list) {
if(it.toInt() <= 255 && it.toInt() >= 0)
continue;
return false;
}
return true;
}