Skip to content

Commit

Permalink
Clean up file structure and update build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
tindy2013 committed Jan 2, 2020
1 parent 1e77fd2 commit 937f1f3
Show file tree
Hide file tree
Showing 70 changed files with 9,321 additions and 8,963 deletions.
34 changes: 34 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
language: cpp
sudo: required
stages:
- name: before_script
if: branch = master
- name: deploy
if: branch = master
matrix:
include:
- os: osx
compiler: clang
osx_image: xcode10.3
script:
- bash scripts/build.macos.release.sh
deploy:
provider: releases
api_key: "$GITHUB_OAUTH_TOKEN"
file: "stairspeedtest_reborn_darwin64.tar.gz"
skip_cleanup: true
draft: true
on:
tags: true
- services: docker
script:
- docker pull alpine:latest
- docker run -v $TRAVIS_BUILD_DIR:/root/workdir -e TRAVIS_BRANCH -e TRAVIS_TAG alpine:latest /bin/sh -c "apk add bash git && cd /root/workdir && bash scripts/build.alpine.release.sh"
deploy:
provider: releases
api_key: "$GITHUB_OAUTH_TOKEN"
file: "stairspeedtest_reborn_linux64.tar.gz"
skip_cleanup: true
draft: true
on:
tags: true
94 changes: 94 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
project(stairspeedtest LANGUAGES CXX)
cmake_minimum_required(VERSION 3.4)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release)
ENDIF()
SET(CMAKE_CXX_STANDARD 17)
ADD_DEFINITIONS(-Wall -Wextra -Wno-unused-parameter -Wno-unused-result)

OPTION(USING_STD_REGEX "Use std::regex from C++ library instead of PCRECPP" OFF)

IF(MACOS)
ADD_DEFINITIONS(-D_MACOS)
ENDIF()

ADD_EXECUTABLE(stairspeedtest
src/geoip.cpp
src/logger.cpp
src/main.cpp
src/misc.cpp
src/multithread_test.cpp
src/printout.cpp
src/processes.cpp
src/rapidjson_extra.cpp
src/renderer.cpp
src/rulematch.cpp
src/socket.cpp
src/speedtestutil.cpp
src/tcping.cpp
src/webget.cpp
src/webgui_wrapper.cpp
src/webserver_libevent.cpp)
INCLUDE_DIRECTORIES(src)
LINK_DIRECTORIES(${CMAKE_SOURCE_DIR})

FIND_PACKAGE(PkgConfig REQUIRED)

SET(THREADS_PREFER_PTHREAD_FLAG ON)
FIND_PACKAGE(Threads REQUIRED)
TARGET_LINK_LIBRARIES(stairspeedtest ${CMAKE_THREAD_LIBS_INIT})

PKG_CHECK_MODULES(LIBEVENT libevent REQUIRED)
FIND_PATH(LIBEVENT_INCLUDE_DIR NAMES event.h PATHS ${LIBEVENT_INCLUDE_DIRS})
FIND_LIBRARY(LIBEVENT_LIBRARY NAMES event PATHS ${LIBEVENT_LIBRARY_DIRS})
LINK_DIRECTORIES(${LIBEVENT_LIBRARY_DIRS})
INCLUDE_DIRECTORIES(${LIBEVENT_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(stairspeedtest ${LIBEVENT_LIBRARY})

FIND_PACKAGE(CURL 7.54.0 REQUIRED)
INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(stairspeedtest ${CURL_LIBRARIES})
ADD_DEFINITIONS(-DCURL_STATICLIB)

FIND_PACKAGE(OpenSSL 1.1.0 REQUIRED)
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(stairspeedtest ${OPENSSL_LIBRARIES})

FIND_PACKAGE(Rapidjson REQUIRED)
INCLUDE_DIRECTORIES(${RAPIDJSON_INCLUDE_DIRS})

FIND_PACKAGE(PNG 1.6 REQUIRED)
INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(stairspeedtest ${PNG_LIBRARIES})
ADD_DEFINITIONS(${PNG_DEFINITIONS})

FIND_PACKAGE(Freetype REQUIRED)
INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIR_freetype2})
TARGET_LINK_LIBRARIES(stairspeedtest ${FREETYPE_LIBRARIES})

FIND_PACKAGE(PNGwriter 0.7.0 REQUIRED)
INCLUDE_DIRECTORIES(${PNGwriter_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(stairspeedtest PNGwriter::PNGwriter)

PKG_CHECK_MODULES(YAML_CPP yaml-cpp REQUIRED)
FIND_LIBRARY(YAML_CPP_LIBRARY NAMES yaml-cpp yaml-cppd PATHS ${YAML_CPP_LIBRARY_DIRS})
LINK_DIRECTORIES(${YAML_CPP_LIBRARY_DIRS})
INCLUDE_DIRECTORIES(${YAML_CPP_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(stairspeedtest ${YAML_CPP_LIBRARY})

IF(USING_STD_REGEX STREQUAL "ON")
ADD_DEFINITIONS(-DUSE_STD_REGEX)
ELSE()
FIND_PACKAGE(PCRECPP REQUIRED)
INCLUDE_DIRECTORIES(${PCRECPP_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(stairspeedtest ${PCRECPP_LIBRARIES})
ADD_DEFINITIONS(-DPCRE_STATIC)
ENDIF()

IF(WIN32)
TARGET_LINK_LIBRARIES(stairspeedtest wsock32 ws2_32)
ELSE()
INCLUDE(GNUInstallDirs)
INSTALL(TARGETS stairspeedtest DESTINATION ${CMAKE_INSTALL_BINDIR})
ENDIF()
166 changes: 83 additions & 83 deletions pref.ini → base/pref.ini
Original file line number Diff line number Diff line change
@@ -1,83 +1,83 @@
[common]
;Excluded remarks, nodes with these remarks will be ignored, supports regular expression
;one remark per line, index starts at 0
exclude_remarks0=(剩余流量|到期时间|过期时间|官网地址|产品名称)

;Included remarks, if defined (";" removed), only nodes with these remarks will be tested, supports regular expression
;one remark per line, index starts at 0
;include_remarks0=香港

[advanced]
;Test mode, default is all
;recognized value: all, speedonly, pingonly
speedtest_mode=all

;Test site ping (Google Ping)
test_site_ping=true

;Test upload speed
test_upload=false

;SS clients used in Speedtest, default is ss-csharp
;recognized value: ss-libev, ss-csharp
preferred_ss_client=ss-libev

;SSR clients used in Speedtest, default is ssr-csharp
;recognized value: ssr-libev, ssr-csharp
preferred_ssr_client=ssr-libev

;Ping method, default is tcping
;recognized value: tcping, googleping, bingping, gstaticping
preferred_ping_method=tcping

;Override any port in configurations and use the following one
;!!!DO NOT USE THIS UNLESS YOU ARE VERY SURE OF WHAT YOU ARE DOING!!!
;uncomment to enable this feature
;override_conf_port=8080

;Multi-thread speedtest thread count
thread_count=4

[webserver]
listen_address=127.0.0.1
listen_port=10870

[export]
;Export result with MaxSpeed
export_with_maxspeed=false

;Result picture sort method, default is speed
;recognized value: none, speed, rspeed, ping, rping
export_sort_method=none

;Export all nodes into one image when testing multiple links instead of separating different links into individual pictures
multilink_export_as_one_image=true

;Force single links to export an image
single_test_force_export=true

;Export as the newest style (SSRSpeed 2.5+)
export_as_new_style=true

;Speed color set used in rendering picture
;recognized value: original, rainbow, custom
export_color_style=original

;Custom color define
;Color groups format: R1,G1,B1|R2,G2,B2|...
;Color value is an integer from 0 to 65535
custom_color_groups=65535,65535,65535|32768,65535,0|65535,65535,0|65535,32768,49152|65535,0,0
;Color boundary format: B1|B2|...
;Boundary metric is Bytes/s
custom_color_bounds=0|65536|524288|4194304|16777216

[rules]
;Test files format: URL|TagName
test_file_urls=https://download.microsoft.com/download/2/0/E/20E90413-712F-438C-988E-FDAA79A8AC3D/dotnetfx35.exe|Default
test_file_urls=https://dl.google.com/dl/android/aosp/bonito-pd2a.190115.029-factory-aac5b874.zip|Google
test_file_urls=http://cachefly.cachefly.net/200mb.test|Cachefly
test_file_urls=http://updates-http.cdn-apple.com/2019FallFCS/fullrestores/061-22552/374D62DE-E18B-11E9-A68D-B46496A9EC6E/iPhone12,1_13.1.2_17A860_Restore.ipsw|Apple
;Rule format: matchType|matchItem1|matchItem2|...|matchTag
rules=match_isp|Microsoft Corporation|Google
rules=match_isp|Google LLC|Default

[common]
;Excluded remarks, nodes with these remarks will be ignored, supports regular expression
;one remark per line, index starts at 0
exclude_remarks0=(剩余流量|到期时间|过期时间|官网地址|产品名称)

;Included remarks, if defined (";" removed), only nodes with these remarks will be tested, supports regular expression
;one remark per line, index starts at 0
;include_remarks0=香港

[advanced]
;Test mode, default is all
;recognized value: all, speedonly, pingonly
speedtest_mode=all

;Test site ping (Google Ping)
test_site_ping=true

;Test upload speed
test_upload=false

;SS clients used in Speedtest, default is ss-csharp
;recognized value: ss-libev, ss-csharp
preferred_ss_client=ss-libev

;SSR clients used in Speedtest, default is ssr-csharp
;recognized value: ssr-libev, ssr-csharp
preferred_ssr_client=ssr-libev

;Ping method, default is tcping
;recognized value: tcping, googleping, bingping, gstaticping
preferred_ping_method=tcping

;Override any port in configurations and use the following one
;!!!DO NOT USE THIS UNLESS YOU ARE VERY SURE OF WHAT YOU ARE DOING!!!
;uncomment to enable this feature
;override_conf_port=8080

;Multi-thread speedtest thread count
thread_count=4

[webserver]
listen_address=127.0.0.1
listen_port=10870

[export]
;Export result with MaxSpeed
export_with_maxspeed=false

;Result picture sort method, default is speed
;recognized value: none, speed, rspeed, ping, rping
export_sort_method=none

;Export all nodes into one image when testing multiple links instead of separating different links into individual pictures
multilink_export_as_one_image=true

;Force single links to export an image
single_test_force_export=true

;Export as the newest style (SSRSpeed 2.5+)
export_as_new_style=true

;Speed color set used in rendering picture
;recognized value: original, rainbow, custom
export_color_style=original

;Custom color define
;Color groups format: R1,G1,B1|R2,G2,B2|...
;Color value is an integer from 0 to 65535
custom_color_groups=65535,65535,65535|32768,65535,0|65535,65535,0|65535,32768,49152|65535,0,0
;Color boundary format: B1|B2|...
;Boundary metric is Bytes/s
custom_color_bounds=0|65536|524288|4194304|16777216

[rules]
;Test files format: URL|TagName
test_file_urls=https://download.microsoft.com/download/2/0/E/20E90413-712F-438C-988E-FDAA79A8AC3D/dotnetfx35.exe|Default
test_file_urls=https://dl.google.com/dl/android/aosp/bonito-pd2a.190115.029-factory-aac5b874.zip|Google
test_file_urls=http://cachefly.cachefly.net/200mb.test|Cachefly
test_file_urls=http://updates-http.cdn-apple.com/2019FallFCS/fullrestores/061-22552/374D62DE-E18B-11E9-A68D-B46496A9EC6E/iPhone12,1_13.1.2_17A860_Restore.ipsw|Apple
;Rule format: matchType|matchItem1|matchItem2|...|matchTag
rules=match_isp|Microsoft Corporation|Google
rules=match_isp|Google LLC|Default

File renamed without changes.
Loading

0 comments on commit 937f1f3

Please sign in to comment.