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:
parent
c2a7d66cb4
commit
0569c6411e
80 changed files with 2881 additions and 321 deletions
|
|
@ -6,8 +6,10 @@
|
|||
#include <core/servercontroller.h>
|
||||
|
||||
#include "protocols/openvpnprotocol.h"
|
||||
#include "protocols/shadowsocksvpnprotocol.h"
|
||||
#include "utils.h"
|
||||
#include "vpnconnection.h"
|
||||
#include "communicator.h"
|
||||
|
||||
VpnConnection::VpnConnection(QObject* parent) : QObject(parent)
|
||||
{
|
||||
|
|
@ -21,6 +23,25 @@ void VpnConnection::onBytesChanged(quint64 receivedBytes, quint64 sentBytes)
|
|||
|
||||
void VpnConnection::onConnectionStateChanged(VpnProtocol::ConnectionState state)
|
||||
{
|
||||
// if (state == VpnProtocol::ConnectionState::Connected){
|
||||
// m_vpnProtocol->communicator()->sendMessage(Message(Message::State::FlushDnsRequest, QStringList()));
|
||||
|
||||
// // add routes
|
||||
// const QStringList &black_custom = m_settings.customIps();
|
||||
// qDebug() << "onConnect :: adding custom black routes, count:" << black_custom.size();
|
||||
|
||||
|
||||
// QStringList args;
|
||||
// args << m_vpnProtocol->vpnGateway();
|
||||
// args << black_custom;
|
||||
|
||||
// Message m(Message::State::RoutesAddRequest, args);
|
||||
// m_vpnProtocol->communicator()->sendMessage(m);
|
||||
// }
|
||||
// else if (state == VpnProtocol::ConnectionState::Error) {
|
||||
// m_vpnProtocol->communicator()->sendMessage(Message(Message::State::ClearSavedRoutesRequest, QStringList()));
|
||||
// m_vpnProtocol->communicator()->sendMessage(Message(Message::State::FlushDnsRequest, QStringList()));
|
||||
// }
|
||||
emit connectionStateChanged(state);
|
||||
}
|
||||
|
||||
|
|
@ -36,8 +57,8 @@ ErrorCode VpnConnection::lastError() const
|
|||
ErrorCode VpnConnection::requestVpnConfig(const ServerCredentials &credentials, Protocol protocol)
|
||||
{
|
||||
ErrorCode errorCode = ErrorCode::NoError;
|
||||
if (protocol == Protocol::OpenVpn) {
|
||||
QString configData = OpenVpnConfigurator::genOpenVpnConfig(credentials, &errorCode);
|
||||
if (protocol == Protocol::OpenVpn || protocol == Protocol::ShadowSocks) {
|
||||
QString configData = OpenVpnConfigurator::genOpenVpnConfig(credentials, protocol, &errorCode);
|
||||
if (errorCode) {
|
||||
return errorCode;
|
||||
}
|
||||
|
|
@ -51,8 +72,7 @@ ErrorCode VpnConnection::requestVpnConfig(const ServerCredentials &credentials,
|
|||
|
||||
return ErrorCode::FailedToSaveConfigData;
|
||||
}
|
||||
else if (protocol == Protocol::ShadowSocks) {
|
||||
// Request OpenVPN config and ShadowSocks
|
||||
else {
|
||||
return ErrorCode::NotImplementedError;
|
||||
}
|
||||
return ErrorCode::NotImplementedError;
|
||||
|
|
@ -61,6 +81,8 @@ ErrorCode VpnConnection::requestVpnConfig(const ServerCredentials &credentials,
|
|||
|
||||
ErrorCode VpnConnection::connectToVpn(const ServerCredentials &credentials, Protocol protocol)
|
||||
{
|
||||
// protocol = Protocol::ShadowSocks;
|
||||
|
||||
// TODO: Try protocols one by one in case of Protocol::Any
|
||||
// TODO: Implement some behavior in case if connection not stable
|
||||
qDebug() << "Connect to VPN";
|
||||
|
|
@ -81,8 +103,18 @@ ErrorCode VpnConnection::connectToVpn(const ServerCredentials &credentials, Prot
|
|||
connect(m_vpnProtocol.data(), &VpnProtocol::protocolError, this, &VpnConnection::vpnProtocolError);
|
||||
}
|
||||
else if (protocol == Protocol::ShadowSocks) {
|
||||
emit connectionStateChanged(VpnProtocol::ConnectionState::Error);
|
||||
return ErrorCode::NotImplementedError;
|
||||
ErrorCode e = requestVpnConfig(credentials, Protocol::ShadowSocks);
|
||||
if (e) {
|
||||
emit connectionStateChanged(VpnProtocol::ConnectionState::Error);
|
||||
return e;
|
||||
}
|
||||
if (m_vpnProtocol) {
|
||||
disconnect(m_vpnProtocol.data(), &VpnProtocol::protocolError, this, &VpnConnection::vpnProtocolError);
|
||||
}
|
||||
|
||||
m_vpnProtocol.reset(new ShadowSocksVpnProtocol(ShadowSocksVpnProtocol::genShadowSocksConfig(credentials)));
|
||||
connect(m_vpnProtocol.data(), &VpnProtocol::protocolError, this, &VpnConnection::vpnProtocolError);
|
||||
|
||||
}
|
||||
|
||||
connect(m_vpnProtocol.data(), SIGNAL(connectionStateChanged(VpnProtocol::ConnectionState)), this, SLOT(onConnectionStateChanged(VpnProtocol::ConnectionState)));
|
||||
|
|
@ -101,12 +133,21 @@ void VpnConnection::disconnectFromVpn()
|
|||
{
|
||||
qDebug() << "Disconnect from VPN";
|
||||
|
||||
// m_vpnProtocol->communicator()->sendMessage(Message(Message::State::ClearSavedRoutesRequest, QStringList()));
|
||||
// m_vpnProtocol->communicator()->sendMessage(Message(Message::State::FlushDnsRequest, QStringList()));
|
||||
|
||||
if (!m_vpnProtocol.data()) {
|
||||
return;
|
||||
}
|
||||
m_vpnProtocol.data()->stop();
|
||||
}
|
||||
|
||||
VpnProtocol::ConnectionState VpnConnection::connectionState()
|
||||
{
|
||||
if (!m_vpnProtocol) return VpnProtocol::ConnectionState::Disconnected;
|
||||
return m_vpnProtocol->connectionState();
|
||||
}
|
||||
|
||||
bool VpnConnection::onConnected() const
|
||||
{
|
||||
if (!m_vpnProtocol.data()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue