ss files
This commit is contained in:
parent
0b8c8835c4
commit
15dc6eaaf8
5 changed files with 47 additions and 17 deletions
|
@ -21,6 +21,7 @@ HEADERS += \
|
||||||
localclient.h \
|
localclient.h \
|
||||||
managementserver.h \
|
managementserver.h \
|
||||||
message.h \
|
message.h \
|
||||||
|
protocols/shadowsocksvpnprotocol.h \
|
||||||
runguard.h \
|
runguard.h \
|
||||||
settings.h \
|
settings.h \
|
||||||
ui/Controls/SlidingStackedWidget.h \
|
ui/Controls/SlidingStackedWidget.h \
|
||||||
|
@ -40,6 +41,7 @@ SOURCES += \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
managementserver.cpp \
|
managementserver.cpp \
|
||||||
message.cpp \
|
message.cpp \
|
||||||
|
protocols/shadowsocksvpnprotocol.cpp \
|
||||||
runguard.cpp \
|
runguard.cpp \
|
||||||
settings.cpp \
|
settings.cpp \
|
||||||
ui/Controls/SlidingStackedWidget.cpp \
|
ui/Controls/SlidingStackedWidget.cpp \
|
||||||
|
|
|
@ -52,19 +52,19 @@ ErrorCode ServerController::runScript(const SshConnectionParameters &sshParams,
|
||||||
wait.quit();
|
wait.quit();
|
||||||
});
|
});
|
||||||
|
|
||||||
// QObject::connect(proc.data(), &SshRemoteProcess::readyReadStandardOutput, [proc](){
|
QObject::connect(proc.data(), &SshRemoteProcess::readyReadStandardOutput, [proc](){
|
||||||
// QString s = proc->readAllStandardOutput();
|
QString s = proc->readAllStandardOutput();
|
||||||
// if (s != "." && !s.isEmpty()) {
|
if (s != "." && !s.isEmpty()) {
|
||||||
// qDebug().noquote() << s;
|
qDebug().noquote() << s;
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
|
|
||||||
// QObject::connect(proc.data(), &SshRemoteProcess::readyReadStandardError, [proc](){
|
QObject::connect(proc.data(), &SshRemoteProcess::readyReadStandardError, [proc](){
|
||||||
// QString s = proc->readAllStandardError();
|
QString s = proc->readAllStandardError();
|
||||||
// if (s != "." && !s.isEmpty()) {
|
if (s != "." && !s.isEmpty()) {
|
||||||
// qDebug().noquote() << s;
|
qDebug().noquote() << s;
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
|
|
||||||
proc->start();
|
proc->start();
|
||||||
|
|
||||||
|
@ -284,13 +284,24 @@ ErrorCode ServerController::setupOpenVpnServer(const ServerCredentials &credenti
|
||||||
ErrorCode e = runScript(sshParams(credentials), scriptData);
|
ErrorCode e = runScript(sshParams(credentials), scriptData);
|
||||||
if (e) return e;
|
if (e) return e;
|
||||||
|
|
||||||
//return ok;
|
|
||||||
return checkOpenVpnServer(credentials);
|
return checkOpenVpnServer(credentials);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorCode ServerController::setupShadowSocksServer(const ServerCredentials &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)
|
SshConnection *ServerController::connectToHost(const SshConnectionParameters &sshParams)
|
||||||
|
|
6
client/protocols/shadowsocksvpnprotocol.cpp
Normal file
6
client/protocols/shadowsocksvpnprotocol.cpp
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#include "shadowsocksvpnprotocol.h"
|
||||||
|
|
||||||
|
ShadowSocksVpnProtocol::ShadowSocksVpnProtocol()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
12
client/protocols/shadowsocksvpnprotocol.h
Normal file
12
client/protocols/shadowsocksvpnprotocol.h
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#ifndef SHADOWSOCKSVPNPROTOCOL_H
|
||||||
|
#define SHADOWSOCKSVPNPROTOCOL_H
|
||||||
|
|
||||||
|
#include "openvpnprotocol.h"
|
||||||
|
|
||||||
|
class ShadowSocksVpnProtocol : public OpenVpnProtocol
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ShadowSocksVpnProtocol();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SHADOWSOCKSVPNPROTOCOL_H
|
|
@ -243,7 +243,7 @@ bool MainWindow::installServer(ServerCredentials credentials,
|
||||||
timer.start(1000);
|
timer.start(1000);
|
||||||
|
|
||||||
|
|
||||||
ErrorCode e = ServerController::setupServer(credentials, Protocol::Any);
|
ErrorCode e = ServerController::setupServer(credentials, Protocol::ShadowSocks);
|
||||||
if (e) {
|
if (e) {
|
||||||
page->setEnabled(true);
|
page->setEnabled(true);
|
||||||
button->setVisible(true);
|
button->setVisible(true);
|
||||||
|
@ -251,8 +251,7 @@ bool MainWindow::installServer(ServerCredentials credentials,
|
||||||
|
|
||||||
QMessageBox::warning(this, APPLICATION_NAME,
|
QMessageBox::warning(this, APPLICATION_NAME,
|
||||||
tr("Error occurred while configuring server.") + "\n" +
|
tr("Error occurred while configuring server.") + "\n" +
|
||||||
errorString(e) + "\n" +
|
errorString(e));
|
||||||
tr("See logs for details."));
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue