This commit is contained in:
pokamest 2021-01-10 20:37:57 +03:00
parent 0b8c8835c4
commit 15dc6eaaf8
5 changed files with 47 additions and 17 deletions

View file

@ -21,6 +21,7 @@ HEADERS += \
localclient.h \
managementserver.h \
message.h \
protocols/shadowsocksvpnprotocol.h \
runguard.h \
settings.h \
ui/Controls/SlidingStackedWidget.h \
@ -40,6 +41,7 @@ SOURCES += \
main.cpp \
managementserver.cpp \
message.cpp \
protocols/shadowsocksvpnprotocol.cpp \
runguard.cpp \
settings.cpp \
ui/Controls/SlidingStackedWidget.cpp \

View file

@ -52,19 +52,19 @@ ErrorCode ServerController::runScript(const SshConnectionParameters &sshParams,
wait.quit();
});
// QObject::connect(proc.data(), &SshRemoteProcess::readyReadStandardOutput, [proc](){
// QString s = proc->readAllStandardOutput();
// if (s != "." && !s.isEmpty()) {
// qDebug().noquote() << s;
// }
// });
QObject::connect(proc.data(), &SshRemoteProcess::readyReadStandardOutput, [proc](){
QString s = proc->readAllStandardOutput();
if (s != "." && !s.isEmpty()) {
qDebug().noquote() << s;
}
});
// QObject::connect(proc.data(), &SshRemoteProcess::readyReadStandardError, [proc](){
// QString s = proc->readAllStandardError();
// if (s != "." && !s.isEmpty()) {
// qDebug().noquote() << s;
// }
// });
QObject::connect(proc.data(), &SshRemoteProcess::readyReadStandardError, [proc](){
QString s = proc->readAllStandardError();
if (s != "." && !s.isEmpty()) {
qDebug().noquote() << s;
}
});
proc->start();
@ -284,13 +284,24 @@ ErrorCode ServerController::setupOpenVpnServer(const ServerCredentials &credenti
ErrorCode e = runScript(sshParams(credentials), scriptData);
if (e) return e;
//return ok;
return checkOpenVpnServer(credentials);
}
ErrorCode ServerController::setupShadowSocksServer(const ServerCredentials &credentials)
{
return ErrorCode::NotImplementedError;
QString scriptData;
QString scriptFileName = ":/server_scripts/setup_shadowsocks_server.sh";
QFile file(scriptFileName);
if (! file.open(QIODevice::ReadOnly)) return ErrorCode::InternalError;
scriptData = file.readAll();
if (scriptData.isEmpty()) return ErrorCode::InternalError;
ErrorCode e = runScript(sshParams(credentials), scriptData);
if (e) return e;
return ErrorCode::NoError;
//return checkShadowSocksServer(credentials);
}
SshConnection *ServerController::connectToHost(const SshConnectionParameters &sshParams)

View file

@ -0,0 +1,6 @@
#include "shadowsocksvpnprotocol.h"
ShadowSocksVpnProtocol::ShadowSocksVpnProtocol()
{
}

View file

@ -0,0 +1,12 @@
#ifndef SHADOWSOCKSVPNPROTOCOL_H
#define SHADOWSOCKSVPNPROTOCOL_H
#include "openvpnprotocol.h"
class ShadowSocksVpnProtocol : public OpenVpnProtocol
{
public:
ShadowSocksVpnProtocol();
};
#endif // SHADOWSOCKSVPNPROTOCOL_H

View file

@ -243,7 +243,7 @@ bool MainWindow::installServer(ServerCredentials credentials,
timer.start(1000);
ErrorCode e = ServerController::setupServer(credentials, Protocol::Any);
ErrorCode e = ServerController::setupServer(credentials, Protocol::ShadowSocks);
if (e) {
page->setEnabled(true);
button->setVisible(true);
@ -251,8 +251,7 @@ bool MainWindow::installServer(ServerCredentials credentials,
QMessageBox::warning(this, APPLICATION_NAME,
tr("Error occurred while configuring server.") + "\n" +
errorString(e) + "\n" +
tr("See logs for details."));
errorString(e));
return false;
}