Skip to content

Commit 2b61d3f

Browse files
author
Desktop Commit Bot
committed
Version 3.4.0-beta.1
1 parent d44ae75 commit 2b61d3f

File tree

948 files changed

+105507
-26320
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

948 files changed

+105507
-26320
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
.buildenv
66
# Default build directory when opening CMake glue project in most IDEs
77
/build/
8+
# Cache directory used in CI to store the clone of kapps-swift-package, which we
9+
# must commit to in order to publish a Swift package
10+
/cache/
811
.DS_Store
912
*.qm
1013
node_modules
@@ -30,3 +33,8 @@ cmake-build-debug/*
3033
# Vagrant box for running Linux-only scripts
3134
tools/.vagrant
3235

36+
# Ruby gemfile lock
37+
Gemfile.lock
38+
39+
# Ruby coverage results from simplecov
40+
coverage

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Changelog
22

3+
### v3.4.0
4+
5+
* Builds for macOS are now universal for x86_64 and arm64
6+
* Improved robustness in firewall backends
7+
* Improved reliability of split tunnel rules for Opera and other applications with "launcher" executables on Windows
8+
* Install logs are now included in debug reports when available
9+
* Login and dedicated IP pages indicate when to retry when rate-limited by API
10+
* Fixed opening combo boxes when another combo box was open, the second combo box no longer closes immediately
11+
* Fixed permissions on piavpn.service to eliminate warning from systemd on some Linux distributions
12+
* Fixed a rare GUI crash that could occur on the Split Tunnel or Automation pages if a setting change occurred while a combo box was open
13+
* Detect absense of iptables on some Linux systems and install if possible.
14+
15+
### v3.3.1
16+
17+
* Request product feedback by linking to our survey
18+
319
### v3.3.0
420

521
* Support Handshake domain name resolution (Using HDNS nameservers)

CMakeLists.txt

Lines changed: 95 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,21 @@
1010
# - target executables - so they can be built, started, and debugged in Qt
1111
# Creator with no manual setup
1212
#
13-
# Qt Creator won't be able to locate QML files by default since they aren't
14-
# indicated to CMake. See README.md for instructions to enable the
15-
# "Files in All Project Directories" locator filter by default.
13+
# Qt Creator defaults to the "all" target, which is hooked up to the default
14+
# target in Rake since the true "all" target builds _everything_ including all
15+
# unit tests, etc.
1616
#
17-
# Qt Creator defaults to the "all" target, which builds everything (including
18-
# tests, exports, installers, artifacts). To build just the staged installation
19-
# by default instead:
17+
# However, this means that actually running unit tests (etc.) from Qt Creator
18+
# won't build the right target. To have Qt Creator build the correct target
19+
# for the currently selected executable:
2020
# - Go to the Projects page
21-
# - Select "Build" under current kit"
21+
# - Select "Build" under "current kit"
2222
# - Under "Build Steps", expand the CMake build step
23-
# - Select a different target instead of "all":
24-
# - "stage" will always build the staged installation (client/cli/daemon)
25-
# - "Current executable" will build the current target you have selected in
26-
# Qt Creator - for client/cli/daemon this builds the staging area, but for
27-
# integtest or unit tests it will build the test instead
28-
# If you select "stage", Qt Creator will still know how to build tests, etc.
29-
# if they are started or debugged from the IDE.
23+
# - Select "Current Executable" instead of "all"
24+
# Now Qt Creator will build whatever target you have chosen to run.
3025
#
3126
# Some ancillary targets (Windows installer, Mac OpenVPN helpers, etc.) aren't
3227
# modeled in CMake currently (but could be added if needed).
33-
#
34-
# All the source files are _not_ indicated to CMake - Qt Creator is able to find
35-
# them without this, and CMake would spew lots of output pretending to compile
36-
# those files. Qt Creator's "project" view won't show all the source files;
37-
# just use the "filesystem" view instead, PIA Desktop's source is organized by
38-
# component already.
3928

4029
cmake_minimum_required(VERSION 3.10)
4130
project(pia_desktop)
@@ -46,19 +35,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
4635
set(CMAKE_AUTOGEN OFF) # suppress CMake moc/rcc rules
4736
find_package(Qt5 COMPONENTS Core Quick Network Qml Quick QuickControls2 Gui Test REQUIRED)
4837

49-
include_directories(
50-
cli/src
51-
client/src
52-
clientlib/src
53-
common/src
54-
common/src/builtin
55-
daemon/src
56-
deps/embeddable-wg-library/src
57-
extras/installer/mac/helper
58-
integtest/src
59-
tests/src
60-
)
61-
6238
file(GLOB CLIENT_RES "client/res/**/*")
6339
file(GLOB SUPPORTTOOL_COMPONENTS "extras/support-tool/components/**/*")
6440

@@ -103,10 +79,23 @@ endfunction()
10379
# dependencies.
10480
add_custom_command(OUTPUT always_build COMMAND ${CMAKE_COMMAND} -E echo)
10581

106-
set_for_platform(RAKE "rake.cmd" "rake" "rake")
82+
set_for_platform(RAKE "rake.bat" "rake" "rake")
83+
84+
include_directories(
85+
./
86+
kapps_core/api/
87+
kapps_net/api/
88+
kapps_regions/api/
89+
out/${BRAND}_${RAKE_VARIANT}_x86_64/probe-version
90+
deps/jsonmcpp/include/
91+
deps/embeddable-wg-library/src/
92+
deps/lzma/src/
93+
)
10794

10895
function(rake_target cmakeName rakeName)
109-
add_custom_target(${cmakeName} ${CMAKE_COMMAND} -E env "RUBYOPT=-Eutf-8" ${RAKE} -j16 VARIANT=${RAKE_VARIANT} BRAND=${BRAND} ${rakeName}
96+
# Qt Creator now seems to set a PLATFORM variable that conflicts with the
97+
# one expected by our build system, clear it when running rake
98+
add_custom_target(${cmakeName} ${CMAKE_COMMAND} -E env "RUBYOPT=-Eutf-8" "PLATFORM=" ${RAKE} -j16 VARIANT=${RAKE_VARIANT} BRAND=${BRAND} ${rakeName}
11099
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
111100
DEPENDS always_build USES_TERMINAL)
112101
endfunction()
@@ -147,6 +136,11 @@ set_for_platform(RAKE_STAGE_BIN
147136
"${RAKE_OUT}/stage/${BRAND_NAME}.app/Contents/MacOS"
148137
"${RAKE_OUT}/stage/bin"
149138
)
139+
set_for_platform(RAKE_STAGE_LIB
140+
"${RAKE_OUT}/stage"
141+
"${RAKE_OUT}/stage/${BRAND_NAME}.app/Contents/Frameworks"
142+
"${RAKE_OUT}/stage/lib"
143+
)
150144
set_for_platform(RAKE_INTEGTEST_BIN
151145
"${RAKE_OUT}/integtest-stage/${BRAND}-integtest"
152146
"${RAKE_OUT}/integtest-stage/${BRAND}-integtest.app/Contents/MacOS"
@@ -158,25 +152,78 @@ set_for_platform(RAKE_INTEGTEST_BIN
158152
# clean task does anyway.
159153
set_property(DIRECTORY PROPERTY ADDITIONAL_CLEAN_FILES ${RAKE_OUT})
160154

161-
function(stage_target name sourceFile execWin execMac execLinux)
162-
add_executable(${name} EXCLUDE_FROM_ALL ${sourceFile})
155+
function(source_files name sourceDirectory)
156+
aux_source_directory("${sourceDirectory}/src" TARGET_SOURCE_GENERAL_${name})
157+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
158+
aux_source_directory("${sourceDirectory}/src/win" TARGET_SOURCE_PLATFORM_${name})
159+
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
160+
aux_source_directory("${sourceDirectory}/src/mac" TARGET_SOURCE_PLATFORM_${name})
161+
aux_source_directory("${sourceDirectory}/src/posix" TARGET_SOURCE_POSIX_${name})
162+
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
163+
aux_source_directory("${sourceDirectory}/src/linux" TARGET_SOURCE_PLATFORM_${name})
164+
aux_source_directory("${sourceDirectory}/src/posix" TARGET_SOURCE_POSIX_${name})
165+
endif()
166+
set(TARGET_SOURCE_${name} ${TARGET_SOURCE_GENERAL_${name}}
167+
${TARGET_SOURCE_PLATFORM_${name}} ${TARGET_SOURCE_POSIX_${name}}
168+
PARENT_SCOPE)
169+
endfunction()
170+
171+
# Define a library target in the stage directory
172+
function(stage_lib name sourceDirectory libName)
173+
source_files(${name} ${sourceDirectory})
174+
add_library(${name} SHARED ${TARGET_SOURCE_${name}})
175+
set_for_platform(TARGET_FILE "${libName}.dll" "${libName}.dylib" "${libName}.so")
176+
set_property(TARGET ${name} PROPERTY OUTPUT_NAME ${TARGET_FILE})
177+
add_dependencies(${name} stage)
178+
set_property(TARGET ${name} PROPERTY LIBRARY_OUTPUT_DIRECTORY ${RAKE_STAGE_LIB})
179+
list(APPEND ALL_LIB_TARGETS ${name})
180+
endfunction()
181+
182+
# Define a kapps library (these have a consistent convention for target name,
183+
# source directory, and lib name, the few non-kapps libraries aren't all
184+
# consistent)
185+
function(stage_kapps_lib kappsName)
186+
stage_lib("kapps_${kappsName}" "kapps_${kappsName}" "kapps_${kappsName}")
187+
endfunction()
188+
189+
# Define an executable target in the stage directory
190+
function(stage_target name sourceDirectory execWin execMac execLinux)
191+
source_files(${name} ${sourceDirectory})
192+
add_executable(${name} EXCLUDE_FROM_ALL "${TARGET_SOURCE_${name}}")
163193
set_for_platform(TARGET_FILE ${execWin} ${execMac} ${execLinux})
164194
set_property(TARGET ${name} PROPERTY OUTPUT_NAME ${TARGET_FILE})
165195
add_dependencies(${name} stage)
166196
set_property(TARGET ${name} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${RAKE_STAGE_BIN})
197+
# Let Qt Creator assume that all executables depend on all libraries. This
198+
# is crude but is sufficient for the code model to work.
199+
target_link_libraries(${name} ${ALL_LIB_TARGETS})
167200
endfunction()
168201

169-
stage_target(cli cli/src/cli.cpp "${BRAND}ctl" "${BRAND}ctl" "${BRAND}ctl")
202+
# Define all libraries
203+
stage_kapps_lib(core)
204+
stage_kapps_lib(net)
205+
stage_kapps_lib(regions)
206+
stage_lib(common common "${BRAND}-commonlib")
207+
stage_lib(clientlib clientlib "${BRAND}-clientlib")
208+
209+
stage_target(cli cli "${BRAND}ctl" "${BRAND}ctl" "${BRAND}ctl")
170210
target_link_libraries(cli Qt5::Core Qt5::Network)
171211

172-
stage_target(client client/src/main.cpp "${BRAND}-client" ${BRAND_NAME} "${BRAND}-client")
212+
stage_target(client client "${BRAND}-client" ${BRAND_NAME} "${BRAND}-client")
173213
target_link_libraries(client Qt5::Core Qt5::Network Qt5::Qml Qt5::Quick Qt5::QuickControls2 Qt5::Gui)
214+
# Annoyingly, Qt's CMake support only permits listing resources via a QRC file.
215+
# The rake build system (like qbs) allows picking up resources automatically
216+
# so we don't have to repeat them all in the build script.
217+
# Use the generated QRC file, although this means a build must be performed for
218+
# Qt Creator to find QML sources.
219+
target_sources(client PRIVATE "${RAKE_OUT}/pia-client/qrc_pia-client.qrc")
174220

175-
stage_target(daemon daemon/src/daemon.cpp "${BRAND}-service" "${BRAND}-daemon" "${BRAND}-daemon")
221+
stage_target(daemon daemon "${BRAND}-service" "${BRAND}-daemon" "${BRAND}-daemon")
176222
target_link_libraries(daemon Qt5::Core Qt5::Network)
177223

178-
add_executable(integtest EXCLUDE_FROM_ALL integtest/src/integtest.cpp)
179-
target_link_libraries(integtest Qt5::Core Qt5::Network Qt5::Test)
224+
source_files(integtest integtest)
225+
add_executable(integtest EXCLUDE_FROM_ALL ${TARGET_SOURCE_integtest})
226+
target_link_libraries(integtest Qt5::Core Qt5::Network Qt5::Test ${ALL_LIB_TARGETS})
180227
set_property(TARGET integtest PROPERTY OUTPUT_NAME "${BRAND}-integtest")
181228
add_dependencies(integtest integtest-stage)
182229
set_property(TARGET integtest PROPERTY RUNTIME_OUTPUT_DIRECTORY ${RAKE_INTEGTEST_BIN})
@@ -190,13 +237,15 @@ function(unit_test name)
190237
add_dependencies(${TESTNAME} "rake-${TESTNAME}")
191238
endfunction()
192239

240+
unit_test("any")
193241
unit_test("apiclient")
194242
unit_test("check")
195243
unit_test("connectionconfig")
196244
unit_test("exec")
197245
unit_test("json")
198246
unit_test("jsonrefresher")
199247
unit_test("jsonrpc")
248+
unit_test("jsonstate")
200249
unit_test("latencytracker")
201250
unit_test("linebuffer")
202251
unit_test("localsockets")
@@ -210,14 +259,18 @@ unit_test("openssl")
210259
unit_test("path")
211260
unit_test("portforwarder")
212261
unit_test("raii")
262+
unit_test("regionlist")
263+
unit_test("retainshared")
213264
unit_test("semversion")
265+
unit_test("servicegroup")
214266
unit_test("settings")
215267
unit_test("subnetbypass")
216268
unit_test("tasks")
217269
unit_test("transportselector")
218270
unit_test("updatedownloader")
219271
unit_test("vpnmethod")
220272
unit_test("wireguarduapi")
273+
unit_test("workthread")
221274

222275
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
223276
unit_test("wfp_filters")

Gemfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'rake'
4+
gem 'pry', '~> 0.14'
5+
gem 'rspec', '~> 3.11', require: false, group: :test
6+
gem 'simplecov', require: false, group: :test
7+
gem 'nokogiri'

KAPPS-LIBS.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# KApps libraries
2+
3+
The KApps libraries are modules used by PIA Desktop that also expose C-linkage public APIs. These do not depend on Qt and are not brand-specific.
4+
5+
A simple application using the logger and some sample APIs is included in `pia_desktop/tools/kapps-lib-test`.
6+
7+
## Product integration
8+
9+
To incorporate these libraries in your build process:
10+
11+
* add inc/ from the library artifact to your header include directories
12+
* add lib/ from the library artifact to your library search path (and bin/ on Windows)
13+
* include headers like `<kapps_core/logger.h>`, `<kapps_net/firewall.h>` as needed
14+
* link to `kapps_core`, `kapps_net`, etc.
15+
* ship the dynamic libraries with your product
16+
17+
## Supportability
18+
19+
To troubleshoot field issues should they occur, be sure you:
20+
21+
* capture debug logging from the libraries using the logger API in kapps_core
22+
* on Windows, preserve PDB symbol files needed to analyze crash dumps
23+
24+
### Logging
25+
26+
Enable debug logging and configure a debug log message callback to consume debug messages. Capture these messages with your program's debug logging. Note that the callback can be invoked on any thread, including APC threads on Windows, but that invocations are serialized by the logger's mutex.
27+
28+
Simple example from kapps-lib-test:
29+
30+
```
31+
void initLogging()
32+
{
33+
// Enable logging and set up a logging sink (using the C-linkage public API)
34+
::DtopCoreEnableLogging(true);
35+
// Use our log sink as the callback. We don't need any context in this
36+
// example.
37+
::DtopCoreLogCallback sinkCallback{};
38+
sinkCallback.pWriteFn = &writeLogMsg;
39+
// DtopCoreLogInit copies the callback struct, so we can safely let
40+
// sinkCallback be destroyed
41+
::DtopCoreLogInit(&sinkCallback);
42+
}
43+
```
44+
45+
See kapps-lib-test for more details, including a sample message callback, and see kapps_core/logger.h for more information on the logger APIs.
46+
47+
### Debug symbols
48+
49+
PDB symbol files are included in the library artifact on Windows. These don't have to be shipped with the application, but should be preserved for later postmortem dump debugging should problems occur.
50+
51+
## Building
52+
53+
To build the libraries, set up the pia_desktop build environment as detailed in pia_desktop/README.md. `rake libs` builds all libs and the output artifact; `rake tools` builds all tools including the test application.
54+
55+
Currently, Qt is still needed for the build process, as the MSVC toolchain selection in the build scripts selects the same version of MSVC as was used to build Qt. This requirement could probably be relaxed with some build refactoring.

0 commit comments

Comments
 (0)