Skip to content

Commit

Permalink
Merge pull request #18 from tindy2013/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
tindy2013 committed Aug 30, 2019
2 parents c0b0654 + 4c85247 commit 2b03922
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 8 deletions.
98 changes: 98 additions & 0 deletions build.alpine.release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#!/bin/bash
mkdir obj
mkdir bin
mkdir tools/clients
rm -rf tools/clients/*
set -e

apk add gcc g++ cmake make autoconf automake libtool build-base linux-headers
apk add libpng-dev libressl-dev freetype-dev freetype-static zlib-dev rapidjson-dev mbedtls-dev mbedtls-static libev-dev pcre-dev libsodium-dev c-ares-dev

git clone https://github.com/curl/curl
cd curl
./buildconf
./configure
make install -j4
cd ..

git clone https://github.com/jbeder/yaml-cpp
cd yaml-cpp
cmake .
make install -j4
cd ..

git clone https://github.com/pngwriter/pngwriter
cd pngwriter
cmake .
make install -j4
cd ..

git clone https://github.com/shadowsocks/simple-obfs
cd simple-obfs
git submodule init
git submodule update
./autogen.sh
./configure --disable-documentation
make -j4
cd src
gcc obfs_local*.o ../libcork/.libs/libcork.a -o simple-obfs -lev -static
mv simple-obfs ../../tools/clients/
cd ../..

git clone https://github.com/shadowsocks/shadowsocks-libev
cd shadowsocks-libev
git submodule init
git submodule update
./autogen.sh
./configure --disable-documentation
make -j4
cd src
gcc ss_local*.o .libs/libshadowsocks-libev.a -o ss-local -lpcre -lmbedtls -lmbedcrypto -lev -lsodium -static
mv ss-local ../../tools/clients/
cd ../..

git clone https://github.com/shadowsocksrr/shadowsocksr-libev
cd shadowsocksr-libev
./configure --disable-documentation
make -j4
cd src
gcc ss_local*.o .libs/libshadowsocks-libev.a -o ssr-local -lpcre -lssl -lcrypto -static
mv ssr-local ../../tools/clients/
cd ../..

git clone git://sourceware.org/git/bzip2.git
cd bzip2
make install -j4
cd ..

apk del wget
apk add wget

wget https://github.com/joewalnes/websocketd/releases/download/v0.3.0/websocketd-0.3.0-linux_amd64.zip
unzip websocketd-0.3.0-linux_amd64.zip websocketd
mv websocketd tools/gui/

wget https://github.com/v2ray/v2ray-core/releases/latest/download/v2ray-linux-64.zip
unzip v2ray-linux-64.zip v2ray v2ctl
mv v2ray tools/clients/
mv v2ctl tools/clients/

gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c geoip.cpp -o obj/geoip.o
gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c logger.cpp -o obj/logger.o
gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c main.cpp -o obj/main.o
gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c misc.cpp -o obj/misc.o
gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c multithread-test.cpp -o obj/multithread-test.o
gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c printout.cpp -o obj/printout.o
gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c processes.cpp -o obj/processes.o
gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c rapidjson_extra.cpp -o obj/rapidjson_extra.o
gcc -Wall -fexceptions -DCURL_STATICLIB -g -I/usr/local/include/freetype2 -I/usr/include/freetype2 -std=c++11 -c renderer.cpp -o obj/renderer.o
gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c rulematch.cpp -o obj/rulematch.o
gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c socket.cpp -o obj/socket.o
gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c speedtestutil.cpp -o obj/speedtestutil.o
gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c tcping.cpp -o obj/tcping.o
gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c webget.cpp -o obj/webget.o
g++ -g -o stairspeedtest obj/geoip.o obj/logger.o obj/main.o obj/misc.o obj/multithread-test.o obj/printout.o obj/processes.o obj/rapidjson_extra.o obj/renderer.o obj/rulematch.o obj/socket.o obj/speedtestutil.o obj/tcping.o obj/webget.o -lcurl -lPNGwriter -lpng16 -lfreetype -lz -lssl -lcrypto -ldl -lpthread -lyaml-cpp -lbz2 -s -static

chmod +rx stairspeedtest pref.ini webgui.sh tools/clients/* tools/gui/* tools/misc/*
tar czf stairspeedtest_reborn_linux64.tar.gz stairspeedtest pref.ini webgui.sh tools/

10 changes: 6 additions & 4 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,11 @@ int runClient(int client, string runpath)
break;
}
#else
string v2core_path = "v2ray -config config.json";
string ssr_libev_path = "ssr-local -c config.json";
string ss_libev_path = "ss-local -c config.json";
string v2core_path = "tools/clients/v2ray -config config.json";
string ssr_libev_path = "tools/clients/ssr-local -c config.json";

string ss_libev_dir = "tools/clients/";
string ss_libev_path = "ss-local -c ../../config.json";

switch(client)
{
Expand All @@ -179,7 +181,7 @@ int runClient(int client, string runpath)
break;
case SPEEDTEST_MESSAGE_FOUNDSS:
writeLog(LOG_TYPE_INFO, "Starting up shadowsocks-libev...");
runProgram(ss_libev_path, "", false);
runProgram(ss_libev_path, ss_libev_dir, false);
break;
}
#endif // _WIN32
Expand Down
9 changes: 8 additions & 1 deletion processes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,16 @@ void killByHandle(HANDLE hProc)
#else
bool runProgram(string command, string runpath, bool wait)
{
/*
string total_path = runpath == "" ? "" : runpath + PATH_SLASH;
total_path += command + "&";
total_path += command;
pPipe = popen(total_path.data(), "r");
*/
char curdir[1024] = {};
getcwd(curdir, 1024);
chdir(runpath.data());
pPipe = popen(command.data(), "r");
chdir(curdir);
return true;
}
#endif // _WIN32
Expand Down
6 changes: 4 additions & 2 deletions speedtestutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ string ssConstruct(string server, string port, string password, string method, s
string base = base_ss_win;
string config = config_ss_win;
string config_libev = config_ss_libev;
if(plugin == "obfs-local")
plugin = "simple-obfs";
if(libev == true)
config = config_libev;
config = replace_all_distinct(config, "?server?", server);
Expand Down Expand Up @@ -380,8 +382,8 @@ void explodeSS(string ss, bool libev, string custom_port, int local_port, nodeIn
port = custom_port == "" ? args[2] : custom_port;
addition = args[3];
plugins = UrlDecode(getUrlArg(addition, "plugin"));
plugin = plugins.substr(0, plugin.find(";"));
pluginopts = plugins.substr(plugin.find(";") + 1);
plugin = plugins.substr(0, plugins.find(";"));
pluginopts = plugins.substr(plugins.find(";") + 1);
if(getUrlArg(addition, "group") != "")
group = base64_decode(getUrlArg(addition, "group"));
}
Expand Down
2 changes: 1 addition & 1 deletion version.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef VERSION_H_INCLUDED
#define VERSION_H_INCLUDED

#define VERSION "v0.2.15-beta"
#define VERSION "v0.2.16-beta"

#endif // VERSION_H_INCLUDED
2 changes: 2 additions & 0 deletions webgui.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
tools/gui/websocketd --port=65430 --maxforks=1 --staticdir=tools/gui ./stairspeedtest /rpc

0 comments on commit 2b03922

Please sign in to comment.