mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-12-04 06:01:26 +09:00
Compare commits
423
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44b0cf17c0 | ||
|
|
c499b838db | ||
|
|
3fad6bebfb | ||
|
|
4701345b5f | ||
|
|
274c9b6e36 | ||
|
|
c6ef64a67c | ||
|
|
a1f1c91f48 | ||
|
|
4dafd33929 | ||
|
|
be5f13c034 | ||
|
|
8072667f60 | ||
|
|
76bc25d6d8 | ||
|
|
bc781477a2 | ||
|
|
1d307ad4f3 | ||
|
|
9791dd190e | ||
|
|
4f0fa34449 | ||
|
|
b7edabadb9 | ||
|
|
c71e65d9cd | ||
|
|
5aff2ce580 | ||
|
|
41a6757042 | ||
|
|
f0b12257ab | ||
|
|
762f61cea3 | ||
|
|
1efeab81b6 | ||
|
|
a9e6a2222c | ||
|
|
5c732f6edc | ||
|
|
2bd60309d0 | ||
|
|
0514a5d5b1 | ||
|
|
c6af4cc266 | ||
|
|
62a8a79931 | ||
|
|
f15932bf22 | ||
|
|
8165462865 | ||
|
|
864c1faab8 | ||
|
|
3a6bf7376c | ||
|
|
ba402f898a | ||
|
|
b7cc397fee | ||
|
|
7def06c561 | ||
|
|
7e9dd0a588 | ||
|
|
31463516ac | ||
|
|
ac175c8a81 | ||
|
|
3f6ecacff1 | ||
|
|
7f9b7db482 | ||
|
|
27b4feda9c | ||
|
|
6c0e62753d | ||
|
|
da8ce1809b | ||
|
|
9887a0a04c | ||
|
|
94ea5b00aa | ||
|
|
688c71e385 | ||
|
|
c18f7773e3 | ||
|
|
6d5f10947a | ||
|
|
95501dba35 | ||
|
|
4cacfb41ab | ||
|
|
8a51177a44 | ||
|
|
3121775a6f | ||
|
|
3977447d4a | ||
|
|
bf95867a7c | ||
|
|
a55ef420e8 | ||
|
|
3b5a93889f | ||
|
|
02838a94d5 | ||
|
|
9a1200d6f3 | ||
|
|
ddde43635e | ||
|
|
ffba1cb2a4 | ||
|
|
30ff3451c7 | ||
|
|
db951e9928 | ||
|
|
a36399a4c3 | ||
|
|
8940f8e273 | ||
|
|
705a373d51 | ||
|
|
3d4a45246a | ||
|
|
11355e1de0 | ||
|
|
3e8077f2ca | ||
|
|
c52b1a50a8 | ||
|
|
2c0f169946 | ||
|
|
693d00ded5 | ||
|
|
f1af8efb4b | ||
|
|
4c2e950864 | ||
|
|
9017984b1d | ||
|
|
c5ecf6281f | ||
|
|
3e9b70a5f1 | ||
|
|
94b51df247 | ||
|
|
de93650a90 | ||
|
|
448baad3e1 | ||
|
|
aca1b7dc5c | ||
|
|
de36a81b58 | ||
|
|
76b81b43c1 | ||
|
|
bea2f5f7db | ||
|
|
a4d38b5642 | ||
|
|
b76c88bba3 | ||
|
|
eab14fd957 | ||
|
|
2a8242d306 | ||
|
|
e60842bd9d | ||
|
|
327e5985df | ||
|
|
124da5a499 | ||
|
|
2ee02bc893 | ||
|
|
398697c101 | ||
|
|
c8810dde5f | ||
|
|
9a7db3475f | ||
|
|
628dd5b6d3 | ||
|
|
71b99c799c | ||
|
|
0643a2424b | ||
|
|
dedfc08cc2 | ||
|
|
dddc181299 | ||
|
|
5689706fd9 | ||
|
|
5501fbd54e | ||
|
|
fc4bf3eb2b | ||
|
|
c8722c619a | ||
|
|
4c5bb29ab0 | ||
|
|
4976828914 | ||
|
|
5d74b2cbcf | ||
|
|
7072661244 | ||
|
|
7d4f3e0f50 | ||
|
|
b1a37b3779 | ||
|
|
86ae77e3d0 | ||
|
|
541a6e07d6 | ||
|
|
f135400d3b | ||
|
|
da184c0ddf | ||
|
|
4116c5c4bc | ||
|
|
667d98f7d7 | ||
|
|
44c10b39e3 | ||
|
|
e4b7e09f86 | ||
|
|
04c2b2af33 | ||
|
|
e643fa008c | ||
|
|
b575df05c7 | ||
|
|
85bd102efa | ||
|
|
717323f138 | ||
|
|
8ed7a5a1d3 | ||
|
|
6ece4e0ac5 | ||
|
|
9d45f3d7ad | ||
|
|
dcf53b989e | ||
|
|
e27f74e4fc | ||
|
|
dbe1a06e35 | ||
|
|
d251d5f0ac | ||
|
|
d702dc0b2a | ||
|
|
2ad6721061 | ||
|
|
0d116bfc67 | ||
|
|
25a18bdf97 | ||
|
|
f73697d3f4 | ||
|
|
53121f20a3 | ||
|
|
d6cb9b930f | ||
|
|
c4b3ccacc9 | ||
|
|
e38a233904 | ||
|
|
9b0495f5e1 | ||
|
|
30ec46a567 | ||
|
|
4055e1b05e | ||
|
|
4d28f81965 | ||
|
|
5c035bb6cf | ||
|
|
26c22327af | ||
|
|
5e9def4184 | ||
|
|
a98c60d967 | ||
|
|
0faf3e6d2f | ||
|
|
a32a26bb67 | ||
|
|
431ece7fff | ||
|
|
5e82c6a558 | ||
|
|
84a2d13b68 | ||
|
|
324b09cca3 | ||
|
|
e70563a071 | ||
|
|
bc2a0ca649 | ||
|
|
3c6ac431b4 | ||
|
|
e96a2b171c | ||
|
|
06d219b92b | ||
|
|
28c77e570b | ||
|
|
6691d2e21c | ||
|
|
c7b5ee1867 | ||
|
|
e4127f47f3 | ||
|
|
4b4563818e | ||
|
|
dbb43272e6 | ||
|
|
5e70eb20c9 | ||
|
|
15176cd3ae | ||
|
|
25df36ad73 | ||
|
|
ea8e3fda56 | ||
|
|
31ae949ba0 | ||
|
|
a17847a90b | ||
|
|
2ca497cd06 | ||
|
|
bd003b149d | ||
|
|
35c1014a44 | ||
|
|
27857cde8a | ||
|
|
b39f583097 | ||
|
|
6c7b65cac6 | ||
|
|
0f6847219b | ||
|
|
5d16645b84 | ||
|
|
203a092dc9 | ||
|
|
d8b8590bc4 | ||
|
|
9b8bfaa6f8 | ||
|
|
890103a16a | ||
|
|
56ab82f87f | ||
|
|
3984acbb44 | ||
|
|
cc404378f9 | ||
|
|
594635e5cf | ||
|
|
f9b106cf5b | ||
|
|
a9861d18b7 | ||
|
|
c14138f031 | ||
|
|
60686fde24 | ||
|
|
bd0747296e | ||
|
|
ba61019a50 | ||
|
|
113f967006 | ||
|
|
bcee58b08b | ||
|
|
52de1acebf | ||
|
|
027a12a1df | ||
|
|
0a659a2d74 | ||
|
|
6f119cd083 | ||
|
|
1753aed3fc | ||
|
|
c714d98bd1 | ||
|
|
4787f3915b | ||
|
|
7a383116b2 | ||
|
|
d3de5f0f48 | ||
|
|
8749d683e3 | ||
|
|
9de9d082bc | ||
|
|
a4233fef41 | ||
|
|
4890dd1d74 | ||
|
|
564630827e | ||
|
|
fbe15d965b | ||
|
|
b29515c380 | ||
|
|
0658a8f565 | ||
|
|
482ec04b4a | ||
|
|
d40d24fcf9 | ||
|
|
fb5666057b | ||
|
|
a49892c7e7 | ||
|
|
277b295fd8 | ||
|
|
8c33779fc3 | ||
|
|
f0299ca9fe | ||
|
|
c7b1c2809f | ||
|
|
c9ed0baf3b | ||
|
|
2a3e3126ac | ||
|
|
98771027b7 | ||
|
|
0433e03bdc | ||
|
|
cb48667b91 | ||
|
|
d0a1af0381 | ||
|
|
fd0c773918 | ||
|
|
06372c8fd7 | ||
|
|
009ca981d5 | ||
|
|
c0cae0ff01 | ||
|
|
c28452a5da | ||
|
|
396ce23228 | ||
|
|
b05ee0a654 | ||
|
|
fd5051262d | ||
|
|
847bb6923b | ||
|
|
2edd7de413 | ||
|
|
f0da2b003f | ||
|
|
650c1c6ebb | ||
|
|
8dbded1624 | ||
|
|
cebfcc846e | ||
|
|
4c18ceaa50 | ||
|
|
ebe3a5dac6 | ||
|
|
92deee5f67 | ||
|
|
a75bd0cf5e | ||
|
|
46f5b3894b | ||
|
|
493ee22883 | ||
|
|
ad14847eb5 | ||
|
|
cd50e0b8a5 | ||
|
|
78f504e35c | ||
|
|
bf3d11e5c4 | ||
|
|
9a0222aee3 | ||
|
|
f0f0f7c5be | ||
|
|
36b1a863bf | ||
|
|
4103c5bbcf | ||
|
|
fa69da6d56 | ||
|
|
aaf2c9ddeb | ||
|
|
dbbc7119ec | ||
|
|
c57162c4cc | ||
|
|
40e39895c9 | ||
|
|
ec3ab2a03c | ||
|
|
ddecfcad26 | ||
|
|
67bd880cdf | ||
|
|
477afb9d85 | ||
|
|
f969fcdbb8 | ||
|
|
b0ca16d861 | ||
|
|
9963359948 | ||
|
|
ca639d293d | ||
|
|
83d045af64 | ||
|
|
aea8ff4961 | ||
|
|
1892db4375 | ||
|
|
c86a641e05 | ||
|
|
befb2bf19a | ||
|
|
7ad6bc340c | ||
|
|
9164e38c34 | ||
|
|
8f7559f01b | ||
|
|
af56200735 | ||
|
|
3874050fae | ||
|
|
3087163e34 | ||
|
|
1fa152845c | ||
|
|
50e23ef233 | ||
|
|
ea648466de | ||
|
|
b782775016 | ||
|
|
89a7fe1081 | ||
|
|
e8bb096025 | ||
|
|
fd5c7c8322 | ||
|
|
e798d0f503 | ||
|
|
bbb0abb596 | ||
|
|
0925aec86a | ||
|
|
b084c4c284 | ||
|
|
87288ebccd | ||
|
|
fcd7eadf4c | ||
|
|
0373338fb7 | ||
|
|
42f070fe9d | ||
|
|
02be6dc5f9 | ||
|
|
bfcf7f0305 | ||
|
|
2bce595ade | ||
|
|
cd1e561fd4 | ||
|
|
9bd1e6a0f5 | ||
|
|
5058c9aa6f | ||
|
|
d78416835c | ||
|
|
40e6c6aae3 | ||
|
|
911a999c64 | ||
|
|
b4f4184aa6 | ||
|
|
5c6db4b7a4 | ||
|
|
f6277cdbb2 | ||
|
|
99312e61d3 | ||
|
|
9f0ae75a2f | ||
|
|
7960d8015d | ||
|
|
5dcc64e5e5 | ||
|
|
964436ad43 | ||
|
|
4fc3900fd5 | ||
|
|
8f5e42dd61 | ||
|
|
24895752c1 | ||
|
|
87eccfb4ca | ||
|
|
a983d0504e | ||
|
|
d0b8535395 | ||
|
|
f84480cf56 | ||
|
|
de7a026ec1 | ||
|
|
a128c7d247 | ||
|
|
f316f0e25a | ||
|
|
ea5242e29b | ||
|
|
b31a62c55f | ||
|
|
02e3107a23 | ||
|
|
1862850108 | ||
|
|
f73792844c | ||
|
|
a7199ca6f5 | ||
|
|
5e757cdd3b | ||
|
|
92af1f3268 | ||
|
|
aad9d6dae2 | ||
|
|
423fe3fd4f | ||
|
|
b591dd7445 | ||
|
|
a45bb5ea4f | ||
|
|
d859b111ca | ||
|
|
52031efc48 | ||
|
|
d78202c612 | ||
|
|
6bac948633 | ||
|
|
a4c4ef71fb | ||
|
|
127f85f4f0 | ||
|
|
13d4ddd292 | ||
|
|
7265e09c85 | ||
|
|
2e629b6dac | ||
|
|
92aba49705 | ||
|
|
bec06b3a5e | ||
|
|
91cd9474ea | ||
|
|
6178b05643 | ||
|
|
46ce22b85c | ||
|
|
36edafb985 | ||
|
|
d77eaba500 | ||
|
|
6a3d43fbb0 | ||
|
|
4975955bbe | ||
|
|
8f508783e3 | ||
|
|
f50817c43c | ||
|
|
54f67b3d82 | ||
|
|
d669adb707 | ||
|
|
5103bc640e | ||
|
|
3e6f0c0342 | ||
|
|
40950b92ee | ||
|
|
ac77b4ee75 | ||
|
|
fbf652f818 | ||
|
|
bbbf4891e6 | ||
|
|
20d005d66c | ||
|
|
c81ae2b060 | ||
|
|
105c42db1c | ||
|
|
89818ff63d | ||
|
|
414c422177 | ||
|
|
b39ac8556c | ||
|
|
5e1742262d | ||
|
|
5a07a1274f | ||
|
|
7b8ff1fd6e | ||
|
|
c7221832e0 | ||
|
|
eb7d031c7d | ||
|
|
3b3a0aaceb | ||
|
|
01ec79b7d5 | ||
|
|
3d6339e2dd | ||
|
|
b4d78d865a | ||
|
|
b53cdcff08 | ||
|
|
3cc18c5807 | ||
|
|
5fdce1e49e | ||
|
|
2ee61a040b | ||
|
|
741b5cc0f9 | ||
|
|
aaf0e070dc | ||
|
|
e0e126eda8 | ||
|
|
236daf6b3b | ||
|
|
f1481b1b1f | ||
|
|
f6e7d3ccf1 | ||
|
|
a754a11913 | ||
|
|
4d25e3b6f6 | ||
|
|
1fac280497 | ||
|
|
c886c5e6a7 | ||
|
|
cd7f78b9ca | ||
|
|
a587d3230f | ||
|
|
93e7b45136 | ||
|
|
e024f71ce1 | ||
|
|
50d1be7b4a | ||
|
|
3ec6d8973b | ||
|
|
3ea47d31a9 | ||
|
|
30c8cc4548 | ||
|
|
98586d2dd9 | ||
|
|
c66d8ecca0 | ||
|
|
db535f7e7d | ||
|
|
89f30d8c31 | ||
|
|
8bce432824 | ||
|
|
f3539b2632 | ||
|
|
7a96c212f3 | ||
|
|
2d5dc54e0f | ||
|
|
cef4c262e9 | ||
|
|
34309261a8 | ||
|
|
657eeb40c7 | ||
|
|
b4938c2cc9 | ||
|
|
524fefc5cb | ||
|
|
73f13404bb | ||
|
|
5fc68cca83 | ||
|
|
fcb7b8fa8d | ||
|
|
a81e32ff95 | ||
|
|
c897052107 | ||
|
|
4d0efc7ea5 | ||
|
|
a77842c9e3 | ||
|
|
0ded9db780 | ||
|
|
58d480fcb5 | ||
|
|
7154428d26 | ||
|
|
02a52d0169 | ||
|
|
ec60764072 | ||
|
|
17d2fa5532 | ||
|
|
3ca8b534e8 | ||
|
|
e88f7c5e46 |
No files matched your search
@@ -2,7 +2,7 @@
|
||||
/client/3rd-prebuild
|
||||
/client/android
|
||||
/client/cmake
|
||||
/client/core/serialization
|
||||
/client/core/utils/serialization
|
||||
/client/daemon
|
||||
/client/fonts
|
||||
/client/images
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
# .github/actions/apple-install-cert/action.yml
|
||||
|
||||
name: Setup apple keychain
|
||||
description: Creates and configures a temporary build keychain
|
||||
|
||||
inputs:
|
||||
keychain-path:
|
||||
description: Path to the keychain
|
||||
required: true
|
||||
keychain-password:
|
||||
description: Password to the keychain
|
||||
required: true
|
||||
cert-base64:
|
||||
description: Base64-encoded certificate
|
||||
required: true
|
||||
cert-password:
|
||||
description: Certificate password
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Create keychain
|
||||
shell: bash
|
||||
env:
|
||||
KEYCHAIN_PATH: ${{ inputs.keychain-path }}
|
||||
KEYCHAIN_PASSWORD: ${{ inputs.keychain-password }}
|
||||
CERT_BASE64: ${{ inputs.cert-base64 }}
|
||||
CERT_PASSWORD: ${{ inputs.cert-password }}
|
||||
run: |
|
||||
CERT_PATH=$(mktemp /tmp/cert_XXXXXX.p12)
|
||||
trap "rm -f '$CERT_PATH'" EXIT
|
||||
|
||||
echo -n "$CERT_BASE64" | base64 --decode -o "$CERT_PATH"
|
||||
|
||||
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
|
||||
security import "$CERT_PATH" -k "$KEYCHAIN_PATH" -P "$CERT_PASSWORD" -A -t cert -f pkcs12
|
||||
security set-key-partition-list -S apple-tool:,apple:,codesign: -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
|
||||
Binary file not shown.
File renamed without changes.
@@ -0,0 +1,57 @@
|
||||
# .github/actions/apple-setup-keychain/action.yml
|
||||
|
||||
name: Setup apple keychain
|
||||
description: Creates and configures a temporary build keychain
|
||||
|
||||
inputs:
|
||||
keychain-name:
|
||||
description: Name of the keychain
|
||||
required: false
|
||||
default: "ci-amnezia"
|
||||
keychain-password:
|
||||
description: The keychain password
|
||||
required: true
|
||||
lock-timeout:
|
||||
description: A timeout after exceeding which the keychain would be locked
|
||||
required: false
|
||||
default: "0"
|
||||
|
||||
outputs:
|
||||
keychain-path:
|
||||
description: "Full path to the keychain created"
|
||||
value: ${{ steps.setup.outputs.keychain-path }}
|
||||
keychain-name:
|
||||
description: "Actual name of the keychain created"
|
||||
value: ${{ steps.setup.outputs.keychain-name }}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Setup keychain
|
||||
id: setup
|
||||
shell: bash
|
||||
env:
|
||||
KEYCHAIN_NAME: ${{ inputs.keychain-name }}
|
||||
KEYCHAIN_PASSWORD: ${{ inputs.keychain-password }}
|
||||
LOCK_TIMEOUT: ${{ inputs.lock-timeout }}
|
||||
run: |
|
||||
KEYCHAIN_PATH="$HOME/Library/Keychains/$KEYCHAIN_NAME.keychain-db"
|
||||
|
||||
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
|
||||
|
||||
if [[ "$LOCK_TIMEOUT" == "0" ]]; then
|
||||
security set-keychain-settings "$KEYCHAIN_PATH"
|
||||
else
|
||||
security set-keychain-settings -u -t "$LOCK_TIMEOUT" "$KEYCHAIN_PATH"
|
||||
fi
|
||||
|
||||
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
|
||||
|
||||
security import "${{ github.action_path }}/DeveloperIDG2CA.cer" -k "$KEYCHAIN_PATH" -A
|
||||
security import "${{ github.action_path }}/AppleWWDRCAG3.cer" -k "$KEYCHAIN_PATH" -A
|
||||
|
||||
security list-keychains -d user -s "$KEYCHAIN_PATH"
|
||||
security default-keychain -s "$KEYCHAIN_PATH"
|
||||
|
||||
echo "keychain-name=$KEYCHAIN_NAME" >> $GITHUB_OUTPUT
|
||||
echo "keychain-path=$KEYCHAIN_PATH" >> $GITHUB_OUTPUT
|
||||
@@ -0,0 +1,36 @@
|
||||
# .github/actions/apple-setup-provisioning-profile/action.yml
|
||||
|
||||
name: Setup provisioning profiles
|
||||
description: Decodes and installs provisioning profiles
|
||||
|
||||
inputs:
|
||||
provisioning_profile_base64:
|
||||
description: Base64-encoded provisioning profile
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Setup provisioning profile
|
||||
shell: bash
|
||||
run: |
|
||||
TEMP_FILE=$(mktemp)
|
||||
|
||||
echo "${{ inputs.provisioning_profile_base64 }}" | base64 --decode > "$TEMP_FILE"
|
||||
|
||||
PROFILE_UUID=$(grep UUID -A1 -a "$TEMP_FILE" | grep -io "[-A-F0-9]\{36\}")
|
||||
if [[ -z "$PROFILE_UUID" ]]; then
|
||||
echo "Failed to extract UUID from provisioning profile"
|
||||
rm -f "$TEMP_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PROFILE_EXTENSION=mobileprovision
|
||||
grep -aq "<string>OSX</string>" "$TEMP_FILE" && PROFILE_EXTENSION=provisionprofile
|
||||
|
||||
for PROFILES_DIR in "$HOME/Library/MobileDevice/Provisioning Profiles" "$HOME/Library/Developer/Xcode/UserData/Provisioning Profiles"; do
|
||||
mkdir -p "$PROFILES_DIR"
|
||||
cp "$TEMP_FILE" "$PROFILES_DIR/$PROFILE_UUID.$PROFILE_EXTENSION"
|
||||
done
|
||||
rm -f "$TEMP_FILE"
|
||||
echo "Installed profile: $PROFILE_UUID.$PROFILE_EXTENSION"
|
||||
@@ -0,0 +1,23 @@
|
||||
## Version differences
|
||||
|
||||
### Android
|
||||
* For Android version 11 and higher, you need to use .apk that start with - AmneziaVPN_${VERSION}_android11+
|
||||
* For Android version 9-10, you need to use .apk that start with - AmneziaVPN_${VERSION}_android9-10
|
||||
* ***The app version for Android 7 and 8 is temporarily unavailable***
|
||||
|
||||
### macOS
|
||||
!!! The previous version (4.8.8.2 and lower) of the application (installed via the .dmg installer) must be uninstalled via “move to bin” in the applications folder
|
||||
|
||||
* For macOS version 13 and higher, you need to use .pkg - AmneziaVPN_${VERSION}_macos.pkg
|
||||
* ***The app version for macOS 10.15 - 12, is temporarily unavailable***
|
||||
|
||||
### Linux
|
||||
For Ubuntu you need to install xcb plugin:
|
||||
apt install libxcb-cursor0 libxcb-xinerama0 libxcb-icccm4 libxcb-keysyms1 libopengl0 libxkbcommon-x11-0
|
||||
|
||||
## Changelog
|
||||
|
||||
### General
|
||||
* Improve stability
|
||||
|
||||
**Full Changelog**: https://github.com/amnezia-vpn/amnezia-client/compare/${PREVIOUS_TAG}...${VERSION}
|
||||
+1554
-350
File diff suppressed because it is too large.
Load diff
@@ -15,11 +15,12 @@ jobs:
|
||||
env:
|
||||
QT_VERSION: 6.4.1
|
||||
QIF_VERSION: 4.5
|
||||
PROD_AGW_PUBLIC_KEY: ${{ secrets.PROD_AGW_PUBLIC_KEY }}
|
||||
PROD_AGW_PUBLIC_KEY_B64: ${{ secrets.PROD_AGW_PUBLIC_KEY_B64 }}
|
||||
PROD_S3_ENDPOINT: ${{ secrets.PROD_S3_ENDPOINT }}
|
||||
DEV_AGW_PUBLIC_KEY: ${{ secrets.DEV_AGW_PUBLIC_KEY }}
|
||||
DEV_AGW_ENDPOINT: ${{ secrets.DEV_AGW_ENDPOINT }}
|
||||
DEV_S3_ENDPOINT: ${{ secrets.DEV_S3_ENDPOINT }}
|
||||
FALLBACK_S3_ENDPOINT: ${{ secrets.FALLBACK_S3_ENDPOINT }}
|
||||
SANDBOX_AGW_PUBLIC_KEY_B64: ${{ secrets.SANDBOX_AGW_PUBLIC_KEY_B64 }}
|
||||
SANDBOX_AGW_ENDPOINT: ${{ secrets.SANDBOX_AGW_ENDPOINT }}
|
||||
SANDBOX_S3_ENDPOINT: ${{ secrets.SANDBOX_S3_ENDPOINT }}
|
||||
FREE_V2_ENDPOINT: ${{ secrets.FREE_V2_ENDPOINT }}
|
||||
PREM_V1_ENDPOINT: ${{ secrets.PREM_V1_ENDPOINT }}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ jobs:
|
||||
- name: Verify git tag
|
||||
run: |
|
||||
TAG_NAME=${{ inputs.RELEASE_VERSION }}
|
||||
CMAKE_TAG=$(grep 'project.*VERSION' CMakeLists.txt | sed -E 's/.* ([0-9]+.[0-9]+.[0-9]+.[0-9]+)$/\1/')
|
||||
CMAKE_TAG=$(grep 'set(AMNEZIAVPN_VERSION' CMakeLists.txt | sed -E 's/.*AMNEZIAVPN_VERSION ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+).*/\1/')
|
||||
if [[ "$TAG_NAME" == "$CMAKE_TAG" ]]; then
|
||||
echo "Git tag ($TAG_NAME) matches CMakeLists.txt version ($CMAKE_TAG)."
|
||||
else
|
||||
|
||||
@@ -9,6 +9,9 @@ deploy/build_32/*
|
||||
deploy/build_64/*
|
||||
winbuild*.bat
|
||||
.cache/
|
||||
.vscode/
|
||||
.venv/
|
||||
.cursor*
|
||||
|
||||
|
||||
# Qt-es
|
||||
@@ -139,3 +142,7 @@ ios-ne-build.sh
|
||||
macos-ne-build.sh
|
||||
macos-signed-build.sh
|
||||
macos-with-sign-build.sh
|
||||
DeveloperIdApplicationCertificate.p12
|
||||
DeveloperIdInstallerCertificate.p12
|
||||
|
||||
gwenv.sh
|
||||
+8
-10
@@ -4,13 +4,11 @@
|
||||
[submodule "client/3rd/SortFilterProxyModel"]
|
||||
path = client/3rd/SortFilterProxyModel
|
||||
url = https://github.com/mitchcurtis/SortFilterProxyModel.git
|
||||
[submodule "client/3rd-prebuilt"]
|
||||
path = client/3rd-prebuilt
|
||||
url = https://github.com/amnezia-vpn/3rd-prebuilt
|
||||
branch = feature/special-handshake
|
||||
[submodule "client/3rd/amneziawg-apple"]
|
||||
path = client/3rd/amneziawg-apple
|
||||
url = https://github.com/amnezia-vpn/amneziawg-apple
|
||||
[submodule "client/3rd/QSimpleCrypto"]
|
||||
path = client/3rd/QSimpleCrypto
|
||||
url = https://github.com/amnezia-vpn/QSimpleCrypto.git
|
||||
[submodule "client/3rd/qtgamepad"]
|
||||
path = client/3rd/qtgamepad
|
||||
url = https://github.com/amnezia-vpn/qtgamepad.git
|
||||
branch = 6.6
|
||||
[submodule "cmake/cmake-conan"]
|
||||
path = cmake/cmake-conan
|
||||
url = https://github.com/amnezia-vpn/cmake-conan
|
||||
branch = develop2
|
||||
@@ -0,0 +1,219 @@
|
||||
# AGENTS.md
|
||||
|
||||
Operating guide for this repository. Read it before changing anything.
|
||||
|
||||
## Project Overview
|
||||
|
||||
AmneziaVPN is a cross-platform VPN client built with C++ and Qt Quick (QML) for
|
||||
Windows, macOS, Linux, Android and iOS. It has three kinds of servers, each
|
||||
with its own config model (`serverConfigUtils::ConfigType`):
|
||||
|
||||
- **Self-hosted.** The admin connects the app to their own server over SSH; the
|
||||
app installs protocols as Docker containers (AmneziaWG, WireGuard, OpenVPN,
|
||||
XRay, IPsec and others) and generates client configs (`SelfHostedAdmin`).
|
||||
Access is shared with other users as `vpn://` keys, which import without
|
||||
server management rights (`SelfHostedUser`).
|
||||
- **Amnezia Premium and Free.** Configs come from the Amnezia gateway API. The
|
||||
gateway passes the backend's config through; the client does not invent
|
||||
server-side values.
|
||||
- **Native protocol configs.** Third-party configs imported as they are:
|
||||
WireGuard and AmneziaWG `.conf`, OpenVPN `.ovpn`, XRay and Shadowsocks links
|
||||
(`Native`). The app only connects with them; there is no server to manage.
|
||||
|
||||
A change to shared code (protocol configs, import, connection) must keep
|
||||
working for all three.
|
||||
|
||||
The desktop builds run a privileged service next to the GUI; the GUI talks to
|
||||
it over Qt Remote Objects. Android, iOS and the macOS App Store build
|
||||
(`MACOS_NE`) run the tunnel in the platform's VPN extension instead.
|
||||
|
||||
## Repository Layout
|
||||
|
||||
- `client/core/` — business logic with no UI: controllers, configurators
|
||||
(client config generation per protocol), installers (server-side setup over
|
||||
SSH), protocol and server config models, repositories (encrypted settings
|
||||
storage).
|
||||
- `client/ui/controllers/` — `*UiController` classes exposed to QML. Thin
|
||||
adapters over `core/`: they translate between QML and core types and hold no
|
||||
business logic of their own.
|
||||
- `client/ui/models/` — list and property models for QML.
|
||||
- `client/ui/qml/` — the interface:
|
||||
- `Pages2/` — screens, one file per page.
|
||||
- `Components/` — composite pieces of screens.
|
||||
- `Controls2/` — design system controls, named `<Name>Type.qml`; text styles
|
||||
live in `Controls2/TextTypes/`.
|
||||
- `Modules/Style/AmneziaStyle.qml` — design tokens (colours and the like).
|
||||
- `Config/` — `GlobalConfig`, `Dialogs` and other singletons.
|
||||
- `client/platforms/`, `client/android/`, `client/ios/`, `client/macos/` —
|
||||
platform code: VPN extensions, Kotlin, Swift, Objective-C++.
|
||||
- `client/daemon/`, `client/mozilla/`, `service/`, `ipc/` — the privileged
|
||||
service and its IPC.
|
||||
- `client/server_scripts/` — the shell scripts and Dockerfiles run on the
|
||||
user's server.
|
||||
- `client/translations/` — Qt `.ts` files.
|
||||
- `client/tests/` — Qt Test suites, run through `ctest`.
|
||||
- `recipes/` — Conan recipes for native dependencies (protocol libraries,
|
||||
OpenSSL, libssh and others).
|
||||
- `deploy/` — build and installer scripts. `.github/workflows/` — CI.
|
||||
- `client/3rd/` — vendored third-party code. Do not edit it.
|
||||
|
||||
## Essential Commands
|
||||
|
||||
Run from the repository root.
|
||||
|
||||
```bash
|
||||
deploy/build.sh -h # build options
|
||||
deploy/build.sh # build for the host platform
|
||||
deploy/build.sh -t android --aab # Android APK and AAB
|
||||
cmake -S . -B build -DCMAKE_PREFIX_PATH=<Qt>/<platform> -DAMNEZIA_BUILD_TESTS=ON
|
||||
cmake --build build --parallel
|
||||
ctest --test-dir build/client/tests --output-on-failure
|
||||
```
|
||||
|
||||
Qt 6.10 or later and Conan are required; native dependencies are built by Conan
|
||||
from `recipes/` on the first configure.
|
||||
|
||||
## Repository Rules
|
||||
|
||||
These three come first. Each one has been asked for repeatedly.
|
||||
|
||||
### 1. Clean, self-documenting code, no comments
|
||||
|
||||
- Names and structure carry the meaning. Code must be readable without help.
|
||||
- No explanatory comments in code: no `//` notes in QML or C++, no doc blocks.
|
||||
- The one exception is a hack that looks wrong on purpose: a workaround for a
|
||||
platform or Qt bug, an ordering that must not be "fixed". Then a short comment
|
||||
next to it says why.
|
||||
- Explanations of a change go into the chat summary or the commit message, not
|
||||
into the code.
|
||||
- Leave existing comments alone unless the change removes the code they
|
||||
describe.
|
||||
|
||||
### 2. Reusable code (DRY), without abstraction for its own sake
|
||||
|
||||
- **QML.** Every reusable component lives in its own file. A piece of a page
|
||||
goes into its own file in `Components/` even when it is used once, if that
|
||||
keeps the page short and readable. No inline `component` definitions or
|
||||
`Component` blocks inside pages. Before writing a new control, look in
|
||||
`Controls2/` and `Components/` for one that already does the job, and extend
|
||||
it if it almost does.
|
||||
- **C++.** Logic shared by several places is extracted once and reused:
|
||||
duplicated parsing, validation or config building is a bug waiting to diverge.
|
||||
- **No fanaticism.** Do not create a base class, interface, helper or file
|
||||
that only renames a single call, has one trivial user, or exists "for the
|
||||
future". Decompose when it makes the code shorter, clearer or removes
|
||||
duplication; otherwise keep it direct.
|
||||
|
||||
### 3. Do not add what was not asked for
|
||||
|
||||
- Implement exactly the request. No extra screens, buttons, settings,
|
||||
refactors, renames, translations or "while I'm here" fixes.
|
||||
- Ideas, improvements and problems noticed along the way are reported to the
|
||||
user as suggestions. Nothing is implemented without the user agreeing first.
|
||||
- When a request is ambiguous, ask instead of guessing big.
|
||||
- Keep the diff small. If a fix grows beyond the obvious change, say so and
|
||||
explain why before making it.
|
||||
|
||||
### Other rules
|
||||
|
||||
- **Committing is the user's call.** Prepare the change and a commit message;
|
||||
do not commit or push unless asked. Commit messages use a conventional prefix
|
||||
with a scope (`fix(ui): …`, `feat(macos): …`, `chore: …`): a one-line
|
||||
subject plus one or two short body lines saying what was wrong and what
|
||||
changed. Pull requests target `dev`.
|
||||
- **Format C++ with `.clang-format`.** Format the lines you touch; do not
|
||||
reformat files the change does not otherwise touch.
|
||||
- **Delete unused code** instead of keeping it "for later".
|
||||
- **Do not edit `client/3rd/`.** Fix vendored code through its upstream or a
|
||||
Conan recipe.
|
||||
|
||||
## UI And Design System
|
||||
|
||||
- **Figma is the source of truth.** Screens follow the "Amnezia APP VPN" file;
|
||||
components follow the "Amnezia DS Library". Where the two disagree, the app
|
||||
screens win.
|
||||
- **Build UI from the design system controls** in `Controls2/`
|
||||
(`ButtonType`, `ListItemType`, `TextFieldType`, `SheetType`,
|
||||
`NavigationBarType` and the others) and the text types in
|
||||
`Controls2/TextTypes/`. Do not style raw Qt Quick Controls on a page.
|
||||
- **No hex colours in QML.** Every colour is a semantic token from
|
||||
`AmneziaStyle.color`. A colour the tokens do not have is added to
|
||||
`AmneziaStyle` first, with the name the design system gives it.
|
||||
- **Icons come from Figma**, exported from the DS Library. Never draw an icon
|
||||
by hand. Exports include page background rectangles — strip them and keep
|
||||
the `0 0 24 24` viewBox.
|
||||
- **Restyling a component never redesigns a screen.** A design system update
|
||||
changes components; screen layout and behaviour stay unless the user asks.
|
||||
- **No Qt5Compat.GraphicalEffects.** It overflows the interpreted JS stack on
|
||||
iOS. Use `QtQuick.Effects` (`MultiEffect`), and create effects only while
|
||||
they are visible: each instance is expensive to create.
|
||||
|
||||
### QML pitfalls
|
||||
|
||||
- A vertical `ListView` resets the delegate's `x`. Put insets on the
|
||||
ListView's `leftMargin`/`rightMargin`, or on a child inside the delegate.
|
||||
- `lineHeightMode: Text.FixedHeight` puts all the extra leading below the text,
|
||||
while Figma splits it evenly. The text types already compensate with
|
||||
`halfLeading` padding; a new text type must do the same.
|
||||
- QML is loaded from `qml.qrc`, not compiled ahead of time: a QML error shows
|
||||
up only at runtime. When moving QML between files, compare the `import`
|
||||
lines — types registered from C++ under their own URIs fail only when the
|
||||
page is opened.
|
||||
|
||||
## Translations
|
||||
|
||||
- Every user-visible string goes through `qsTr()` in QML or `tr()` in C++.
|
||||
- The `.ts` files contain only finished, non-empty translations: no
|
||||
`vanished`, `obsolete` or `unfinished` entries, and every language holds the
|
||||
same set of strings. `lrelease` must report `N finished and 0 unfinished` for
|
||||
every file.
|
||||
- Refresh `.ts` files only when the task is about translations. `lupdate` run
|
||||
through `qt6_add_translations` misses QML, so run it over an explicit file
|
||||
list that skips `client/3rd` (from `client/translations`):
|
||||
|
||||
```bash
|
||||
find .. -path ../3rd -prune -o -path ../3rd-prebuilt -prune -o \
|
||||
\( -name '*.qml' -o -name '*.cpp' -o -name '*.h' -o -name '*.mm' \) -print \
|
||||
| sort > /tmp/src.lst
|
||||
<Qt>/bin/lupdate @/tmp/src.lst -ts amneziavpn_*.ts
|
||||
```
|
||||
|
||||
- `lupdate` output differs between macOS and Windows (keychain strings swap
|
||||
places), so a large `.ts` diff after a refresh is often only that.
|
||||
- Technical terms stay in English in every language: protocol parameter names
|
||||
and their descriptions (`Jc`, `S1`, `H1`…), config keys, transport and
|
||||
algorithm names. Ordinary UI words are translated.
|
||||
- Renaming a QML file changes its translation context, so its strings have to
|
||||
be carried over.
|
||||
|
||||
## Which Check When
|
||||
|
||||
- **Touched C++** — build the affected targets, and run `ctest` when the change
|
||||
touches anything the tests cover (servers, imports, configs, settings,
|
||||
split tunneling, XRay).
|
||||
- **Touched QML** — build, then open every page you changed. If the app cannot
|
||||
be launched, at least load the changed files through the QML engine so that
|
||||
syntax, imports and type errors surface, and say what was not checked.
|
||||
- **Touched a protocol config, import or connection path** — check self-hosted,
|
||||
Premium/Free and native configs, and every platform that consumes the field
|
||||
(desktop service, Android, iOS/macOS NE).
|
||||
- **Touched CMake, recipes or the app icon** — reconfigure from a clean build
|
||||
directory as well: branding paths are CMake cache variables and keep stale
|
||||
values in an existing build directory.
|
||||
- **Touched translations** — `lrelease` on every `.ts` file, see above.
|
||||
|
||||
## Privacy
|
||||
|
||||
- Never commit or repeat private keys, `vpn://` keys, server addresses,
|
||||
passwords or tokens — including ones found in pasted configs, logs or test
|
||||
output.
|
||||
- Logs must not contain secrets or full config bodies.
|
||||
- Local absolute paths (`/Users/...`, `C:\...`) do not belong in repository
|
||||
files.
|
||||
|
||||
## Verification Culture
|
||||
|
||||
- Verify your own work before reporting it. "Should work" is not a result;
|
||||
say exactly what was built, run or opened, and what was not.
|
||||
- Hypotheses are settled by an experiment, not by reasoning about the code.
|
||||
- After a wrong diagnosis, remove the code it produced.
|
||||
@@ -0,0 +1,6 @@
|
||||
# CLAUDE.md
|
||||
|
||||
The operating guide for this repository lives in [AGENTS.md](AGENTS.md), so
|
||||
every agent runtime reads the same file.
|
||||
|
||||
@AGENTS.md
|
||||
+31
-27
@@ -1,51 +1,55 @@
|
||||
cmake_minimum_required(VERSION 3.25.0 FATAL_ERROR)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
set(PROJECT AmneziaVPN)
|
||||
set(AMNEZIAVPN_VERSION 4.8.10.0)
|
||||
if(NOT AMNEZIAVPN_VERSION)
|
||||
set(AMNEZIAVPN_VERSION 5.2.0.1 CACHE STRING "Client app version")
|
||||
endif()
|
||||
|
||||
set(QT_CREATOR_SKIP_PACKAGE_MANAGER_SETUP ON CACHE BOOL "" FORCE)
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/cmake-conan/conan_bootstrap.cmake)
|
||||
execute_process(
|
||||
COMMAND ${CONAN_COMMAND} remote add recipes "https://artifactory.amnezia.org/artifactory/api/conan/recipes" --force -vquiet
|
||||
)
|
||||
set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES
|
||||
${CMAKE_SOURCE_DIR}/cmake/platform_settings.cmake
|
||||
${CMAKE_SOURCE_DIR}/cmake/cmake-conan/conan_provider.cmake
|
||||
CACHE STRING "" FORCE)
|
||||
|
||||
project(${PROJECT} VERSION ${AMNEZIAVPN_VERSION}
|
||||
DESCRIPTION "AmneziaVPN"
|
||||
HOMEPAGE_URL "https://amnezia.org/"
|
||||
)
|
||||
|
||||
option(AMNEZIA_BUILD_TESTS "Build test executables" OFF)
|
||||
|
||||
# trigger conan to kick off `conan install` globally
|
||||
find_package(OpenSSL REQUIRED)
|
||||
if (PREBUILTS_ONLY)
|
||||
return()
|
||||
endif()
|
||||
|
||||
string(TIMESTAMP CURRENT_DATE "%Y-%m-%d")
|
||||
set(RELEASE_DATE "${CURRENT_DATE}")
|
||||
|
||||
set(APP_MAJOR_VERSION ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH})
|
||||
set(APP_ANDROID_VERSION_CODE 2093)
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
set(MZ_PLATFORM_NAME "linux")
|
||||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
set(MZ_PLATFORM_NAME "windows")
|
||||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
set(MZ_PLATFORM_NAME "macos")
|
||||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
|
||||
set(MZ_PLATFORM_NAME "android")
|
||||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "iOS")
|
||||
set(MZ_PLATFORM_NAME "ios")
|
||||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
|
||||
set(MZ_PLATFORM_NAME "wasm")
|
||||
# bump by 2 on every release, because we're releasing two versions on the play store
|
||||
set(APP_ANDROID_VERSION_CODE 2194)
|
||||
if(DEFINED APP_ANDROID_VERSION_CODE_OFFSET)
|
||||
math(EXPR APP_ANDROID_VERSION_CODE "${APP_ANDROID_VERSION_CODE} + ${APP_ANDROID_VERSION_CODE_OFFSET}")
|
||||
endif()
|
||||
|
||||
set(QT_BUILD_TOOLS_WHEN_CROSS_COMPILING ON)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if(APPLE)
|
||||
if(IOS)
|
||||
set(CMAKE_OSX_ARCHITECTURES "arm64")
|
||||
elseif(MACOS_NE)
|
||||
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
|
||||
else()
|
||||
set(CMAKE_OSX_ARCHITECTURES "x86_64")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_subdirectory(client)
|
||||
|
||||
if(NOT IOS AND NOT ANDROID AND NOT MACOS_NE)
|
||||
add_subdirectory(service)
|
||||
endif()
|
||||
|
||||
include(${CMAKE_SOURCE_DIR}/deploy/installer/config.cmake)
|
||||
if ((LINUX AND NOT ANDROID) OR (APPLE AND NOT IOS AND NOT MACOS_NE) OR (WIN32))
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/CPack.cmake)
|
||||
endif()
|
||||
@@ -38,14 +38,14 @@
|
||||
|
||||
## Links
|
||||
|
||||
- [https://amnezia.org](https://amnezia.org) - Project website | [Alternative link (mirror)](https://storage.googleapis.com/kldscp/amnezia.org)
|
||||
- [https://docs.amnezia.org](https://docs.amnezia.org) - Documentation
|
||||
- [https://amnezia.org](https://amnezia.org/?utm_source=github&utm_campaign=amnezia_website-read) - Project website | [Alternative link (mirror)](https://storage.googleapis.com/amnezia/amnezia.org?utm_source=github&utm_campaign=amnezia_website-read)
|
||||
- [https://docs.amnezia.org](https://docs.amnezia.org/?utm_source=github&utm_campaign=amnezia_website-read) - Documentation | [Alternative link (mirror)](https://storage.googleapis.com/amnezia/docs?utm_source=github&utm_campaign=amnezia_website-read)
|
||||
- [https://www.reddit.com/r/AmneziaVPN](https://www.reddit.com/r/AmneziaVPN) - Reddit
|
||||
- [https://t.me/amnezia_vpn_en](https://t.me/amnezia_vpn_en) - Telegram support channel (English)
|
||||
- [https://t.me/amnezia_vpn_ir](https://t.me/amnezia_vpn_ir) - Telegram support channel (Farsi)
|
||||
- [https://t.me/amnezia_vpn_mm](https://t.me/amnezia_vpn_mm) - Telegram support channel (Myanmar)
|
||||
- [https://t.me/amnezia_vpn](https://t.me/amnezia_vpn) - Telegram support channel (Russian)
|
||||
- [https://vpnpay.io/en/amnezia-premium/](https://vpnpay.io/en/amnezia-premium/) - Amnezia Premium
|
||||
- [https://telegram.me/amnezia_vpn_en](https://telegram.me/amnezia_vpn_en) - Telegram support channel (English)
|
||||
- [https://telegram.me/amnezia_vpn_ir](https://telegram.me/amnezia_vpn_ir) - Telegram support channel (Farsi)
|
||||
- [https://telegram.me/amnezia_vpn_mm](https://telegram.me/amnezia_vpn_mm) - Telegram support channel (Myanmar)
|
||||
- [https://telegram.me/amnezia_vpn](https://telegram.me/amnezia_vpn) - Telegram support channel (Russian)
|
||||
- [Get Premium for 6 or 12 months](https://storage.googleapis.com/amnezia/pay?utm_source=github&utm_campaign=ampay-read)
|
||||
|
||||
## Tech
|
||||
|
||||
@@ -53,24 +53,14 @@ AmneziaVPN uses several open-source projects to work:
|
||||
|
||||
- [OpenSSL](https://www.openssl.org/)
|
||||
- [OpenVPN](https://openvpn.net/)
|
||||
- [Shadowsocks](https://shadowsocks.org/)
|
||||
- [Qt](https://www.qt.io/)
|
||||
- [LibSsh](https://libssh.org) - forked from Qt Creator
|
||||
- [LibSsh](https://libssh.org)
|
||||
- [WireGuard](https://www.wireguard.com/)
|
||||
- [Xray-core](https://xtls.github.io/en/)
|
||||
- [Conan](https://conan.io/)
|
||||
- and more...
|
||||
|
||||
## Checking out the source code
|
||||
|
||||
Make sure to pull all submodules after checking out the repo.
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
Want to contribute? Welcome!
|
||||
|
||||
### Help with translations
|
||||
## Help us with translations
|
||||
|
||||
Download the most actual translation files.
|
||||
|
||||
@@ -83,103 +73,102 @@ Each *.ts file contains strings for one corresponding language.
|
||||
Translate or correct some strings in one or multiple *.ts files and commit them back to this repository into the ``client/translations`` folder.
|
||||
You can do it via a web-interface or any other method you're familiar with.
|
||||
|
||||
### Building sources and deployment
|
||||
## Checking out the source code
|
||||
|
||||
Check deploy folder for build scripts.
|
||||
Make sure to pull all submodules after checking out the repo.
|
||||
|
||||
### How to build an iOS app from source code on MacOS
|
||||
|
||||
1. First, make sure you have [XCode](https://developer.apple.com/xcode/) installed, at least version 14 or higher.
|
||||
|
||||
2. We use QT to generate the XCode project. We need QT version 6.6.2. Install QT for MacOS [here](https://doc.qt.io/qt-6/macos.html) or [QT Online Installer](https://www.qt.io/download-open-source). Required modules:
|
||||
- MacOS
|
||||
- iOS
|
||||
- Qt 5 Compatibility Module
|
||||
- Qt Shader Tools
|
||||
- Additional Libraries:
|
||||
- Qt Image Formats
|
||||
- Qt Multimedia
|
||||
- Qt Remote Objects
|
||||
|
||||
3. Install CMake if required. We recommend CMake version 3.25. You can install CMake [here](https://cmake.org/download/)
|
||||
|
||||
4. You also need to install go >= v1.16. If you don't have it installed already,
|
||||
download go from the [official website](https://golang.org/dl/) or use Homebrew.
|
||||
The latest version is recommended. Install gomobile
|
||||
```bash
|
||||
export PATH=$PATH:~/go/bin
|
||||
go install golang.org/x/mobile/cmd/gomobile@latest
|
||||
gomobile init
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
5. Build the project
|
||||
## Hacking guide
|
||||
|
||||
Want to contribute? Welcome!
|
||||
|
||||
### Build requirements
|
||||
|
||||
* [`CMake`](https://cmake.org/download/)
|
||||
* Compiler and underlying build system, depending on the target:
|
||||
- [Linux] Any of `make` and `gcc`
|
||||
- [Apple] [`Xcode`](https://developer.apple.com/xcode/) or [`Xcode command line tools`](https://developer.apple.com/xcode/)
|
||||
- [Windows] [`Visual Studio 2022`](https://aka.ms/vs/17/release/vs_community.exe) or [`VS 2022 Build Tools`](https://aka.ms/vs/17/release/vs_buildtools.exe)
|
||||
- [Android] [`Android SDK`](#installing-android-sdk) and [`Ninja`](https://ninja-build.org/)
|
||||
* [`Qt 6.10+`](https://www.qt.io/download-open-source) with the following modules:
|
||||
- Core module for targeting platform (Desktop/Android/iOS)
|
||||
- Qt 5 Compatibility module
|
||||
- Qt Remote Objects
|
||||
* [`Conan`](https://conan.io/downloads) package manager
|
||||
- On MacOS is enough just to use `homebrew` or install it in `.venv` in project root
|
||||
- Other systems must have it in `PATH`
|
||||
* (Optional) Installer dependencies:
|
||||
- [Windows/Linux] [`Qt Installer Framework`](https://www.qt.io/download-open-source)
|
||||
- [Windows] [`WIX toolset`](https://github.com/wixtoolset/wix/releases)
|
||||
|
||||
### Building the project using scripts
|
||||
|
||||
* Run scripts located in `deploy` directory
|
||||
* Basically, if dependencies are located in default installation paths, the scripts will find them automatically.
|
||||
* If they differ, specify them using the following variables:
|
||||
- `QT_INSTALL_DIR` - Qt root installation folder
|
||||
- `QT_ROOT_PATH` - Qt framework root directory
|
||||
- `QIF_ROOT_PATH` - Qt Installer Framework root path
|
||||
- `ANDROID_HOME` - Path to Android SDK root folder
|
||||
- and others. Check scripts for more
|
||||
|
||||
Unix-like:
|
||||
```bash
|
||||
export QT_BIN_DIR="<PATH-TO-QT-FOLDER>/Qt/<QT-VERSION>/ios/bin"
|
||||
export QT_MACOS_ROOT_DIR="<PATH-TO-QT-FOLDER>/Qt/<QT-VERSION>/macos"
|
||||
export QT_IOS_BIN=$QT_BIN_DIR
|
||||
export PATH=$PATH:~/go/bin
|
||||
mkdir build-ios
|
||||
$QT_IOS_BIN/qt-cmake . -B build-ios -GXcode -DQT_HOST_PATH=$QT_MACOS_ROOT_DIR
|
||||
```
|
||||
Replace PATH-TO-QT-FOLDER and QT-VERSION to your environment
|
||||
# Build executables for the host platform
|
||||
deploy/build.sh
|
||||
|
||||
# Or just
|
||||
deploy/build.sh
|
||||
|
||||
If you get `gomobile: command not found` make sure to set PATH to the location
|
||||
of the bin folder where gomobile was installed. Usually, it's in `GOPATH`.
|
||||
```bash
|
||||
export PATH=$(PATH):/path/to/GOPATH/bin
|
||||
# Build executables and installers for the host platform
|
||||
deploy/build.sh --installer all
|
||||
|
||||
# Build Android APK and AAB
|
||||
deploy/build.sh -t android --aab
|
||||
|
||||
# Call for help
|
||||
deploy/build.sh -h
|
||||
```
|
||||
|
||||
6. Open the XCode project. You can then run /test/archive/ship the app.
|
||||
Windows:
|
||||
```batch
|
||||
:: Build executables for Windows
|
||||
deploy/build.bat
|
||||
|
||||
If the build fails with the following error
|
||||
```
|
||||
make: ***
|
||||
[$(PROJECTDIR)/client/build/AmneziaVPN.build/Debug-iphoneos/wireguard-go-bridge/goroot/.prepared]
|
||||
Error 1
|
||||
```
|
||||
Add a user-defined variable to both AmneziaVPN and WireGuardNetworkExtension targets' build settings with
|
||||
key `PATH` and value `${PATH}/path/to/bin/folder/with/go/executable`, e.g. `${PATH}:/usr/local/go/bin`.
|
||||
:: Build executables with IFW installer for Windows
|
||||
deploy/build.bat --installer ifw
|
||||
|
||||
if the above error persists on your M1 Mac, then most probably you need to install arch based CMake
|
||||
```
|
||||
arch -arm64 brew install cmake
|
||||
:: Build executables with IFW and WIX installer for Windows
|
||||
deploy/build.bat --installer ifw --installer wix
|
||||
|
||||
:: Or just
|
||||
deploy/build.bat --installer all
|
||||
```
|
||||
|
||||
Build might fail with the "source files not found" error the first time you try it, because the modern XCode build system compiles dependencies in parallel, and some dependencies end up being built after the ones that
|
||||
require them. In this case, simply restart the build.
|
||||
### Developing the project in IDEs
|
||||
|
||||
## How to build the Android app
|
||||
* Basically, you can use any IDE that handles CMake and Qt kits properly to run configure and build steps, and to navigate through the code nicely. For example:
|
||||
- `Qt Creator`
|
||||
- `Visual Studio Code` with `Qt Extension Pack`
|
||||
- and so on
|
||||
|
||||
_Tested on Mac OS_
|
||||
* To use `Xcode`, you have to configure project first by using `cmake`. The easiest way to do it is to use `Qt Creator` for configuration. Then open `AmneziaVPN.xcodeproj` file from the build folder by using `Xcode`. Note that none of the files changed are saved - the files actually getting changed in build directory. Copy them manually if necessary
|
||||
|
||||
The Android app has the following requirements:
|
||||
* JDK 11
|
||||
* Android platform SDK 33
|
||||
* CMake 3.25.0
|
||||
* `Android studio` could be used in the same way - just configure the project by using `cmake` manually or by using `Qt Creator`. Open `<build-dir>/client/android-build` in `Android studio` then. Do not forget to copy the changes - everything you do is saved under the build directory actually.
|
||||
|
||||
After you have installed QT, QT Creator, and Android Studio, you need to configure QT Creator correctly.
|
||||
### Installing Android SDK
|
||||
|
||||
- Click in the top menu bar on `QT Creator` -> `Preferences` -> `Devices` and select the tab `Android`.
|
||||
- Set path to JDK 11
|
||||
- Set path to Android SDK (`$ANDROID_HOME`)
|
||||
|
||||
In case you get errors regarding missing SDK or 'SDK manager not running', you cannot fix them by correcting the paths. If you have some spare GBs on your disk, you can let QT Creator install all requirements by choosing an empty folder for `Android SDK location` and clicking on `Set Up SDK`. Be aware: This will install a second Android SDK and NDK on your machine!
|
||||
Double-check that the right CMake version is configured: Click on `QT Creator` -> `Preferences` and click on the side menu on `Kits`. Under the center content view's `Kits` tab, you'll find an entry for `CMake Tool`. If the default selected CMake version is lower than 3.25.0, install on your system CMake >= 3.25.0 and choose `System CMake at <path>` from the drop-down list. If this entry is missing, you either have not installed CMake yet or QT Creator hasn't found the path to it. In that case, click in the preferences window on the side menu item `CMake`, then on the tab `Tools` in the center content view, and finally on the button `Add` to set the path to your installed CMake.
|
||||
Please make sure that you have selected Android Platform SDK 33 for your project: click in the main view's side menu on `Projects`, and on the left, you'll see a section `Build & Run` showing different Android build targets. You can select any of them, Amnezia VPN's project setup is designed in a way that all Android targets will be built. Click on the targets submenu item `Build` and scroll in the center content view to `Build Steps`. Click on `Details` at the end of the headline `Build Android APK` (the `Details` button might be hidden in case the QT Creator Window is not running in full screen!). Here we are: Choose `android-33` as `Android Build Platform SDK`.
|
||||
|
||||
That's it! You should be ready to compile the project from QT Creator!
|
||||
|
||||
### Development flow
|
||||
|
||||
After you've hit the build button, QT-Creator copies the whole project to a folder in the repository parent directory. The folder should look something like `build-amnezia-client-Android_Qt_<version>_Clang_<architecture>-<BuildType>`.
|
||||
If you want to develop Amnezia VPNs Android components written in Kotlin, such as components using system APIs, you need to import the generated project in Android Studio with `build-amnezia-client-Android_Qt_<version>_Clang_<architecture>-<BuildType>/client/android-build` as the projects root directory. While you should be able to compile the generated project from Android Studio, you cannot work directly in the repository's Android project. So whenever you are confident with your work in the generated project, you'll need to copy and paste the affected files to the corresponding path in the repository's Android project so that you can add and commit your changes!
|
||||
|
||||
You may face compiling issues in QT Creator after you've worked in Android Studio on the generated project. Just do a `./gradlew clean` in the generated project's root directory (`<path>/client/android-build/.`) and you should be good to go.
|
||||
* Android SDK could be installed using the following methods:
|
||||
- Using `Qt Creator`. Use `Preferences`->`SDKs`
|
||||
- Using `Android studio`. By default it installs necessary `SDKs` automatically during the installation
|
||||
- Manually by using `sdk-manager`. Check [this](https://developer.android.com/tools) page for details
|
||||
|
||||
## License
|
||||
|
||||
GPL v3.0
|
||||
This project is licensed under the GNU General Public License v3.0 (see LICENSE) and also includes third-party components distributed under their own terms (see THIRD_PARTY_LICENSES.md).
|
||||
|
||||
## Donate
|
||||
|
||||
|
||||
+87
-88
@@ -28,21 +28,21 @@
|
||||
|
||||
- Простой в использовании — введите IP-адрес, SSH-логин и пароль, и Amnezia автоматически установит VPN-контейнеры Docker на ваш сервер и подключится к VPN.
|
||||
- Классические VPN-протоколы: OpenVPN, WireGuard и IKEv2.
|
||||
- Протоколы с маскировкой трафика (обфускацией): OpenVPN с плагином [Cloak](https://github.com/cbeuw/Cloak), Shadowsocks (OpenVPN over Shadowsocks), [AmneziaWG](https://docs.amnezia.org/documentation/amnezia-wg/) and XRay.
|
||||
- Протоколы с маскировкой трафика (обфускацией): OpenVPN с плагином [Cloak](https://github.com/cbeuw/Cloak), Shadowsocks (OpenVPN over Shadowsocks), [AmneziaWG](https://docs.amnezia.org/documentation/amnezia-wg/) и XRay.
|
||||
- Поддержка Split Tunneling — добавляйте любые сайты или приложения в список, чтобы включить VPN только для них.
|
||||
- Поддерживает платформы: Windows, macOS, Linux, Android, iOS.
|
||||
- Поддержка конфигурации протокола AmneziaWG на [бета-прошивке Keenetic](https://docs.keenetic.com/ua/air/kn-1611/en/6319-latest-development-release.html#UUID-186c4108-5afd-c10b-f38a-cdff6c17fab3_section-idm33192196168192-improved).
|
||||
|
||||
## Ссылки
|
||||
|
||||
- [https://amnezia.org](https://amnezia.org) - Веб-сайт проекта | [Альтернативная ссылка (зеркало)](https://storage.googleapis.com/kldscp/amnezia.org)
|
||||
- [https://docs.amnezia.org](https://docs.amnezia.org) - Документация
|
||||
- [https://amnezia.org](https://amnezia.org/?utm_source=github&utm_campaign=amnezia_website-read) - Веб-сайт проекта | [Альтернативная ссылка (зеркало)](https://storage.googleapis.com/amnezia/amnezia.org?utm_source=github&utm_campaign=amnezia_website-read)
|
||||
- [https://docs.amnezia.org](https://docs.amnezia.org/?utm_source=github&utm_campaign=amnezia_website-read) - Документация | [Альтернативная ссылка (зеркало)](https://storage.googleapis.com/amnezia/docs?utm_source=github&utm_campaign=amnezia_website-read)
|
||||
- [https://www.reddit.com/r/AmneziaVPN](https://www.reddit.com/r/AmneziaVPN) - Reddit
|
||||
- [https://t.me/amnezia_vpn_en](https://t.me/amnezia_vpn_en) - Канал поддержки в Telegram (Английский)
|
||||
- [https://t.me/amnezia_vpn_ir](https://t.me/amnezia_vpn_ir) - Канал поддержки в Telegram (Фарси)
|
||||
- [https://t.me/amnezia_vpn_mm](https://t.me/amnezia_vpn_mm) - Канал поддержки в Telegram (Мьянма)
|
||||
- [https://t.me/amnezia_vpn](https://t.me/amnezia_vpn) - Канал поддержки в Telegram (Русский)
|
||||
- [https://vpnpay.io/en/amnezia-premium/](https://vpnpay.io/en/amnezia-premium/) - Amnezia Premium | [Зеркало](https://storage.googleapis.com/kldscp/vpnpay.io/ru/amnezia-premium\)
|
||||
- [https://telegram.me/amnezia_vpn_en](https://telegram.me/amnezia_vpn_en) - Канал поддержки в Telegram (Английский)
|
||||
- [https://telegram.me/amnezia_vpn_ir](https://telegram.me/amnezia_vpn_ir) - Канал поддержки в Telegram (Фарси)
|
||||
- [https://telegram.me/amnezia_vpn_mm](https://telegram.me/amnezia_vpn_mm) - Канал поддержки в Telegram (Мьянма)
|
||||
- [https://telegram.me/amnezia_vpn](https://telegram.me/amnezia_vpn) - Канал поддержки в Telegram (Русский)
|
||||
- [Оформите Premium на 6 или 12 месяцев](https://storage.googleapis.com/amnezia/pay?utm_source=github&utm_campaign=ampay-read)
|
||||
|
||||
## Технологии
|
||||
|
||||
@@ -50,23 +50,14 @@ AmneziaVPN использует несколько проектов с откр
|
||||
|
||||
- [OpenSSL](https://www.openssl.org/)
|
||||
- [OpenVPN](https://openvpn.net/)
|
||||
- [Shadowsocks](https://shadowsocks.org/)
|
||||
- [Qt](https://www.qt.io/)
|
||||
- [LibSsh](https://libssh.org)
|
||||
- [WireGuard](https://www.wireguard.com/)
|
||||
- [Xray-core](https://xtls.github.io/en/)
|
||||
- [Conan](https://conan.io/)
|
||||
- и другие...
|
||||
|
||||
## Проверка исходного кода
|
||||
После клонирования репозитория обязательно загрузите все подмодули.
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
|
||||
## Разработка
|
||||
Хотите внести свой вклад? Добро пожаловать!
|
||||
|
||||
### Помощь с переводами
|
||||
## Помощь с переводами
|
||||
|
||||
Загрузите самые актуальные файлы перевода.
|
||||
|
||||
@@ -76,90 +67,98 @@ git submodule update --init --recursive
|
||||
|
||||
Переведите или исправьте строки в одном или нескольких файлах *.ts и загрузите их обратно в этот репозиторий в папку ``client/translations``. Это можно сделать через веб-интерфейс или любым другим знакомым вам способом.
|
||||
|
||||
### Сборка исходного кода и деплой
|
||||
Проверьте папку deploy для скриптов сборки.
|
||||
## Проверка исходного кода
|
||||
|
||||
### Как собрать iOS-приложение из исходного кода на MacOS
|
||||
1. Убедитесь, что у вас установлен Xcode версии 14 или выше.
|
||||
2. Для генерации проекта Xcode используется QT. Требуется версия QT 6.6.2. Установите QT для MacOS здесь или через QT Online Installer. Необходимые модули:
|
||||
- MacOS
|
||||
- iOS
|
||||
- Модуль совместимости с Qt 5
|
||||
- Qt Shader Tools
|
||||
- Дополнительные библиотеки:
|
||||
- Qt Image Formats
|
||||
- Qt Multimedia
|
||||
- Qt Remote Objects
|
||||
|
||||
|
||||
3. Установите CMake, если это необходимо. Рекомендуемая версия — 3.25. Скачать CMake можно здесь.
|
||||
4. Установите Go версии >= v1.16. Если Go ещё не установлен, скачайте его с [официального сайта](https://golang.org/dl/) или используйте Homebrew. Установите gomobile:
|
||||
После клонирования репозитория обязательно загрузите все подмодули.
|
||||
|
||||
```bash
|
||||
export PATH=$PATH:~/go/bin
|
||||
go install golang.org/x/mobile/cmd/gomobile@latest
|
||||
gomobile init
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
5. Соберите проект:
|
||||
## Руководство по разработке
|
||||
|
||||
Хотите внести свой вклад? Добро пожаловать!
|
||||
|
||||
### Требования для сборки
|
||||
|
||||
* [`CMake`](https://cmake.org/download/)
|
||||
* Компилятор и система сборки, в зависимости от таргета:
|
||||
- [Linux] Любые `make` и `gcc`
|
||||
- [Apple] [`Xcode`](https://developer.apple.com/xcode/) или [`Xcode command line tools`](https://developer.apple.com/xcode/)
|
||||
- [Windows] [`Visual Studio 2022`](https://aka.ms/vs/17/release/vs_community.exe) или [`VS 2022 Build Tools`](https://aka.ms/vs/17/release/vs_buildtools.exe)
|
||||
- [Android] [`Android SDK`](#установка-android-sdk) и [`Ninja`](https://ninja-build.org/)
|
||||
* [`Qt 6.10+`](https://www.qt.io/download-open-source) со следующими модулями:
|
||||
- Основные модули для таргета (Desktop/Android/iOS)
|
||||
- Qt 5 Compatibility module
|
||||
- Qt Remote Objects
|
||||
* Пакетный менеджер [`Conan`](https://conan.io/downloads)
|
||||
- На MacOS достаточно использовать `homebrew` или установить в `.venv` в корень проекта
|
||||
- Для остальных систем необходимо прописать пути в `PATH`
|
||||
* (Необязательно) Заивисимости для установщиков:
|
||||
- [Windows/Linux] [`Qt Installer Framework`](https://www.qt.io/download-open-source)
|
||||
- [Windows] [`WIX toolset`](https://github.com/wixtoolset/wix/releases)
|
||||
|
||||
### Сборка проекта через скрипты
|
||||
|
||||
* Запустите скрипты, находящиеся в папке `deploy`
|
||||
* Если все зависимости установлены в стандартных локациях, скрипт найдёт их самостоятельно
|
||||
* Если пути отличаются, их нужно явно указать используя:
|
||||
- `QT_INSTALL_DIR` - корневая папка установки Qt
|
||||
- `QT_ROOT_PATH` - корневая папка Qt Framework
|
||||
- `QIF_ROOT_PATH` - корневая папка Qt Installer Framework
|
||||
- `ANDROID_HOME` - путь к Android SDK
|
||||
- и другие. Их можно получить из вышеуказанных скриптов
|
||||
|
||||
Unix-like:
|
||||
```bash
|
||||
export QT_BIN_DIR="<PATH-TO-QT-FOLDER>/Qt/<QT-VERSION>/ios/bin"
|
||||
export QT_MACOS_ROOT_DIR="<PATH-TO-QT-FOLDER>/Qt/<QT-VERSION>/macos"
|
||||
export QT_IOS_BIN=$QT_BIN_DIR
|
||||
export PATH=$PATH:~/go/bin
|
||||
mkdir build-ios
|
||||
$QT_IOS_BIN/qt-cmake . -B build-ios -GXcode -DQT_HOST_PATH=$QT_MACOS_ROOT_DIR
|
||||
```
|
||||
Замените <PATH-TO-QT-FOLDER> и <QT-VERSION> на ваши значения.
|
||||
# Build executables for the host platform
|
||||
deploy/build.sh
|
||||
|
||||
Если появляется ошибка gomobile: command not found, убедитесь, что PATH настроен на папку bin, где установлен gomobile:
|
||||
```bash
|
||||
export PATH=$(PATH):/path/to/GOPATH/bin
|
||||
# Or just
|
||||
deploy/build.sh
|
||||
|
||||
# Build executables and installers for the host platform
|
||||
deploy/build.sh --installer all
|
||||
|
||||
# Build Android APK and AAB
|
||||
deploy/build.sh -t android --aab
|
||||
|
||||
# Call for help
|
||||
deploy/build.sh -h
|
||||
```
|
||||
|
||||
6. Откройте проект в Xcode. Теперь вы можете тестировать, архивировать или публиковать приложение.
|
||||
|
||||
Если сборка завершится с ошибкой:
|
||||
```
|
||||
make: ***
|
||||
[$(PROJECTDIR)/client/build/AmneziaVPN.build/Debug-iphoneos/wireguard-go-bridge/goroot/.prepared]
|
||||
Error 1
|
||||
```
|
||||
Добавьте пользовательскую переменную PATH в настройки сборки для целей AmneziaVPN и WireGuardNetworkExtension с ключом `PATH` и значением `${PATH}/path/to/bin/folder/with/go/executable`, e.g. `${PATH}:/usr/local/go/bin`.
|
||||
Windows:
|
||||
```batch
|
||||
:: Build executables for Windows
|
||||
deploy/build.bat
|
||||
|
||||
Если ошибка повторяется на Mac с M1, установите версию CMake для архитектуры ARM:
|
||||
```
|
||||
arch -arm64 brew install cmake
|
||||
:: Build executables with IFW installer for Windows
|
||||
deploy/build.bat --installer ifw
|
||||
|
||||
:: Build executables with IFW and WIX installer for Windows
|
||||
deploy/build.bat --installer ifw --installer wix
|
||||
|
||||
:: Or just
|
||||
deploy/build.bat --installer all
|
||||
```
|
||||
|
||||
При первой попытке сборка может завершиться с ошибкой source files not found. Это происходит из-за параллельной компиляции зависимостей в XCode. Просто перезапустите сборку.
|
||||
### Разработка в IDE
|
||||
|
||||
* Можно использовать любые IDE которые умеют работать с CMake и находить Qt Kits. Например:
|
||||
- `Qt Creator`
|
||||
- `Visual Studio Code` with `Qt Extension Pack`
|
||||
- и так далее
|
||||
|
||||
## Как собрать Android-приложение
|
||||
Сборка тестировалась на MacOS. Требования:
|
||||
- JDK 11
|
||||
- Android SDK 33
|
||||
- CMake 3.25.0
|
||||
|
||||
Установите QT, QT Creator и Android Studio.
|
||||
Настройте QT Creator:
|
||||
* Для использования `Xcode` нужно сконфигурировать проект с помощью `cmake`. Самый простой способ это сделать - использовать `Qt Creator` для конфигурации. Затем, нужно открыть файл `AmneziaVPN.xcodeproj` из папки сборки с помощью `Xcode`. Учтите, что никакие файлы фактически не сохраняются - они сохраняются в директории сборки. Если требуется, скопируйте файлы вручную
|
||||
|
||||
- В меню QT Creator перейдите в `QT Creator` -> `Preferences` -> `Devices` ->`Android`.
|
||||
- Укажите путь к JDK 11.
|
||||
- Укажите путь к Android SDK (`$ANDROID_HOME`)
|
||||
* `Android studio` может быть использована подобным вышеуказанному способу - нужно использовать `cmake` вручную или через `Qt Creator` для конфигурации. Далее, откройте `<build-dir>/client/android-build` в `Android studio`. Не забудьте скопировать изменённые файлы в папку с исходным кодом - все файлы, изменённые в IDE, сохраняются фактически в папке сборки.
|
||||
|
||||
Если вы сталкиваетесь с ошибками, связанными с отсутствием SDK или сообщением «SDK manager not running», их нельзя исправить просто корректировкой путей. Если у вас есть несколько свободных гигабайт на диске, вы можете позволить Qt Creator установить все необходимые компоненты, выбрав пустую папку для расположения Android SDK и нажав кнопку **Set Up SDK**. Учтите: это установит второй Android SDK и NDK на вашем компьютере!
|
||||
|
||||
Убедитесь, что настроена правильная версия CMake: перейдите в **Qt Creator -> Preferences** и в боковом меню выберите пункт **Kits**. В центральной части окна, на вкладке **Kits**, найдите запись для инструмента **CMake Tool**. Если выбранная по умолчанию версия CMake ниже 3.25.0, установите на свою систему CMake версии 3.25.0 или выше, а затем выберите опцию **System CMake at <путь>** из выпадающего списка. Если этот пункт отсутствует, это может означать, что вы еще не установили CMake, или Qt Creator не смог найти путь к нему. В таком случае в окне **Preferences** перейдите в боковое меню **CMake**, затем во вкладку **Tools** в центральной части окна и нажмите кнопку **Add**, чтобы указать путь к установленному CMake.
|
||||
|
||||
Убедитесь, что для вашего проекта выбрана Android Platform SDK 33: в главном окне на боковой панели выберите пункт **Projects**, и слева вы увидите раздел **Build & Run**, показывающий различные целевые Android-платформы. Вы можете выбрать любую из них, так как настройка проекта Amnezia VPN разработана таким образом, чтобы все Android-цели могли быть собраны. Перейдите в подраздел **Build** и прокрутите центральную часть окна до раздела **Build Steps**. Нажмите **Details** в заголовке **Build Android APK** (кнопка **Details** может быть скрыта, если окно Qt Creator не запущено в полноэкранном режиме!). Вот здесь выберите **android-33** в качестве Android Build Platform SDK.
|
||||
|
||||
### Разработка Android-компонентов
|
||||
|
||||
После сборки QT Creator копирует проект в отдельную папку, например, `build-amnezia-client-Android_Qt_<version>_Clang_<architecture>-<BuildType>`. Для разработки Android-компонентов откройте сгенерированный проект в Android Studio, указав папку `build-amnezia-client-Android_Qt_<version>_Clang_<architecture>-<BuildType>/client/android-build` в качестве корневой.
|
||||
Изменения в сгенерированном проекте нужно вручную перенести в репозиторий. После этого можно коммитить изменения.
|
||||
Если возникают проблемы со сборкой в QT Creator после работы в Android Studio, выполните команду `./gradlew clean` в корневой папке сгенерированного проекта (`<path>/client/android-build/.`).
|
||||
### Установка Android SDK
|
||||
|
||||
* Android SDK может быть установлен следующими способами:
|
||||
- Используя `Qt Creator`, через настройки в пунктах `Preferences`->`SDKs`
|
||||
- Используя `Android studio`. По умолчанию необходимые `SDK` устанавливаются автоматически.
|
||||
- Вручную, используя `sdk-manager`. Подробности можно найти [здесь](https://developer.android.com/tools)
|
||||
|
||||
## Лицензия
|
||||
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
# Third-Party Licenses
|
||||
|
||||
This project is licensed under the GNU General Public License v3.0.
|
||||
This file lists third-party software components used by this repository.
|
||||
Each component is distributed under its own license as linked below.
|
||||
|
||||
---
|
||||
|
||||
## QtKeychain
|
||||
|
||||
- Source: https://github.com/frankosterfeld/qtkeychain
|
||||
- License: BSD License
|
||||
- License Text: https://www.gnu.org/licenses/license-list.html#ModifiedBSD
|
||||
|
||||
---
|
||||
|
||||
## QSimpleCrypto
|
||||
|
||||
- Source: https://github.com/n1flh31mur/QSimpleCrypto
|
||||
- License: Apache License 2.0
|
||||
- License Text: https://github.com/n1flh31mur/QSimpleCrypto/blob/master/LICENSE
|
||||
|
||||
---
|
||||
|
||||
## SortFilterProxyModel
|
||||
|
||||
- Source: https://github.com/oKcerG/SortFilterProxyModel
|
||||
- License: MIT License
|
||||
- License Text: https://github.com/oKcerG/SortFilterProxyModel/blob/master/LICENSE
|
||||
|
||||
---
|
||||
|
||||
## QJsonStruct
|
||||
|
||||
- Source: https://github.com/Qv2ray/QJsonStruct
|
||||
- License: MIT License
|
||||
- License Text: https://github.com/Qv2ray/QJsonStruct/blob/master/LICENSE
|
||||
|
||||
---
|
||||
|
||||
## QR Code Generator (qrcodegen)
|
||||
|
||||
- Source: https://github.com/nayuki/QR-Code-generator
|
||||
- License: MIT License
|
||||
- License Text: https://www.nayuki.io/page/qr-code-generator-library
|
||||
|
||||
---
|
||||
|
||||
## Qt Gamepad
|
||||
|
||||
- Source: https://github.com/qt/qtgamepad
|
||||
- License: GNU General Public License v3.0 (GPL-3.0)
|
||||
- License Text: https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
---
|
||||
|
||||
## AmneziaWG Apple (WireGuard)
|
||||
|
||||
- Source: https://github.com/amnezia-vpn/amneziawg-apple
|
||||
- License: MIT License
|
||||
- License Text: https://github.com/amnezia-vpn/amneziawg-apple/blob/master/COPYING
|
||||
|
||||
---
|
||||
|
||||
## AmneziaWG Android
|
||||
|
||||
- Source: https://github.com/amnezia-vpn/amneziawg-go
|
||||
- License: MIT License
|
||||
- License Text: https://github.com/amnezia-vpn/amneziawg-go/blob/master/LICENSE
|
||||
|
||||
---
|
||||
|
||||
## Xray Core
|
||||
|
||||
- Source: https://github.com/XTLS/Xray-core
|
||||
- License: Mozilla Public License 2.0 (MPL-2.0)
|
||||
- License Text: https://github.com/XTLS/Xray-core/blob/main/LICENSE
|
||||
|
||||
---
|
||||
|
||||
## Cloak
|
||||
|
||||
- Source: https://github.com/cbeuw/Cloak
|
||||
- License: GNU General Public License v3.0 (GPL-3.0)
|
||||
- License Text: https://github.com/cbeuw/Cloak/blob/master/LICENSE
|
||||
|
||||
---
|
||||
|
||||
## Shadowsocks
|
||||
|
||||
- Source: https://github.com/shadowsocks/shadowsocks-libev
|
||||
- License: GPL-3.0-or-later
|
||||
- License Text: http://www.gnu.org/licenses/
|
||||
|
||||
---
|
||||
|
||||
## OpenSSL
|
||||
|
||||
- Source: https://github.com/openssl/openssl
|
||||
- License: Apache License 2.0
|
||||
- License Text: https://www.openssl.org/source/license.html
|
||||
|
||||
---
|
||||
|
||||
## libssh
|
||||
|
||||
- Source: https://www.libssh.org/
|
||||
- License: GNU Lesser General Public License (LGPL)
|
||||
- License Text: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
|
||||
|
||||
---
|
||||
|
||||
## OpenVPNAdapter
|
||||
|
||||
- Source: https://github.com/ss-abramchuk/OpenVPNAdapter
|
||||
- License: GNU Affero General Public License v3.0 (AGPL-3.0)
|
||||
- License Text: https://github.com/ss-abramchuk/OpenVPNAdapter/blob/master/LICENSE
|
||||
|
||||
---
|
||||
|
||||
## Wintun
|
||||
|
||||
- Source: https://www.wintun.net/
|
||||
- License: Prebuilt Binaries License
|
||||
- License Text: https://github.com/WireGuard/wintun/blob/master/prebuilt-binaries-license.txt
|
||||
|
||||
---
|
||||
|
||||
## Mullvad Split Tunnel Driver
|
||||
|
||||
- Source: https://github.com/mullvad/win-split-tunnel
|
||||
- License: GNU General Public License v3.0 (GPL-3.0) and Mozilla Public License Version 2.0
|
||||
- License Text: https://github.com/mullvad/win-split-tunnel/blob/master/LICENSE-GPL.md https://github.com/mullvad/win-split-tunnel/blob/master/LICENSE-MPL.txt
|
||||
|
||||
---
|
||||
|
||||
## tun2socks
|
||||
|
||||
- Source: https://github.com/eycorsican/go-tun2socks
|
||||
- License: MIT License
|
||||
- License Text: https://github.com/eycorsican/go-tun2socks/blob/master/LICENSE
|
||||
|
||||
---
|
||||
|
||||
## TAP-Windows Driver
|
||||
|
||||
- Source: https://github.com/OpenVPN/tap-windows6
|
||||
- License: tap-windows6 license
|
||||
- License Text: https://github.com/OpenVPN/tap-windows6/blob/master/COPYING
|
||||
Submodule client/3rd-prebuilt deleted from 02a00ee00d.
Vendored
-1
Submodule client/3rd/QSimpleCrypto deleted from c99b33f0e0.
Vendored
-1
Submodule client/3rd/amneziawg-apple deleted from 811af0a83b.
+1
Submodule client/3rd/qtgamepad added at f72b3e0c62.
+165
-91
@@ -1,6 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.25.0 FATAL_ERROR)
|
||||
|
||||
set(PROJECT AmneziaVPN)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/cmake/clientBrandingDefaults.cmake)
|
||||
|
||||
set(PROJECT ${CLIENT_TARGET_NAME})
|
||||
project(${PROJECT})
|
||||
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
@@ -23,31 +25,42 @@ execute_process(
|
||||
|
||||
add_definitions(-DGIT_COMMIT_HASH="${GIT_COMMIT_HASH}")
|
||||
|
||||
add_definitions(-DPROD_AGW_PUBLIC_KEY="$ENV{PROD_AGW_PUBLIC_KEY}")
|
||||
add_definitions(-DPROD_AGW_PUBLIC_KEY_B64="$ENV{PROD_AGW_PUBLIC_KEY_B64}")
|
||||
add_definitions(-DPROD_S3_ENDPOINT="$ENV{PROD_S3_ENDPOINT}")
|
||||
add_definitions(-DFALLBACK_S3_ENDPOINT="$ENV{FALLBACK_S3_ENDPOINT}")
|
||||
|
||||
add_definitions(-DDEV_AGW_PUBLIC_KEY="$ENV{DEV_AGW_PUBLIC_KEY}")
|
||||
add_definitions(-DDEV_AGW_ENDPOINT="$ENV{DEV_AGW_ENDPOINT}")
|
||||
add_definitions(-DDEV_S3_ENDPOINT="$ENV{DEV_S3_ENDPOINT}")
|
||||
add_definitions(-DSANDBOX_AGW_PUBLIC_KEY_B64="$ENV{SANDBOX_AGW_PUBLIC_KEY_B64}")
|
||||
add_definitions(-DSANDBOX_AGW_ENDPOINT="$ENV{SANDBOX_AGW_ENDPOINT}")
|
||||
add_definitions(-DSANDBOX_S3_ENDPOINT="$ENV{SANDBOX_S3_ENDPOINT}")
|
||||
|
||||
add_definitions(-DFREE_V2_ENDPOINT="$ENV{FREE_V2_ENDPOINT}")
|
||||
add_definitions(-DPREM_V1_ENDPOINT="$ENV{PREM_V1_ENDPOINT}")
|
||||
|
||||
if(WIN32 OR (APPLE AND NOT IOS) OR (LINUX AND NOT ANDROID))
|
||||
set(PACKAGES ${PACKAGES} Widgets)
|
||||
set(PACKAGES ${PACKAGES} Widgets HttpServer)
|
||||
endif()
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS ${PACKAGES})
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
find_package(libagw REQUIRED)
|
||||
|
||||
set(LIBS ${LIBS}
|
||||
Qt6::Core Qt6::Gui
|
||||
Qt6::Network Qt6::Xml Qt6::RemoteObjects
|
||||
Qt6::Quick Qt6::Svg Qt6::QuickControls2
|
||||
Qt6::Core5Compat Qt6::Concurrent
|
||||
amnezia::libagw
|
||||
)
|
||||
|
||||
find_package(Qt6 QUIET OPTIONAL_COMPONENTS CorePrivate)
|
||||
if(TARGET Qt6::CorePrivate)
|
||||
set(LIBS ${LIBS} Qt6::CorePrivate)
|
||||
add_compile_definitions(AMNEZIA_HAS_QZIPWRITER)
|
||||
endif()
|
||||
|
||||
if(WIN32 OR (APPLE AND NOT IOS) OR (LINUX AND NOT ANDROID))
|
||||
set(LIBS ${LIBS} Qt6::Widgets)
|
||||
set(LIBS ${LIBS} Qt6::Widgets Qt6::HttpServer)
|
||||
endif()
|
||||
|
||||
qt_standard_project_setup()
|
||||
@@ -55,42 +68,52 @@ qt_add_executable(${PROJECT} MANUAL_FINALIZATION)
|
||||
target_include_directories(${PROJECT} PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
||||
)
|
||||
|
||||
if(WIN32 OR (APPLE AND NOT IOS) OR (LINUX AND NOT ANDROID))
|
||||
qt_add_repc_replicas(${PROJECT} ${CMAKE_CURRENT_LIST_DIR}/../ipc/ipc_interface.rep)
|
||||
qt_add_repc_replicas(${PROJECT} ${CMAKE_CURRENT_LIST_DIR}/../ipc/ipc_process_interface.rep)
|
||||
qt_add_repc_replicas(${PROJECT} ${CMAKE_CURRENT_LIST_DIR}/../ipc/ipc_process_tun2socks.rep)
|
||||
endif()
|
||||
|
||||
qt6_add_resources(QRC ${QRC} ${CMAKE_CURRENT_LIST_DIR}/resources.qrc)
|
||||
|
||||
# -- i18n begin
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(AMNEZIAVPN_TS_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/translations/amneziavpn_ru_RU.ts
|
||||
${CMAKE_CURRENT_LIST_DIR}/translations/amneziavpn_zh_CN.ts
|
||||
${CMAKE_CURRENT_LIST_DIR}/translations/amneziavpn_fa_IR.ts
|
||||
${CMAKE_CURRENT_LIST_DIR}/translations/amneziavpn_ar_EG.ts
|
||||
${CMAKE_CURRENT_LIST_DIR}/translations/amneziavpn_my_MM.ts
|
||||
${CMAKE_CURRENT_LIST_DIR}/translations/amneziavpn_uk_UA.ts
|
||||
${CMAKE_CURRENT_LIST_DIR}/translations/amneziavpn_ur_PK.ts
|
||||
${CMAKE_CURRENT_LIST_DIR}/translations/amneziavpn_hi_IN.ts
|
||||
target_compile_definitions(${PROJECT} PRIVATE
|
||||
CLIENT_KEYCHAIN_NAME_STR=\"${CLIENT_KEYCHAIN_NAME}\"
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE AMNEZIAVPN_TS_SOURCES *.qrc *.cpp *.h *.ui)
|
||||
if(WIN32 OR (APPLE AND NOT IOS AND NOT MACOS_NE) OR (LINUX AND NOT ANDROID))
|
||||
qt_add_repc_replicas(${PROJECT} ${CMAKE_CURRENT_LIST_DIR}/../ipc/ipc_interface.rep)
|
||||
endif()
|
||||
|
||||
qt_create_translation(AMNEZIAVPN_QM_FILES ${AMNEZIAVPN_TS_SOURCES} ${AMNEZIAVPN_TS_FILES})
|
||||
qt6_add_resources(QRC ${QRC}
|
||||
${CMAKE_CURRENT_LIST_DIR}/images/images.qrc
|
||||
${CMAKE_CURRENT_LIST_DIR}/images/flagKit.qrc
|
||||
${CMAKE_CURRENT_LIST_DIR}/resources/countries.qrc
|
||||
${CMAKE_CURRENT_LIST_DIR}/client_scripts/clientScripts.qrc
|
||||
${CLIENT_QML_QRC_FILE}
|
||||
${CMAKE_CURRENT_LIST_DIR}/server_scripts/serverScripts.qrc
|
||||
${CLIENT_EXTRA_QRC}
|
||||
)
|
||||
|
||||
set(QM_FILE_LIST "")
|
||||
foreach(FILE ${AMNEZIAVPN_QM_FILES})
|
||||
get_filename_component(QM_FILE_NAME ${FILE} NAME)
|
||||
list(APPEND QM_FILE_LIST "<file>${QM_FILE_NAME}</file>")
|
||||
endforeach()
|
||||
string(REPLACE ";" "" QM_FILE_LIST ${QM_FILE_LIST})
|
||||
# -- i18n begin
|
||||
if(CLIENT_TS_FILES)
|
||||
set(AMNEZIAVPN_TS_FILES ${CLIENT_TS_FILES})
|
||||
else()
|
||||
set(AMNEZIAVPN_TS_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/translations/${CLIENT_TS_PREFIX}_ru_RU.ts
|
||||
${CMAKE_CURRENT_LIST_DIR}/translations/${CLIENT_TS_PREFIX}_zh_CN.ts
|
||||
${CMAKE_CURRENT_LIST_DIR}/translations/${CLIENT_TS_PREFIX}_fa_IR.ts
|
||||
${CMAKE_CURRENT_LIST_DIR}/translations/${CLIENT_TS_PREFIX}_ar_EG.ts
|
||||
${CMAKE_CURRENT_LIST_DIR}/translations/${CLIENT_TS_PREFIX}_my_MM.ts
|
||||
${CMAKE_CURRENT_LIST_DIR}/translations/${CLIENT_TS_PREFIX}_uk_UA.ts
|
||||
${CMAKE_CURRENT_LIST_DIR}/translations/${CLIENT_TS_PREFIX}_ur_PK.ts
|
||||
${CMAKE_CURRENT_LIST_DIR}/translations/${CLIENT_TS_PREFIX}_hi_IN.ts
|
||||
${CMAKE_CURRENT_LIST_DIR}/translations/${CLIENT_TS_PREFIX}_es_ES.ts
|
||||
${CMAKE_CURRENT_LIST_DIR}/translations/${CLIENT_TS_PREFIX}_ko_KR.ts
|
||||
${CMAKE_CURRENT_LIST_DIR}/translations/${CLIENT_TS_PREFIX}_fr_FR.ts
|
||||
${CMAKE_CURRENT_LIST_DIR}/translations/${CLIENT_TS_PREFIX}_th_TH.ts
|
||||
${CMAKE_CURRENT_LIST_DIR}/translations/${CLIENT_TS_PREFIX}_id_ID.ts
|
||||
)
|
||||
endif()
|
||||
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/translations/translations.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc)
|
||||
qt6_add_resources(QRC ${I18NQRC} ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc)
|
||||
file(GLOB_RECURSE AMNEZIAVPN_QML_FILES ${CMAKE_CURRENT_LIST_DIR}/ui/qml/*.qml)
|
||||
|
||||
qt6_add_translations(${PROJECT}
|
||||
TS_FILES ${AMNEZIAVPN_TS_FILES}
|
||||
SOURCES ${AMNEZIAVPN_QML_FILES}
|
||||
RESOURCE_PREFIX "/translations"
|
||||
)
|
||||
# -- i18n end
|
||||
|
||||
set(IS_CI ${CI})
|
||||
@@ -105,12 +128,18 @@ endif()
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/cmake/3rdparty.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/cmake/sources.cmake)
|
||||
|
||||
include_directories(
|
||||
set(_client_include_dirs
|
||||
${CMAKE_CURRENT_LIST_DIR}/../ipc
|
||||
${CMAKE_CURRENT_LIST_DIR}/../common/logger
|
||||
${CMAKE_CURRENT_LIST_DIR}/../common/crypto
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
if(CLIENT_BRANDING_INCLUDE_DIR)
|
||||
list(APPEND _client_include_dirs ${CLIENT_BRANDING_INCLUDE_DIR})
|
||||
endif()
|
||||
list(APPEND _client_include_dirs ${CMAKE_CURRENT_LIST_DIR})
|
||||
include_directories(${_client_include_dirs})
|
||||
|
||||
if(MACOS_NE)
|
||||
message("MACOS_NE is ON")
|
||||
@@ -121,15 +150,27 @@ else()
|
||||
message("MACOS_NE is OFF")
|
||||
endif()
|
||||
|
||||
include_directories(mozilla)
|
||||
include_directories(mozilla/shared)
|
||||
include_directories(mozilla/models)
|
||||
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/../version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
target_compile_definitions(${PROJECT} PRIVATE "MZ_DEBUG")
|
||||
endif()
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/core/utils)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/core/utils/appUiConfig.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/core/utils/appUiConfig.h
|
||||
@ONLY
|
||||
)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/core/utils/swiftBridgeConfig.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/core/utils/swiftBridgeConfig.h
|
||||
@ONLY
|
||||
)
|
||||
# Swift can't consume a `-DGROUP_ID="value"` compile define (Swift -D flags are
|
||||
# presence-only), unlike the Objective-C++ sources that read GROUP_ID directly.
|
||||
# Generate a Swift constant instead so Log.swift can use the branded app group.
|
||||
set(CLIENT_GROUP_IDENTIFIER_SWIFT_FILE ${CMAKE_CURRENT_BINARY_DIR}/platforms/ios/GroupIdentifier.swift)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/platforms/ios/GroupIdentifier.swift.in
|
||||
${CLIENT_GROUP_IDENTIFIER_SWIFT_FILE}
|
||||
@ONLY
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
configure_file(
|
||||
@@ -153,27 +194,20 @@ if(APPLE)
|
||||
cmake_policy(SET CMP0099 NEW)
|
||||
cmake_policy(SET CMP0114 NEW)
|
||||
|
||||
if(NOT BUILD_OSX_APP_IDENTIFIER)
|
||||
set(BUILD_OSX_APP_IDENTIFIER org.amnezia.AmneziaVPN CACHE STRING "OSX Application identifier")
|
||||
endif()
|
||||
if(NOT BUILD_IOS_APP_IDENTIFIER)
|
||||
set(BUILD_IOS_APP_IDENTIFIER org.amnezia.AmneziaVPN CACHE STRING "iOS Application identifier")
|
||||
endif()
|
||||
if(NOT BUILD_IOS_GROUP_IDENTIFIER)
|
||||
set(BUILD_IOS_GROUP_IDENTIFIER group.org.amnezia.AmneziaVPN CACHE STRING "iOS Group identifier")
|
||||
endif()
|
||||
if(NOT BUILD_VPN_DEVELOPMENT_TEAM)
|
||||
set(BUILD_VPN_DEVELOPMENT_TEAM X7UJ388FXK CACHE STRING "Amnezia VPN Development Team")
|
||||
endif()
|
||||
|
||||
set(CMAKE_XCODE_GENERATE_SCHEME FALSE)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM ${BUILD_VPN_DEVELOPMENT_TEAM})
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GROUP_ID_IOS ${BUILD_IOS_GROUP_IDENTIFIER})
|
||||
|
||||
if (BUILD_VPN_KEYCHAIN)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS "--keychain ${BUILD_VPN_KEYCHAIN}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LINUX AND NOT ANDROID)
|
||||
set(LIBS ${LIBS} -static-libstdc++ -static-libgcc -ldl)
|
||||
link_directories(${CMAKE_CURRENT_LIST_DIR}/platforms/linux)
|
||||
set(LIBS ${LIBS} -Wl,--no-as-needed $<TARGET_LINKER_FILE:Qt6::RemoteObjects> -Wl,--as-needed)
|
||||
endif()
|
||||
|
||||
if(WIN32 OR (APPLE AND NOT IOS AND NOT MACOS_NE) OR (LINUX AND NOT ANDROID))
|
||||
@@ -184,6 +218,10 @@ if(ANDROID)
|
||||
include(cmake/android.cmake)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
include(cmake/appleAppIcon.cmake)
|
||||
endif()
|
||||
|
||||
if(IOS)
|
||||
include(cmake/ios.cmake)
|
||||
include(cmake/ios-arch-fixup.cmake)
|
||||
@@ -194,38 +232,74 @@ elseif(APPLE)
|
||||
include(cmake/macos.cmake)
|
||||
endif()
|
||||
|
||||
list(APPEND SOURCES ${CMAKE_CURRENT_LIST_DIR}/main.cpp)
|
||||
|
||||
target_link_libraries(${PROJECT} PRIVATE ${LIBS})
|
||||
target_compile_definitions(${PROJECT} PRIVATE "MZ_$<UPPER_CASE:${MZ_PLATFORM_NAME}>")
|
||||
|
||||
# deploy artifacts required to run the application to the debug build folder
|
||||
if(WIN32)
|
||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
|
||||
set(DEPLOY_PLATFORM_PATH "windows/x64")
|
||||
else()
|
||||
set(DEPLOY_PLATFORM_PATH "windows/x32")
|
||||
endif()
|
||||
elseif(LINUX)
|
||||
set(DEPLOY_PLATFORM_PATH "linux/client")
|
||||
elseif(APPLE AND NOT IOS)
|
||||
set(DEPLOY_PLATFORM_PATH "macos")
|
||||
endif()
|
||||
|
||||
if(NOT IOS AND NOT ANDROID AND NOT MACOS_NE)
|
||||
add_custom_command(
|
||||
TARGET ${PROJECT} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E $<IF:$<CONFIG:Debug>,copy_directory,true>
|
||||
${CMAKE_SOURCE_DIR}/deploy/data/${DEPLOY_PLATFORM_PATH}
|
||||
$<TARGET_FILE_DIR:${PROJECT}>
|
||||
COMMAND_EXPAND_LISTS
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET ${PROJECT} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E $<IF:$<CONFIG:Debug>,copy_directory,true>
|
||||
${CMAKE_SOURCE_DIR}/client/3rd-prebuilt/deploy-prebuilt/${DEPLOY_PLATFORM_PATH}
|
||||
$<TARGET_FILE_DIR:${PROJECT}>
|
||||
COMMAND_EXPAND_LISTS
|
||||
)
|
||||
endif()
|
||||
|
||||
target_sources(${PROJECT} PRIVATE ${SOURCES} ${HEADERS} ${RESOURCES} ${QRC} ${I18NQRC})
|
||||
qt_finalize_target(${PROJECT})
|
||||
|
||||
# Finalize the executable so Qt can gather/deploy QML modules and plugins correctly (Android needs this).
|
||||
if(COMMAND qt_import_qml_plugins)
|
||||
qt_import_qml_plugins(${PROJECT})
|
||||
endif()
|
||||
if(COMMAND qt_finalize_executable)
|
||||
qt_finalize_executable(${PROJECT})
|
||||
else()
|
||||
qt_finalize_target(${PROJECT})
|
||||
endif()
|
||||
|
||||
install(TARGETS ${PROJECT}
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
RUNTIME_DEPENDENCY_SET client_deps
|
||||
COMPONENT AmneziaVPN
|
||||
)
|
||||
|
||||
if(APPLE)
|
||||
set(RUNTIME_DEPS_DIR ${CMAKE_INSTALL_BINDIR}/AmneziaVPN.app/Contents/Frameworks)
|
||||
else()
|
||||
set(RUNTIME_DEPS_DIR ${CMAKE_INSTALL_BINDIR})
|
||||
endif()
|
||||
|
||||
install(RUNTIME_DEPENDENCY_SET client_deps
|
||||
PRE_EXCLUDE_REGEXES
|
||||
[[api-ms-win-.*]]
|
||||
[[ext-ms-.*]]
|
||||
[[kernel32\.dll]]
|
||||
[[hvsifiletrust\.dll]]
|
||||
[[libc\.so\..*]] [[libgcc_s\.so\..*]] [[libm\.so\..*]] [[libstdc\+\+\.so\..*]]
|
||||
[[.*\.framework]]
|
||||
[[^(lib)?[Qq]t.*]]
|
||||
POST_EXCLUDE_REGEXES
|
||||
[[^.*[\\/]system32[\\/].*\.dll$]]
|
||||
[[^/lib.*]]
|
||||
[[^/usr/lib.*]]
|
||||
DIRECTORIES ${CONAN_RUNTIME_LIB_DIRS}
|
||||
COMPONENT AmneziaVPN
|
||||
DESTINATION "${RUNTIME_DEPS_DIR}"
|
||||
)
|
||||
|
||||
set(deploy_tool_options "")
|
||||
if(WIN32)
|
||||
set(deploy_tool_options "--force-openssl --force")
|
||||
endif()
|
||||
|
||||
qt_generate_deploy_qml_app_script(
|
||||
TARGET ${PROJECT}
|
||||
OUTPUT_SCRIPT QT_DEPLOY_SCRIPT
|
||||
NO_UNSUPPORTED_PLATFORM_ERROR
|
||||
DEPLOY_TOOL_OPTIONS ${deploy_tool_options}
|
||||
)
|
||||
install(SCRIPT ${QT_DEPLOY_SCRIPT}
|
||||
COMPONENT AmneziaVPN
|
||||
)
|
||||
|
||||
if (APPLE AND NOT IOS AND NOT MACOS_NE)
|
||||
set_target_properties(${PROJECT} PROPERTIES
|
||||
XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO"
|
||||
XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(AMNEZIA_BUILD_TESTS)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "amnezia_application.h"
|
||||
#include "amneziaApplication.h"
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QFontDatabase>
|
||||
@@ -13,20 +13,39 @@
|
||||
#include <QTimer>
|
||||
#include <QTranslator>
|
||||
#include <QEvent>
|
||||
#include <QDir>
|
||||
#include <QSettings>
|
||||
#include <QtQuick/QQuickWindow>
|
||||
#include <QWindow>
|
||||
|
||||
#include "core/controllers/updateController.h"
|
||||
#include "core/protocols/qmlRegisterProtocols.h"
|
||||
#include "logger.h"
|
||||
#include "ui/controllers/pageController.h"
|
||||
#include "ui/controllers/qml/pageController.h"
|
||||
#include "ui/models/installedAppsModel.h"
|
||||
#include "ui/utils/mtProxyPublicHostInput.h"
|
||||
#include "version.h"
|
||||
#include "core/utils/appUiConfig.h"
|
||||
|
||||
#include "platforms/ios/QRCodeReaderBase.h"
|
||||
#ifdef Q_OS_IOS
|
||||
#include "platforms/ios/ioscontextmenu.h"
|
||||
#endif
|
||||
|
||||
#include "protocols/qml_register_protocols.h"
|
||||
#include <QtQuick/QQuickWindow> // for QQuickWindow
|
||||
#include <QWindow> // for qobject_cast<QWindow*>
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include "platforms/android/android_controller.h"
|
||||
#endif
|
||||
|
||||
|
||||
AmneziaApplication::AmneziaApplication(int &argc, char *argv[]) : AMNEZIA_BASE_CLASS(argc, argv)
|
||||
bool AmneziaApplication::m_forceQuit = false;
|
||||
|
||||
AmneziaApplication::AmneziaApplication(int &argc, char *argv[]) : AMNEZIA_BASE_CLASS(argc, argv),
|
||||
m_optAutostart({QStringLiteral("a"), QStringLiteral("autostart")}, QStringLiteral("System autostart")),
|
||||
m_optCleanup ({QStringLiteral("c"), QStringLiteral("cleanup")}, QStringLiteral("Cleanup logs")),
|
||||
m_optConnect ({QStringLiteral("connect")}, QStringLiteral("Connect to server by index on startup"), QStringLiteral("index")),
|
||||
m_optImport ({QStringLiteral("import")}, QStringLiteral("Import configuration from data string"), QStringLiteral("data"))
|
||||
{
|
||||
setDesktopFileName(QStringLiteral(APPLICATION_NAME));
|
||||
setQuitOnLastWindowClosed(false);
|
||||
|
||||
// Fix config file permissions
|
||||
@@ -45,35 +64,51 @@ AmneziaApplication::AmneziaApplication(int &argc, char *argv[]) : AMNEZIA_BASE_C
|
||||
QFile::setPermissions(configLoc2, QFileDevice::ReadOwner | QFileDevice::WriteOwner);
|
||||
#endif
|
||||
|
||||
m_settings = std::shared_ptr<Settings>(new Settings);
|
||||
m_settings = new SecureQSettings(ORGANIZATION_NAME, APPLICATION_NAME, this);
|
||||
m_nam = new QNetworkAccessManager(this);
|
||||
}
|
||||
|
||||
AmneziaApplication::~AmneziaApplication()
|
||||
{
|
||||
if (m_vpnConnection) {
|
||||
QMetaObject::invokeMethod(m_vpnConnection.get(), "disconnectFromVpn", Qt::QueuedConnection);
|
||||
QMetaObject::invokeMethod(m_vpnConnection.get(), "deleteLater", Qt::QueuedConnection);
|
||||
#ifdef AMNEZIA_DESKTOP
|
||||
if (m_vpnConnection && m_vpnConnectionThread.isRunning()) {
|
||||
QMetaObject::invokeMethod(m_vpnConnection.get(), "disconnectSlots", Qt::BlockingQueuedConnection);
|
||||
|
||||
QMetaObject::invokeMethod(m_vpnConnection.get(), "disconnectFromVpn", Qt::BlockingQueuedConnection);
|
||||
}
|
||||
#endif
|
||||
|
||||
m_vpnConnectionThread.requestInterruption();
|
||||
m_vpnConnectionThread.quit();
|
||||
|
||||
if (!m_vpnConnectionThread.wait(5000)) {
|
||||
if (!m_vpnConnectionThread.wait(3000)) {
|
||||
m_vpnConnectionThread.terminate();
|
||||
m_vpnConnectionThread.wait();
|
||||
m_vpnConnectionThread.wait(500);
|
||||
}
|
||||
|
||||
if (m_engine) {
|
||||
QObject::disconnect(m_engine, 0, 0, 0);
|
||||
delete m_engine;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
namespace {
|
||||
static void clearQtCaches()
|
||||
{
|
||||
const QString cacheRoot = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
|
||||
if (!cacheRoot.isEmpty()) {
|
||||
QDir(cacheRoot + "/QtShaderCache").removeRecursively();
|
||||
QDir(cacheRoot + "/qmlcache").removeRecursively();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void AmneziaApplication::init()
|
||||
{
|
||||
m_engine = new QQmlApplicationEngine;
|
||||
|
||||
const QUrl url(QStringLiteral("qrc:/ui/qml/main2.qml"));
|
||||
const QUrl url(QStringLiteral(APP_QML_ENTRYPOINT));
|
||||
QObject::connect(
|
||||
m_engine, &QQmlApplicationEngine::objectCreated, this,
|
||||
[this, url](QObject *obj, const QUrl &objUrl) {
|
||||
@@ -84,7 +119,28 @@ void AmneziaApplication::init()
|
||||
// install filter on main window
|
||||
if (auto win = qobject_cast<QQuickWindow*>(obj)) {
|
||||
win->installEventFilter(this);
|
||||
#ifdef Q_OS_ANDROID
|
||||
QObject::connect(win, &QQuickWindow::sceneGraphError,
|
||||
[](QQuickWindow::SceneGraphError, const QString &msg) {
|
||||
qWarning() << "Scene graph error (suppressed):" << msg;
|
||||
});
|
||||
// Keep graphics context alive across hide/show cycles to avoid
|
||||
// eglSwapBuffers/makeCurrent being called on a context Android has reclaimed.
|
||||
win->setPersistentSceneGraph(true);
|
||||
win->setPersistentGraphics(true);
|
||||
#endif
|
||||
#ifdef Q_OS_IOS
|
||||
auto pageController = m_coreController->pageController();
|
||||
pageController->setSafeAreaMargins(win->safeAreaMargins());
|
||||
QObject::connect(win, &QWindow::safeAreaMarginsChanged, pageController, &PageController::setSafeAreaMargins);
|
||||
#endif
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||
win->show();
|
||||
#else
|
||||
if (!m_coreController || !m_coreController->pageController()->shouldStartMinimized()) {
|
||||
win->show();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
@@ -97,29 +153,43 @@ void AmneziaApplication::init()
|
||||
m_engine->rootContext()->setContextProperty("IsMacOsNeBuild", false);
|
||||
#endif
|
||||
|
||||
m_vpnConnection.reset(new VpnConnection(m_settings));
|
||||
#ifdef Q_OS_IOS
|
||||
m_engine->rootContext()->setContextProperty("IosContextMenu", new IosContextMenu(this));
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
m_engine->rootContext()->setContextProperty("IsPlayBuild", AndroidController::instance()->isPlay());
|
||||
#else
|
||||
m_engine->rootContext()->setContextProperty("IsPlayBuild", false);
|
||||
#endif
|
||||
|
||||
m_vpnConnection.reset(new VpnConnection(nullptr, nullptr));
|
||||
m_vpnConnection->moveToThread(&m_vpnConnectionThread);
|
||||
m_vpnConnectionThread.start();
|
||||
|
||||
m_coreController.reset(new CoreController(m_vpnConnection, m_settings, m_engine));
|
||||
|
||||
m_engine->addImportPath("qrc:/ui/qml/Modules/");
|
||||
m_engine->addImportPath(QStringLiteral(APP_QML_IMPORT_PATH));
|
||||
|
||||
if (m_parser.isSet(m_optImport)) {
|
||||
const QString data = m_parser.value(m_optImport);
|
||||
if (!data.isEmpty()) {
|
||||
if (m_coreController) {
|
||||
m_coreController->importConfigFromData(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_engine->load(url);
|
||||
|
||||
m_coreController->setQmlRoot();
|
||||
|
||||
bool enabled = m_settings->isSaveLogs();
|
||||
#ifndef Q_OS_ANDROID
|
||||
if (enabled) {
|
||||
if (!Logger::init(false)) {
|
||||
qWarning() << "Initialization of debug subsystem failed";
|
||||
}
|
||||
}
|
||||
#if CLIENT_ENABLE_APP_UPDATES
|
||||
m_coreController->checkForAppUpdates();
|
||||
#endif
|
||||
Logger::setServiceLogsEnabled(enabled);
|
||||
|
||||
#ifdef Q_OS_WIN //TODO
|
||||
if (m_parser.isSet("a"))
|
||||
if (m_parser.isSet(m_optAutostart))
|
||||
m_coreController->pageController()->showOnStartup();
|
||||
else
|
||||
emit m_coreController->pageController()->raiseMainWindow();
|
||||
@@ -143,6 +213,18 @@ void AmneziaApplication::init()
|
||||
}
|
||||
});
|
||||
#endif
|
||||
|
||||
if (m_parser.isSet(m_optConnect)) {
|
||||
bool ok = false;
|
||||
int idx = m_parser.value(m_optConnect).toInt(&ok);
|
||||
if (ok) {
|
||||
QTimer::singleShot(0, this, [this, idx]() {
|
||||
if (m_coreController) {
|
||||
m_coreController->openConnectionByIndex(idx);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AmneziaApplication::registerTypes()
|
||||
@@ -150,13 +232,11 @@ void AmneziaApplication::registerTypes()
|
||||
qRegisterMetaType<ServerCredentials>("ServerCredentials");
|
||||
|
||||
qRegisterMetaType<DockerContainer>("DockerContainer");
|
||||
using namespace amnezia::ProtocolEnumNS;
|
||||
qRegisterMetaType<TransportProto>("TransportProto");
|
||||
qRegisterMetaType<Proto>("Proto");
|
||||
qRegisterMetaType<ServiceType>("ServiceType");
|
||||
|
||||
declareQmlProtocolEnum();
|
||||
declareQmlContainerEnum();
|
||||
|
||||
qmlRegisterType<QRCodeReader>("QRCodeReader", 1, 0, "QRCodeReader");
|
||||
|
||||
m_containerProps.reset(new ContainerProps());
|
||||
@@ -170,15 +250,20 @@ void AmneziaApplication::registerTypes()
|
||||
|
||||
qmlRegisterType<InstalledAppsModel>("InstalledAppsModel", 1, 0, "InstalledAppsModel");
|
||||
|
||||
qmlRegisterType<PublicHostInputValidator>("MtProxyConfig", 1, 0, "PublicHostInputValidator");
|
||||
qmlRegisterType<PublicHostInputValidator>("TelemtConfig", 1, 0, "PublicHostInputValidator");
|
||||
|
||||
amnezia::declareQmlProtocolEnum();
|
||||
Vpn::declareQmlVpnConnectionStateEnum();
|
||||
PageLoader::declareQmlPageEnum();
|
||||
UpdateState::declareQmlUpdateStateEnum();
|
||||
}
|
||||
|
||||
void AmneziaApplication::loadFonts()
|
||||
{
|
||||
QQuickStyle::setStyle("Basic");
|
||||
|
||||
QFontDatabase::addApplicationFont(":/fonts/pt-root-ui_vf.ttf");
|
||||
QFontDatabase::addApplicationFont(QStringLiteral(APP_UI_FONT_RESOURCE));
|
||||
}
|
||||
|
||||
bool AmneziaApplication::parseCommands()
|
||||
@@ -187,15 +272,14 @@ bool AmneziaApplication::parseCommands()
|
||||
m_parser.addHelpOption();
|
||||
m_parser.addVersionOption();
|
||||
|
||||
QCommandLineOption c_autostart { { "a", "autostart" }, "System autostart" };
|
||||
m_parser.addOption(c_autostart);
|
||||
|
||||
QCommandLineOption c_cleanup { { "c", "cleanup" }, "Cleanup logs" };
|
||||
m_parser.addOption(c_cleanup);
|
||||
m_parser.addOption(m_optAutostart);
|
||||
m_parser.addOption(m_optCleanup);
|
||||
m_parser.addOption(m_optConnect);
|
||||
m_parser.addOption(m_optImport);
|
||||
|
||||
m_parser.process(*this);
|
||||
|
||||
if (m_parser.isSet(c_cleanup)) {
|
||||
if (m_parser.isSet(m_optCleanup)) {
|
||||
Logger::cleanUp();
|
||||
QTimer::singleShot(100, this, [this] { quit(); });
|
||||
exec();
|
||||
@@ -206,7 +290,7 @@ bool AmneziaApplication::parseCommands()
|
||||
|
||||
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) && !defined(MACOS_NE)
|
||||
void AmneziaApplication::startLocalServer() {
|
||||
const QString serverName("AmneziaVPNInstance");
|
||||
const QString serverName(APP_INSTANCE_NAME);
|
||||
QLocalServer::removeServer(serverName);
|
||||
|
||||
QLocalServer *server = new QLocalServer(this);
|
||||
@@ -228,8 +312,12 @@ bool AmneziaApplication::eventFilter(QObject *watched, QEvent *event)
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||
quit();
|
||||
#else
|
||||
if (m_coreController && m_coreController->pageController()) {
|
||||
m_coreController->pageController()->hideMainWindow();
|
||||
if (m_forceQuit) {
|
||||
quit();
|
||||
} else {
|
||||
if (m_coreController && m_coreController->pageController()) {
|
||||
m_coreController->pageController()->hideMainWindow();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return true; // eat the close
|
||||
@@ -238,6 +326,12 @@ bool AmneziaApplication::eventFilter(QObject *watched, QEvent *event)
|
||||
return QObject::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
void AmneziaApplication::forceQuit()
|
||||
{
|
||||
m_forceQuit = true;
|
||||
quit();
|
||||
}
|
||||
|
||||
QQmlApplicationEngine *AmneziaApplication::qmlEngine() const
|
||||
{
|
||||
return m_engine;
|
||||
@@ -14,8 +14,10 @@
|
||||
#include <QClipboard>
|
||||
|
||||
#include "core/controllers/coreController.h"
|
||||
#include "settings.h"
|
||||
#include "vpnconnection.h"
|
||||
#include "secureQSettings.h"
|
||||
#include "vpnConnection.h"
|
||||
#include "ui/models/containerProps.h"
|
||||
#include "ui/models/protocolProps.h"
|
||||
|
||||
#define amnApp (static_cast<AmneziaApplication *>(QCoreApplication::instance()))
|
||||
|
||||
@@ -45,9 +47,13 @@ public:
|
||||
QNetworkAccessManager *networkManager();
|
||||
QClipboard *getClipboard();
|
||||
|
||||
public slots:
|
||||
void forceQuit();
|
||||
|
||||
private:
|
||||
static bool m_forceQuit;
|
||||
QQmlApplicationEngine *m_engine {};
|
||||
std::shared_ptr<Settings> m_settings;
|
||||
SecureQSettings* m_settings;
|
||||
|
||||
QScopedPointer<CoreController> m_coreController;
|
||||
|
||||
@@ -56,6 +62,11 @@ private:
|
||||
|
||||
QCommandLineParser m_parser;
|
||||
|
||||
QCommandLineOption m_optAutostart;
|
||||
QCommandLineOption m_optCleanup;
|
||||
QCommandLineOption m_optConnect;
|
||||
QCommandLineOption m_optImport;
|
||||
|
||||
QSharedPointer<VpnConnection> m_vpnConnection;
|
||||
QThread m_vpnConnectionThread;
|
||||
|
||||
@@ -45,7 +45,8 @@
|
||||
android:configChanges="uiMode|screenSize|smallestScreenSize|screenLayout|orientation|density
|
||||
|fontScale|layoutDirection|locale|keyboard|keyboardHidden|navigation|mcc|mnc"
|
||||
android:launchMode="singleInstance"
|
||||
android:windowSoftInputMode="stateUnchanged|adjustResize"
|
||||
android:windowSoftInputMode="adjustResize|stateUnchanged"
|
||||
android:enableOnBackInvokedCallback="false"
|
||||
android:exported="true">
|
||||
|
||||
<intent-filter>
|
||||
@@ -152,34 +153,8 @@
|
||||
</activity>
|
||||
|
||||
<service
|
||||
android:name=".AwgService"
|
||||
android:process=":amneziaAwgService"
|
||||
android:permission="android.permission.BIND_VPN_SERVICE"
|
||||
android:foregroundServiceType="systemExempted"
|
||||
android:exported="false"
|
||||
tools:ignore="ForegroundServicePermission">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.net.VpnService" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<service
|
||||
android:name=".OpenVpnService"
|
||||
android:process=":amneziaOpenVpnService"
|
||||
android:permission="android.permission.BIND_VPN_SERVICE"
|
||||
android:foregroundServiceType="systemExempted"
|
||||
android:exported="false"
|
||||
tools:ignore="ForegroundServicePermission">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.net.VpnService" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<service
|
||||
android:name=".XrayService"
|
||||
android:process=":amneziaXrayService"
|
||||
android:name=".XtunService"
|
||||
android:process=":amneziaVpnService"
|
||||
android:permission="android.permission.BIND_VPN_SERVICE"
|
||||
android:foregroundServiceType="systemExempted"
|
||||
android:exported="false"
|
||||
@@ -214,4 +189,4 @@
|
||||
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/qtprovider_paths" />
|
||||
</provider>
|
||||
</application>
|
||||
</manifest>
|
||||
</manifest>
|
||||
@@ -1,18 +0,0 @@
|
||||
plugins {
|
||||
id(libs.plugins.android.library.get().pluginId)
|
||||
id(libs.plugins.kotlin.android.get().pluginId)
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(17)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "org.amnezia.vpn.protocol.awg"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":utils"))
|
||||
compileOnly(project(":protocolApi"))
|
||||
implementation(project(":wireguard"))
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package org.amnezia.vpn.protocol.awg
|
||||
|
||||
import org.amnezia.vpn.protocol.wireguard.Wireguard
|
||||
import org.amnezia.vpn.protocol.wireguard.WireguardConfig
|
||||
import org.json.JSONObject
|
||||
|
||||
class Awg : Wireguard() {
|
||||
|
||||
override val ifName: String = "awg0"
|
||||
|
||||
override fun parseConfig(config: JSONObject): WireguardConfig {
|
||||
val configData = config.getJSONObject("awg_config_data")
|
||||
return WireguardConfig.build {
|
||||
setUseProtocolExtension(true)
|
||||
configExtensionParameters(configData)
|
||||
configWireguard(config, configData)
|
||||
configSplitTunneling(config)
|
||||
configAppSplitTunneling(config)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,11 +8,12 @@ kotlin {
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "org.amnezia.vpn.protocol.openvpn"
|
||||
namespace = "org.amnezia.vpn.billing"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":utils"))
|
||||
compileOnly(project(":protocolApi"))
|
||||
implementation(libs.androidx.core)
|
||||
implementation(libs.kotlinx.coroutines)
|
||||
implementation(libs.android.billing)
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
import com.android.billingclient.api.BillingClient.BillingResponseCode.BILLING_UNAVAILABLE
|
||||
import com.android.billingclient.api.BillingClient.BillingResponseCode.DEVELOPER_ERROR
|
||||
import com.android.billingclient.api.BillingClient.BillingResponseCode.ERROR
|
||||
import com.android.billingclient.api.BillingClient.BillingResponseCode.FEATURE_NOT_SUPPORTED
|
||||
import com.android.billingclient.api.BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED
|
||||
import com.android.billingclient.api.BillingClient.BillingResponseCode.ITEM_NOT_OWNED
|
||||
import com.android.billingclient.api.BillingClient.BillingResponseCode.ITEM_UNAVAILABLE
|
||||
import com.android.billingclient.api.BillingClient.BillingResponseCode.NETWORK_ERROR
|
||||
import com.android.billingclient.api.BillingClient.BillingResponseCode.SERVICE_DISCONNECTED
|
||||
import com.android.billingclient.api.BillingClient.BillingResponseCode.SERVICE_UNAVAILABLE
|
||||
import com.android.billingclient.api.BillingClient.BillingResponseCode.USER_CANCELED
|
||||
import com.android.billingclient.api.BillingResult
|
||||
import org.amnezia.vpn.util.ErrorCode
|
||||
|
||||
internal class BillingException(
|
||||
billingResult: BillingResult,
|
||||
retryable: Boolean? = null
|
||||
) : Exception(billingResult.toString()) {
|
||||
|
||||
constructor(msg: String) : this(BillingResult.newBuilder()
|
||||
.setResponseCode(DEVELOPER_ERROR)
|
||||
.setDebugMessage(msg)
|
||||
.build())
|
||||
|
||||
val errorCode: Int
|
||||
val isCanceled = billingResult.responseCode == USER_CANCELED
|
||||
val isRetryable = retryable ?: (billingResult.responseCode in setOf(
|
||||
NETWORK_ERROR,
|
||||
SERVICE_DISCONNECTED,
|
||||
SERVICE_UNAVAILABLE,
|
||||
ERROR
|
||||
))
|
||||
|
||||
init {
|
||||
when (billingResult.responseCode) {
|
||||
ERROR -> {
|
||||
errorCode = ErrorCode.BillingGooglePlayError
|
||||
}
|
||||
|
||||
BILLING_UNAVAILABLE, SERVICE_DISCONNECTED, SERVICE_UNAVAILABLE -> {
|
||||
errorCode = ErrorCode.BillingUnavailable
|
||||
}
|
||||
|
||||
DEVELOPER_ERROR, FEATURE_NOT_SUPPORTED, ITEM_NOT_OWNED -> {
|
||||
errorCode = ErrorCode.BillingError
|
||||
}
|
||||
|
||||
ITEM_ALREADY_OWNED -> {
|
||||
errorCode = ErrorCode.SubscriptionAlreadyOwned
|
||||
}
|
||||
|
||||
ITEM_UNAVAILABLE -> {
|
||||
errorCode = ErrorCode.SubscriptionUnavailable
|
||||
}
|
||||
|
||||
NETWORK_ERROR -> {
|
||||
errorCode = ErrorCode.BillingNetworkError
|
||||
}
|
||||
|
||||
else -> {
|
||||
errorCode = ErrorCode.BillingError
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,349 @@
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import com.android.billingclient.api.AcknowledgePurchaseParams
|
||||
import com.android.billingclient.api.BillingClient
|
||||
import com.android.billingclient.api.BillingClient.BillingResponseCode
|
||||
import com.android.billingclient.api.BillingClient.ProductType
|
||||
import com.android.billingclient.api.BillingClientStateListener
|
||||
import com.android.billingclient.api.BillingFlowParams
|
||||
import com.android.billingclient.api.BillingFlowParams.SubscriptionUpdateParams.ReplacementMode
|
||||
import com.android.billingclient.api.BillingResult
|
||||
import com.android.billingclient.api.GetBillingConfigParams
|
||||
import com.android.billingclient.api.PendingPurchasesParams
|
||||
import com.android.billingclient.api.ProductDetails
|
||||
import com.android.billingclient.api.Purchase
|
||||
import com.android.billingclient.api.PurchasesUpdatedListener
|
||||
import com.android.billingclient.api.QueryProductDetailsParams
|
||||
import com.android.billingclient.api.QueryProductDetailsParams.Product
|
||||
import com.android.billingclient.api.QueryPurchasesParams
|
||||
import com.android.billingclient.api.acknowledgePurchase
|
||||
import com.android.billingclient.api.queryProductDetails
|
||||
import com.android.billingclient.api.queryPurchasesAsync
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.firstOrNull
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.amnezia.vpn.util.ErrorCode
|
||||
import org.amnezia.vpn.util.Log
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import java.text.NumberFormat
|
||||
import java.util.Currency
|
||||
|
||||
private const val TAG = "BillingProvider"
|
||||
private const val PRODUCT_ID = "premium"
|
||||
|
||||
private val billingPeriodRegex = Regex("""P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?""")
|
||||
|
||||
private fun billingPeriodToMonths(period: String): Double {
|
||||
val match = billingPeriodRegex.matchEntire(period) ?: return 0.0
|
||||
val years = match.groupValues[1].toDoubleOrNull() ?: 0.0
|
||||
val months = match.groupValues[2].toDoubleOrNull() ?: 0.0
|
||||
val weeks = match.groupValues[3].toDoubleOrNull() ?: 0.0
|
||||
val days = match.groupValues[4].toDoubleOrNull() ?: 0.0
|
||||
return years * 12.0 + months + weeks * 7.0 / 30.0 + days / 30.0
|
||||
}
|
||||
|
||||
private fun billingPeriodToDays(period: String): Int {
|
||||
val match = billingPeriodRegex.matchEntire(period) ?: return 0
|
||||
val years = match.groupValues[1].toIntOrNull() ?: 0
|
||||
val months = match.groupValues[2].toIntOrNull() ?: 0
|
||||
val weeks = match.groupValues[3].toIntOrNull() ?: 0
|
||||
val days = match.groupValues[4].toIntOrNull() ?: 0
|
||||
return years * 365 + months * 30 + weeks * 7 + days
|
||||
}
|
||||
|
||||
private fun displayPricePerMonth(priceAmountMicros: Long, currencyCode: String, billingMonths: Double): String? {
|
||||
if (billingMonths <= 1e-6 || currencyCode.isBlank()) return null
|
||||
return try {
|
||||
val amountPerMonth = (priceAmountMicros / 1_000_000.0) / billingMonths
|
||||
NumberFormat.getCurrencyInstance().apply { currency = Currency.getInstance(currencyCode) }
|
||||
.format(amountPerMonth)
|
||||
} catch (e: IllegalArgumentException) {
|
||||
Log.w(TAG, "Unknown currency code from Play Billing: $currencyCode")
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
class BillingProvider(context: Context) : AutoCloseable {
|
||||
|
||||
private var billingClient: BillingClient
|
||||
private var subscriptionPurchases = MutableStateFlow<Pair<BillingResult, List<Purchase>?>?>(null)
|
||||
|
||||
private val purchasesUpdatedListeners = PurchasesUpdatedListener { billingResult, purchases ->
|
||||
subscriptionPurchases.value = billingResult to purchases
|
||||
}
|
||||
|
||||
init {
|
||||
billingClient = BillingClient.newBuilder(context)
|
||||
.setListener(purchasesUpdatedListeners)
|
||||
.enablePendingPurchases(PendingPurchasesParams.newBuilder().enableOneTimeProducts().build())
|
||||
.build()
|
||||
}
|
||||
|
||||
private suspend fun connect() {
|
||||
if (billingClient.isReady) return
|
||||
|
||||
val connection = CompletableDeferred<Unit>()
|
||||
withContext(Dispatchers.IO) {
|
||||
billingClient.startConnection(object : BillingClientStateListener {
|
||||
override fun onBillingSetupFinished(billingResult: BillingResult) {
|
||||
if (billingResult.isOk) {
|
||||
connection.complete(Unit)
|
||||
} else {
|
||||
Log.e(TAG, "Billing setup failed: $billingResult")
|
||||
connection.completeExceptionally(BillingException(billingResult))
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBillingServiceDisconnected() {
|
||||
Log.w(TAG, "Billing service disconnected")
|
||||
}
|
||||
})
|
||||
}
|
||||
connection.await()
|
||||
}
|
||||
|
||||
private suspend fun handleBillingApiCall(block: suspend () -> JSONObject): JSONObject {
|
||||
val numberAttempts = 3
|
||||
var attemptCount = 0
|
||||
while (true) {
|
||||
try {
|
||||
return block()
|
||||
} catch (e: BillingException) {
|
||||
if (e.isCanceled) {
|
||||
Log.w(TAG, "Billing canceled")
|
||||
return JSONObject().put("responseCode", ErrorCode.BillingCanceled)
|
||||
} else if (e.isRetryable && attemptCount < numberAttempts) {
|
||||
Log.d(TAG, "Retryable error: $e")
|
||||
++attemptCount
|
||||
delay(1000)
|
||||
} else {
|
||||
Log.e(TAG, "Billing error: $e")
|
||||
return JSONObject().put("responseCode", e.errorCode)
|
||||
}
|
||||
} catch (_: CancellationException) {
|
||||
Log.w(TAG, "Billing coroutine canceled")
|
||||
return JSONObject().put("responseCode", ErrorCode.BillingCanceled)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun getSubscriptionPlans(): JSONObject {
|
||||
val productDetailsList = getProductDetails()
|
||||
val resultJson = JSONObject().put("responseCode", ErrorCode.NoError)
|
||||
val productArray = JSONArray().also { resultJson.put("products", it) }
|
||||
productDetailsList?.forEach { productDetails ->
|
||||
val product = JSONObject().also { productArray.put(it) }
|
||||
.put("productId", productDetails.productId)
|
||||
.put("name", productDetails.name)
|
||||
val offers = JSONArray().also { product.put("offers", it) }
|
||||
productDetails.subscriptionOfferDetails?.forEach { offerDetails ->
|
||||
val offer = JSONObject().also { offers.put(it) }
|
||||
.put("basePlanId", offerDetails.basePlanId)
|
||||
.put("offerId", offerDetails.offerId)
|
||||
.put("offerToken", offerDetails.offerToken)
|
||||
val pricingPhases = JSONArray().also { offer.put("pricingPhases", it) }
|
||||
offerDetails.pricingPhases.pricingPhaseList.forEach { phase ->
|
||||
val billingMonths = billingPeriodToMonths(phase.billingPeriod)
|
||||
JSONObject().also { pricingPhases.put(it) }
|
||||
.put("billingCycleCount", phase.billingCycleCount)
|
||||
.put("billingPeriod", phase.billingPeriod)
|
||||
.put("formattedPrice", phase.formattedPrice)
|
||||
.put("priceAmountMicros", phase.priceAmountMicros)
|
||||
.put("recurrenceMode", phase.recurrenceMode)
|
||||
.put("subscriptionBillingMonths", billingMonths)
|
||||
.apply {
|
||||
displayPricePerMonth(phase.priceAmountMicros, phase.priceCurrencyCode, billingMonths)?.let {
|
||||
put("displayPricePerMonth", it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val trialPhase = offerDetails.pricingPhases.pricingPhaseList.firstOrNull()
|
||||
val hasFreeTrial = trialPhase != null && trialPhase.priceAmountMicros == 0L
|
||||
offer.put("hasFreeTrial", hasFreeTrial)
|
||||
if (hasFreeTrial) {
|
||||
offer.put("trialDays", billingPeriodToDays(trialPhase!!.billingPeriod))
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultJson
|
||||
}
|
||||
|
||||
private suspend fun getProductDetails(): List<ProductDetails>? {
|
||||
val productDetailsParams = Product.newBuilder()
|
||||
.setProductId(PRODUCT_ID)
|
||||
.setProductType(ProductType.SUBS)
|
||||
.build()
|
||||
|
||||
val queryProductDetailsParams = QueryProductDetailsParams.newBuilder()
|
||||
.setProductList(listOf(productDetailsParams))
|
||||
.build()
|
||||
|
||||
val result = withContext(Dispatchers.IO) {
|
||||
billingClient.queryProductDetails(queryProductDetailsParams)
|
||||
}
|
||||
|
||||
if (!result.billingResult.isOk) {
|
||||
Log.e(TAG, "Failed to get product details: ${result.billingResult}")
|
||||
throw BillingException(result.billingResult)
|
||||
}
|
||||
|
||||
return result.productDetailsList
|
||||
}
|
||||
|
||||
suspend fun getCustomerCountryCode(): JSONObject {
|
||||
val deferred = CompletableDeferred<String>()
|
||||
withContext(Dispatchers.IO) {
|
||||
billingClient.getBillingConfigAsync(GetBillingConfigParams.newBuilder().build(),
|
||||
{ billingResult, billingConfig ->
|
||||
Log.v(TAG, "Billing config: $billingResult, ${billingConfig?.countryCode}")
|
||||
if (billingResult.isOk) {
|
||||
deferred.complete(billingConfig?.countryCode ?: "")
|
||||
} else {
|
||||
deferred.completeExceptionally(BillingException(billingResult))
|
||||
}
|
||||
})
|
||||
}
|
||||
val countryCode = deferred.await()
|
||||
|
||||
return JSONObject()
|
||||
.put("responseCode", ErrorCode.NoError)
|
||||
.put("countryCode", countryCode)
|
||||
}
|
||||
|
||||
suspend fun purchaseSubscription(
|
||||
activity: Activity,
|
||||
offerToken: String,
|
||||
oldPurchaseToken: String? = null
|
||||
): JSONObject {
|
||||
if (offerToken.isBlank()) throw BillingException("offerToken can not be empty")
|
||||
|
||||
subscriptionPurchases.value = null
|
||||
|
||||
val productDetails = getProductDetails()?.firstOrNull { it.productId == PRODUCT_ID }
|
||||
?: throw BillingException("Product details not found")
|
||||
|
||||
val productDetail = BillingFlowParams.ProductDetailsParams.newBuilder()
|
||||
.setProductDetails(productDetails)
|
||||
.setOfferToken(offerToken)
|
||||
.build()
|
||||
|
||||
val subscriptionUpdateParams = oldPurchaseToken?.let {
|
||||
// Per Google Play docs, switching between auto-renewing plans within the same
|
||||
// subscription only supports CHARGE_FULL_PRICE or WITHOUT_PRORATION - any other mode
|
||||
// (e.g. CHARGE_PRORATED_PRICE) is rejected with DEVELOPER_ERROR "Requested replacement
|
||||
// mode is not supported for this request".
|
||||
BillingFlowParams.SubscriptionUpdateParams.newBuilder()
|
||||
.setOldPurchaseToken(oldPurchaseToken)
|
||||
.setSubscriptionReplacementMode(ReplacementMode.CHARGE_FULL_PRICE)
|
||||
.build()
|
||||
}
|
||||
|
||||
val billingResult = withContext(Dispatchers.Main.immediate) {
|
||||
billingClient.launchBillingFlow(activity, BillingFlowParams.newBuilder()
|
||||
.setProductDetailsParamsList(listOf(productDetail))
|
||||
.apply { subscriptionUpdateParams?.let { setSubscriptionUpdateParams(it) } }
|
||||
.build())
|
||||
}
|
||||
|
||||
if (billingResult.responseCode == BillingResponseCode.ITEM_ALREADY_OWNED) {
|
||||
Log.w(TAG, "Attempting to purchase already owned product")
|
||||
val purchases = queryPurchases()
|
||||
if (purchases.any { PRODUCT_ID in it.products }) throw BillingException(billingResult)
|
||||
else throw BillingException(billingResult, retryable = true)
|
||||
} else if (billingResult.responseCode == BillingResponseCode.ITEM_NOT_OWNED) {
|
||||
Log.w(TAG, "Attempting to replace not owned product")
|
||||
val purchases = queryPurchases()
|
||||
if (purchases.all { PRODUCT_ID !in it.products }) throw BillingException(billingResult)
|
||||
else throw BillingException(billingResult, retryable = true)
|
||||
} else if (!billingResult.isOk) throw BillingException(billingResult)
|
||||
|
||||
subscriptionPurchases.firstOrNull { it != null }?.let { (billingResult, purchases) ->
|
||||
if (!billingResult.isOk) throw BillingException(billingResult, retryable = false)
|
||||
return JSONObject()
|
||||
.put("responseCode", ErrorCode.NoError)
|
||||
.put("purchases", processPurchases(purchases))
|
||||
} ?: throw BillingException("Purchase failed")
|
||||
}
|
||||
|
||||
private fun processPurchases(purchases: List<Purchase>?): JSONArray {
|
||||
val purchaseArray = JSONArray()
|
||||
purchases?.forEach { purchase ->
|
||||
Log.v(TAG, "processPurchases: orderId=${purchase.orderId} state=${purchase.purchaseState} products=${purchase.products}")
|
||||
JSONObject().also { purchaseArray.put(it) }
|
||||
.put("purchaseToken", purchase.purchaseToken)
|
||||
.put("purchaseTime", purchase.purchaseTime)
|
||||
.put("purchaseState", purchase.purchaseState)
|
||||
.put("isAcknowledged", purchase.isAcknowledged)
|
||||
.put("isAutoRenewing", purchase.isAutoRenewing)
|
||||
.put("orderId", purchase.orderId)
|
||||
.put("productIds", JSONArray(purchase.products))
|
||||
}
|
||||
return purchaseArray
|
||||
}
|
||||
|
||||
suspend fun acknowledge(purchaseToken: String): JSONObject {
|
||||
Log.v(TAG, "Acknowledge purchase")
|
||||
|
||||
val result = withContext(Dispatchers.IO) {
|
||||
billingClient.acknowledgePurchase(
|
||||
AcknowledgePurchaseParams.newBuilder()
|
||||
.setPurchaseToken(purchaseToken)
|
||||
.build()
|
||||
)
|
||||
}
|
||||
|
||||
Log.v(TAG, "Acknowledge purchase result: $result")
|
||||
|
||||
if (result.responseCode == BillingResponseCode.ITEM_NOT_OWNED) {
|
||||
Log.w(TAG, "Attempting to acknowledge not owned product")
|
||||
val purchases = queryPurchases()
|
||||
if (purchases.all { PRODUCT_ID !in it.products }) throw BillingException(result)
|
||||
else throw BillingException(result, retryable = true)
|
||||
} else if (!result.isOk && result.responseCode != BillingResponseCode.ITEM_ALREADY_OWNED) {
|
||||
throw BillingException(result)
|
||||
}
|
||||
|
||||
return JSONObject().put("responseCode", ErrorCode.NoError)
|
||||
}
|
||||
|
||||
suspend fun getPurchases(): JSONObject {
|
||||
val purchases = queryPurchases()
|
||||
return JSONObject()
|
||||
.put("responseCode", ErrorCode.NoError)
|
||||
.put("purchases", processPurchases(purchases))
|
||||
}
|
||||
|
||||
private suspend fun queryPurchases(): List<Purchase> {
|
||||
val result = withContext(Dispatchers.IO) {
|
||||
billingClient.queryPurchasesAsync(
|
||||
QueryPurchasesParams.newBuilder().setProductType(ProductType.SUBS).build()
|
||||
)
|
||||
}
|
||||
Log.v(TAG, "Query purchases result: ${result.billingResult}")
|
||||
if (!result.billingResult.isOk) throw BillingException(result.billingResult)
|
||||
return result.purchasesList
|
||||
}
|
||||
|
||||
override fun close() {
|
||||
billingClient.endConnection()
|
||||
}
|
||||
|
||||
companion object {
|
||||
suspend fun withBillingProvider(context: Context, block: suspend BillingProvider.() -> JSONObject): String =
|
||||
BillingProvider(context).use { bp ->
|
||||
bp.handleBillingApiCall {
|
||||
bp.connect()
|
||||
bp.block()
|
||||
}.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal val BillingResult.isOk: Boolean
|
||||
get() = responseCode == BillingResponseCode.OK
|
||||
@@ -20,6 +20,7 @@ android {
|
||||
namespace = "org.amnezia.vpn"
|
||||
|
||||
buildFeatures {
|
||||
buildConfig = true
|
||||
viewBinding = true
|
||||
}
|
||||
|
||||
@@ -33,31 +34,27 @@ android {
|
||||
jniLibs.useLegacyPackaging = true
|
||||
}
|
||||
|
||||
val abiList = qtTargetAbiList.split(",")
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "org.amnezia.vpn"
|
||||
targetSdk = qtTargetSdkVersion.toInt()
|
||||
|
||||
// keeps language resources for only the locales specified below
|
||||
resourceConfigurations += listOf("en", "ru", "b+zh+Hans")
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
getByName("main") {
|
||||
manifest.srcFile("AndroidManifest.xml")
|
||||
java.setSrcDirs(listOf("src"))
|
||||
res.setSrcDirs(listOf("res"))
|
||||
// androyddeployqt creates the folders below
|
||||
assets.setSrcDirs(listOf("assets"))
|
||||
jniLibs.setSrcDirs(listOf("libs"))
|
||||
// ndk.abiFilters is only used for single-ABI builds; multi-ABI uses splits below
|
||||
if (abiList.size == 1) {
|
||||
ndk.abiFilters += abiList
|
||||
}
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
register("release") {
|
||||
storeFile = providers.environmentVariable("ANDROID_KEYSTORE_PATH").orNull?.let { file(it) }
|
||||
storePassword = providers.environmentVariable("ANDROID_KEYSTORE_KEY_PASS").orNull
|
||||
keyAlias = providers.environmentVariable("ANDROID_KEYSTORE_KEY_ALIAS").orNull
|
||||
keyPassword = providers.environmentVariable("ANDROID_KEYSTORE_KEY_PASS").orNull
|
||||
storeFile = providers.environmentVariable("QT_ANDROID_KEYSTORE_PATH").orNull?.let { file(it) }
|
||||
storePassword = providers.environmentVariable("QT_ANDROID_KEYSTORE_STORE_PASS").orNull
|
||||
keyAlias = providers.environmentVariable("QT_ANDROID_KEYSTORE_ALIAS").orNull
|
||||
keyPassword = providers.environmentVariable("QT_ANDROID_KEYSTORE_STORE_PASS").orNull
|
||||
enableV3Signing = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,12 +74,45 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
flavorDimensions += "billing"
|
||||
|
||||
productFlavors {
|
||||
create("oss") {
|
||||
dimension = "billing"
|
||||
buildConfigField("boolean", "IS_PLAY_BUILD", "false")
|
||||
}
|
||||
create("play") {
|
||||
dimension = "billing"
|
||||
buildConfigField("boolean", "IS_PLAY_BUILD", "true")
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
getByName("main") {
|
||||
manifest.srcFile("AndroidManifest.xml")
|
||||
java.setSrcDirs(listOf("src"))
|
||||
res.setSrcDirs(listOf("res"))
|
||||
// androyddeployqt creates the folders below
|
||||
assets.setSrcDirs(listOf("assets"))
|
||||
jniLibs.setSrcDirs(listOf("libs"))
|
||||
}
|
||||
|
||||
getByName("oss") {
|
||||
java.setSrcDirs(listOf("oss"))
|
||||
}
|
||||
|
||||
getByName("play") {
|
||||
java.setSrcDirs(listOf("play"))
|
||||
}
|
||||
}
|
||||
|
||||
splits {
|
||||
abi {
|
||||
isEnable = true
|
||||
// splits only make sense for multi-ABI builds; single-ABI uses ndk.abiFilters
|
||||
isEnable = abiList.size > 1
|
||||
reset()
|
||||
include(*qtTargetAbiList.split(',').toTypedArray())
|
||||
isUniversalApk = false
|
||||
include(*abiList.toTypedArray())
|
||||
isUniversalApk = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,12 +123,54 @@ android {
|
||||
outputs.map { it as BaseVariantOutputImpl }
|
||||
.forEach { output ->
|
||||
if (output.outputFileName.endsWith(".apk")) {
|
||||
output.outputFileName = "$outputBaseName-${buildType.name}.apk"
|
||||
output.outputFileName = listOfNotNull(outputBaseName, output.getFilter("ABI"), buildType.name)
|
||||
.joinToString("-", postfix = ".apk")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// androiddeployqt expects:
|
||||
// APK: build/outputs/apk/{base}-{buildType}[-unsigned].apk (no flavor subdir)
|
||||
// AAB: build/outputs/bundle/{buildType}/{base}-{buildType}.aab (no flavor subdir)
|
||||
// where {base} = outputBaseName (set by Qt Creator) or "android-build" (CI fallback).
|
||||
// Release APK gets -unsigned suffix (Qt cmake signs it); debug does not.
|
||||
// Copy only oss flavor to the flat output dir that androiddeployqt/Qt Creator expect.
|
||||
// Play flavor is built via android_play_apk/android_play_aab cmake targets and uses
|
||||
// its native Gradle output paths directly.
|
||||
applicationVariants.all {
|
||||
val flavorName = productFlavors.firstOrNull()?.name ?: ""
|
||||
val buildTypeName = buildType.name
|
||||
if (flavorName == "oss") {
|
||||
val base = outputBaseName.ifEmpty { "android-build" }
|
||||
val unsignedSuffix = if (buildTypeName == "release") "-unsigned" else ""
|
||||
|
||||
val universalOutput = outputs.map { it as BaseVariantOutputImpl }.first { it.getFilter("ABI") == null }
|
||||
|
||||
packageApplicationProvider.configure {
|
||||
doLast {
|
||||
val srcDir = layout.buildDirectory.dir("outputs/apk/oss/$buildTypeName").get().asFile
|
||||
val dstDir = layout.buildDirectory.dir("outputs/apk").get().asFile
|
||||
dstDir.mkdirs()
|
||||
File(srcDir, universalOutput.outputFileName)
|
||||
.copyTo(File(dstDir, "$base-$buildTypeName$unsignedSuffix.apk"), overwrite = true)
|
||||
}
|
||||
}
|
||||
|
||||
val variantName = name
|
||||
tasks.named("bundle${variantName.replaceFirstChar { it.uppercase() }}") {
|
||||
doLast {
|
||||
val srcDir = layout.buildDirectory.dir("outputs/bundle/$variantName").get().asFile
|
||||
val dstDir = layout.buildDirectory.dir("outputs/bundle/$buildTypeName").get().asFile
|
||||
dstDir.mkdirs()
|
||||
srcDir.listFiles()?.filter { it.name.endsWith(".aab") }?.forEach { aab ->
|
||||
aab.copyTo(File(dstDir, "$base-$buildTypeName.aab"), overwrite = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lint {
|
||||
disable += "InvalidFragmentVersionForActivityResult"
|
||||
}
|
||||
@@ -108,11 +180,7 @@ dependencies {
|
||||
implementation(project(":qt"))
|
||||
implementation(project(":utils"))
|
||||
implementation(project(":protocolApi"))
|
||||
implementation(project(":wireguard"))
|
||||
implementation(project(":awg"))
|
||||
implementation(project(":openvpn"))
|
||||
implementation(project(":cloak"))
|
||||
implementation(project(":xray"))
|
||||
implementation(project(":xtun"))
|
||||
implementation(libs.androidx.core)
|
||||
implementation(libs.androidx.activity)
|
||||
implementation(libs.androidx.fragment)
|
||||
@@ -122,4 +190,9 @@ dependencies {
|
||||
implementation(libs.google.mlkit)
|
||||
implementation(libs.androidx.datastore)
|
||||
implementation(libs.androidx.biometric)
|
||||
|
||||
playImplementation(project(":billing"))
|
||||
}
|
||||
|
||||
fun DependencyHandler.playImplementation(dependency: Any): Dependency? =
|
||||
add("playImplementation", dependency)
|
||||
@@ -1,18 +0,0 @@
|
||||
plugins {
|
||||
id(libs.plugins.android.library.get().pluginId)
|
||||
id(libs.plugins.kotlin.android.get().pluginId)
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(17)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "org.amnezia.vpn.protocol.cloak"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":utils"))
|
||||
compileOnly(project(":protocolApi"))
|
||||
implementation(project(":openvpn"))
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package org.amnezia.vpn.protocol.cloak
|
||||
|
||||
import android.util.Base64
|
||||
import net.openvpn.ovpn3.ClientAPI_Config
|
||||
import org.amnezia.vpn.protocol.openvpn.OpenVpn
|
||||
import org.amnezia.vpn.util.LibraryLoader.loadSharedLibrary
|
||||
import org.json.JSONObject
|
||||
|
||||
class Cloak : OpenVpn() {
|
||||
|
||||
override fun internalInit() {
|
||||
super.internalInit()
|
||||
if (!isInitialized) loadSharedLibrary(context, "ck-ovpn-plugin")
|
||||
}
|
||||
|
||||
override fun parseConfig(config: JSONObject): ClientAPI_Config {
|
||||
val openVpnConfig = ClientAPI_Config()
|
||||
|
||||
val openVpnConfigStr = config.getJSONObject("openvpn_config_data").getString("config")
|
||||
val cloakConfigJson = checkCloakJson(config.getJSONObject("cloak_config_data"))
|
||||
val cloakConfigStr = Base64.encodeToString(cloakConfigJson.toString().toByteArray(), Base64.DEFAULT)
|
||||
|
||||
val configStr = "$openVpnConfigStr\n<cloak>\n$cloakConfigStr\n</cloak>\n"
|
||||
|
||||
openVpnConfig.usePluggableTransports = true
|
||||
openVpnConfig.content = configStr
|
||||
return openVpnConfig
|
||||
}
|
||||
|
||||
private fun checkCloakJson(cloakConfigJson: JSONObject): JSONObject {
|
||||
cloakConfigJson.put("NumConn", 1)
|
||||
cloakConfigJson.put("ProxyMethod", "openvpn")
|
||||
if (cloakConfigJson.has("port")) {
|
||||
val port = cloakConfigJson["port"]
|
||||
cloakConfigJson.remove("port")
|
||||
cloakConfigJson.put("RemotePort", port)
|
||||
}
|
||||
if (cloakConfigJson.has("remote")) {
|
||||
val remote = cloakConfigJson["remote"]
|
||||
cloakConfigJson.remove("remote")
|
||||
cloakConfigJson.put("RemoteHost", remote)
|
||||
}
|
||||
return cloakConfigJson
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,22 @@
|
||||
[versions]
|
||||
agp = "8.5.2"
|
||||
kotlin = "1.9.24"
|
||||
agp = "8.6.1"
|
||||
kotlin = "2.1.0"
|
||||
android-billing = "8.0.0"
|
||||
androidx-core = "1.13.1"
|
||||
androidx-activity = "1.9.1"
|
||||
androidx-annotation = "1.8.2"
|
||||
androidx-biometric = "1.2.0-alpha05"
|
||||
androidx-camera = "1.3.4"
|
||||
androidx-camera = "1.5.3"
|
||||
androidx-fragment = "1.8.2"
|
||||
androidx-security-crypto = "1.1.0-alpha06"
|
||||
androidx-datastore = "1.1.1"
|
||||
kotlinx-coroutines = "1.8.1"
|
||||
kotlinx-serialization = "1.6.3"
|
||||
google-mlkit = "17.3.0"
|
||||
amnezia-xtun = "0.0.2-rc4"
|
||||
|
||||
[libraries]
|
||||
android-billing = { module = "com.android.billingclient:billing-ktx", version.ref = "android-billing" }
|
||||
androidx-core = { module = "androidx.core:core-ktx", version.ref = "androidx-core" }
|
||||
androidx-activity = { module = "androidx.activity:activity-ktx", version.ref = "androidx-activity" }
|
||||
androidx-annotation = { module = "androidx.annotation:annotation", version.ref = "androidx-annotation" }
|
||||
@@ -28,6 +31,7 @@ androidx-datastore = { module = "androidx.datastore:datastore-preferences", vers
|
||||
kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" }
|
||||
kotlinx-serialization-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "kotlinx-serialization" }
|
||||
google-mlkit = { module = "com.google.mlkit:barcode-scanning", version.ref = "google-mlkit" }
|
||||
amnezia-xtun = { module = "org.amnezia:xtun", version.ref = "amnezia-xtun" }
|
||||
|
||||
[bundles]
|
||||
androidx-camera = [
|
||||
|
||||
@@ -1,417 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_Config {
|
||||
private transient long swigCPtr;
|
||||
protected transient boolean swigCMemOwn;
|
||||
|
||||
protected ClientAPI_Config(long cPtr, boolean cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_Config obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_Config obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_Config(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void setContent(String value) {
|
||||
ovpncliJNI.ClientAPI_Config_content_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return ovpncliJNI.ClientAPI_Config_content_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setContentList(SWIGTYPE_p_std__vectorT_openvpn__ClientAPI__KeyValue_t value) {
|
||||
ovpncliJNI.ClientAPI_Config_contentList_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_openvpn__ClientAPI__KeyValue_t.getCPtr(value));
|
||||
}
|
||||
|
||||
public SWIGTYPE_p_std__vectorT_openvpn__ClientAPI__KeyValue_t getContentList() {
|
||||
long cPtr = ovpncliJNI.ClientAPI_Config_contentList_get(swigCPtr, this);
|
||||
return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_openvpn__ClientAPI__KeyValue_t(cPtr, false);
|
||||
}
|
||||
|
||||
public void setGuiVersion(String value) {
|
||||
ovpncliJNI.ClientAPI_Config_guiVersion_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getGuiVersion() {
|
||||
return ovpncliJNI.ClientAPI_Config_guiVersion_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setSsoMethods(String value) {
|
||||
ovpncliJNI.ClientAPI_Config_ssoMethods_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getSsoMethods() {
|
||||
return ovpncliJNI.ClientAPI_Config_ssoMethods_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setHwAddrOverride(String value) {
|
||||
ovpncliJNI.ClientAPI_Config_hwAddrOverride_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getHwAddrOverride() {
|
||||
return ovpncliJNI.ClientAPI_Config_hwAddrOverride_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setPlatformVersion(String value) {
|
||||
ovpncliJNI.ClientAPI_Config_platformVersion_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getPlatformVersion() {
|
||||
return ovpncliJNI.ClientAPI_Config_platformVersion_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setServerOverride(String value) {
|
||||
ovpncliJNI.ClientAPI_Config_serverOverride_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getServerOverride() {
|
||||
return ovpncliJNI.ClientAPI_Config_serverOverride_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setPortOverride(String value) {
|
||||
ovpncliJNI.ClientAPI_Config_portOverride_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getPortOverride() {
|
||||
return ovpncliJNI.ClientAPI_Config_portOverride_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setProtoOverride(String value) {
|
||||
ovpncliJNI.ClientAPI_Config_protoOverride_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getProtoOverride() {
|
||||
return ovpncliJNI.ClientAPI_Config_protoOverride_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setProtoVersionOverride(int value) {
|
||||
ovpncliJNI.ClientAPI_Config_protoVersionOverride_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public int getProtoVersionOverride() {
|
||||
return ovpncliJNI.ClientAPI_Config_protoVersionOverride_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setAllowUnusedAddrFamilies(String value) {
|
||||
ovpncliJNI.ClientAPI_Config_allowUnusedAddrFamilies_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getAllowUnusedAddrFamilies() {
|
||||
return ovpncliJNI.ClientAPI_Config_allowUnusedAddrFamilies_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setConnTimeout(int value) {
|
||||
ovpncliJNI.ClientAPI_Config_connTimeout_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public int getConnTimeout() {
|
||||
return ovpncliJNI.ClientAPI_Config_connTimeout_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setTunPersist(boolean value) {
|
||||
ovpncliJNI.ClientAPI_Config_tunPersist_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getTunPersist() {
|
||||
return ovpncliJNI.ClientAPI_Config_tunPersist_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setGoogleDnsFallback(boolean value) {
|
||||
ovpncliJNI.ClientAPI_Config_googleDnsFallback_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getGoogleDnsFallback() {
|
||||
return ovpncliJNI.ClientAPI_Config_googleDnsFallback_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setSynchronousDnsLookup(boolean value) {
|
||||
ovpncliJNI.ClientAPI_Config_synchronousDnsLookup_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getSynchronousDnsLookup() {
|
||||
return ovpncliJNI.ClientAPI_Config_synchronousDnsLookup_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setAutologinSessions(boolean value) {
|
||||
ovpncliJNI.ClientAPI_Config_autologinSessions_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getAutologinSessions() {
|
||||
return ovpncliJNI.ClientAPI_Config_autologinSessions_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setRetryOnAuthFailed(boolean value) {
|
||||
ovpncliJNI.ClientAPI_Config_retryOnAuthFailed_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getRetryOnAuthFailed() {
|
||||
return ovpncliJNI.ClientAPI_Config_retryOnAuthFailed_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setExternalPkiAlias(String value) {
|
||||
ovpncliJNI.ClientAPI_Config_externalPkiAlias_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getExternalPkiAlias() {
|
||||
return ovpncliJNI.ClientAPI_Config_externalPkiAlias_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setDisableClientCert(boolean value) {
|
||||
ovpncliJNI.ClientAPI_Config_disableClientCert_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getDisableClientCert() {
|
||||
return ovpncliJNI.ClientAPI_Config_disableClientCert_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setSslDebugLevel(int value) {
|
||||
ovpncliJNI.ClientAPI_Config_sslDebugLevel_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public int getSslDebugLevel() {
|
||||
return ovpncliJNI.ClientAPI_Config_sslDebugLevel_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setCompressionMode(String value) {
|
||||
ovpncliJNI.ClientAPI_Config_compressionMode_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getCompressionMode() {
|
||||
return ovpncliJNI.ClientAPI_Config_compressionMode_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setPrivateKeyPassword(String value) {
|
||||
ovpncliJNI.ClientAPI_Config_privateKeyPassword_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getPrivateKeyPassword() {
|
||||
return ovpncliJNI.ClientAPI_Config_privateKeyPassword_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setDefaultKeyDirection(int value) {
|
||||
ovpncliJNI.ClientAPI_Config_defaultKeyDirection_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public int getDefaultKeyDirection() {
|
||||
return ovpncliJNI.ClientAPI_Config_defaultKeyDirection_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setTlsVersionMinOverride(String value) {
|
||||
ovpncliJNI.ClientAPI_Config_tlsVersionMinOverride_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getTlsVersionMinOverride() {
|
||||
return ovpncliJNI.ClientAPI_Config_tlsVersionMinOverride_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setTlsCertProfileOverride(String value) {
|
||||
ovpncliJNI.ClientAPI_Config_tlsCertProfileOverride_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getTlsCertProfileOverride() {
|
||||
return ovpncliJNI.ClientAPI_Config_tlsCertProfileOverride_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setTlsCipherList(String value) {
|
||||
ovpncliJNI.ClientAPI_Config_tlsCipherList_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getTlsCipherList() {
|
||||
return ovpncliJNI.ClientAPI_Config_tlsCipherList_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setTlsCiphersuitesList(String value) {
|
||||
ovpncliJNI.ClientAPI_Config_tlsCiphersuitesList_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getTlsCiphersuitesList() {
|
||||
return ovpncliJNI.ClientAPI_Config_tlsCiphersuitesList_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setPeerInfo(SWIGTYPE_p_std__vectorT_openvpn__ClientAPI__KeyValue_t value) {
|
||||
ovpncliJNI.ClientAPI_Config_peerInfo_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_openvpn__ClientAPI__KeyValue_t.getCPtr(value));
|
||||
}
|
||||
|
||||
public SWIGTYPE_p_std__vectorT_openvpn__ClientAPI__KeyValue_t getPeerInfo() {
|
||||
long cPtr = ovpncliJNI.ClientAPI_Config_peerInfo_get(swigCPtr, this);
|
||||
return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_openvpn__ClientAPI__KeyValue_t(cPtr, false);
|
||||
}
|
||||
|
||||
public void setProxyHost(String value) {
|
||||
ovpncliJNI.ClientAPI_Config_proxyHost_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getProxyHost() {
|
||||
return ovpncliJNI.ClientAPI_Config_proxyHost_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setProxyPort(String value) {
|
||||
ovpncliJNI.ClientAPI_Config_proxyPort_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getProxyPort() {
|
||||
return ovpncliJNI.ClientAPI_Config_proxyPort_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setProxyUsername(String value) {
|
||||
ovpncliJNI.ClientAPI_Config_proxyUsername_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getProxyUsername() {
|
||||
return ovpncliJNI.ClientAPI_Config_proxyUsername_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setProxyPassword(String value) {
|
||||
ovpncliJNI.ClientAPI_Config_proxyPassword_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getProxyPassword() {
|
||||
return ovpncliJNI.ClientAPI_Config_proxyPassword_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setProxyAllowCleartextAuth(boolean value) {
|
||||
ovpncliJNI.ClientAPI_Config_proxyAllowCleartextAuth_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getProxyAllowCleartextAuth() {
|
||||
return ovpncliJNI.ClientAPI_Config_proxyAllowCleartextAuth_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setAltProxy(boolean value) {
|
||||
ovpncliJNI.ClientAPI_Config_altProxy_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getAltProxy() {
|
||||
return ovpncliJNI.ClientAPI_Config_altProxy_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setDco(boolean value) {
|
||||
ovpncliJNI.ClientAPI_Config_dco_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getDco() {
|
||||
return ovpncliJNI.ClientAPI_Config_dco_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setEcho(boolean value) {
|
||||
ovpncliJNI.ClientAPI_Config_echo_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getEcho() {
|
||||
return ovpncliJNI.ClientAPI_Config_echo_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setInfo(boolean value) {
|
||||
ovpncliJNI.ClientAPI_Config_info_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getInfo() {
|
||||
return ovpncliJNI.ClientAPI_Config_info_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setAllowLocalLanAccess(boolean value) {
|
||||
ovpncliJNI.ClientAPI_Config_allowLocalLanAccess_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getAllowLocalLanAccess() {
|
||||
return ovpncliJNI.ClientAPI_Config_allowLocalLanAccess_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setClockTickMS(long value) {
|
||||
ovpncliJNI.ClientAPI_Config_clockTickMS_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public long getClockTickMS() {
|
||||
return ovpncliJNI.ClientAPI_Config_clockTickMS_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setGremlinConfig(String value) {
|
||||
ovpncliJNI.ClientAPI_Config_gremlinConfig_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getGremlinConfig() {
|
||||
return ovpncliJNI.ClientAPI_Config_gremlinConfig_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setUsePluggableTransports(boolean value) {
|
||||
ovpncliJNI.ClientAPI_Config_usePluggableTransports_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getUsePluggableTransports() {
|
||||
return ovpncliJNI.ClientAPI_Config_usePluggableTransports_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setWintun(boolean value) {
|
||||
ovpncliJNI.ClientAPI_Config_wintun_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getWintun() {
|
||||
return ovpncliJNI.ClientAPI_Config_wintun_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setAllowLocalDnsResolvers(boolean value) {
|
||||
ovpncliJNI.ClientAPI_Config_allowLocalDnsResolvers_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getAllowLocalDnsResolvers() {
|
||||
return ovpncliJNI.ClientAPI_Config_allowLocalDnsResolvers_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setEnableLegacyAlgorithms(boolean value) {
|
||||
ovpncliJNI.ClientAPI_Config_enableLegacyAlgorithms_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getEnableLegacyAlgorithms() {
|
||||
return ovpncliJNI.ClientAPI_Config_enableLegacyAlgorithms_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setEnableNonPreferredDCAlgorithms(boolean value) {
|
||||
ovpncliJNI.ClientAPI_Config_enableNonPreferredDCAlgorithms_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getEnableNonPreferredDCAlgorithms() {
|
||||
return ovpncliJNI.ClientAPI_Config_enableNonPreferredDCAlgorithms_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public ClientAPI_Config() {
|
||||
this(ovpncliJNI.new_ClientAPI_Config(), true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_ConnectionInfo {
|
||||
private transient long swigCPtr;
|
||||
protected transient boolean swigCMemOwn;
|
||||
|
||||
protected ClientAPI_ConnectionInfo(long cPtr, boolean cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_ConnectionInfo obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_ConnectionInfo obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_ConnectionInfo(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void setDefined(boolean value) {
|
||||
ovpncliJNI.ClientAPI_ConnectionInfo_defined_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getDefined() {
|
||||
return ovpncliJNI.ClientAPI_ConnectionInfo_defined_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setUser(String value) {
|
||||
ovpncliJNI.ClientAPI_ConnectionInfo_user_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getUser() {
|
||||
return ovpncliJNI.ClientAPI_ConnectionInfo_user_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setServerHost(String value) {
|
||||
ovpncliJNI.ClientAPI_ConnectionInfo_serverHost_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getServerHost() {
|
||||
return ovpncliJNI.ClientAPI_ConnectionInfo_serverHost_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setServerPort(String value) {
|
||||
ovpncliJNI.ClientAPI_ConnectionInfo_serverPort_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getServerPort() {
|
||||
return ovpncliJNI.ClientAPI_ConnectionInfo_serverPort_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setServerProto(String value) {
|
||||
ovpncliJNI.ClientAPI_ConnectionInfo_serverProto_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getServerProto() {
|
||||
return ovpncliJNI.ClientAPI_ConnectionInfo_serverProto_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setServerIp(String value) {
|
||||
ovpncliJNI.ClientAPI_ConnectionInfo_serverIp_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getServerIp() {
|
||||
return ovpncliJNI.ClientAPI_ConnectionInfo_serverIp_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setVpnIp4(String value) {
|
||||
ovpncliJNI.ClientAPI_ConnectionInfo_vpnIp4_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getVpnIp4() {
|
||||
return ovpncliJNI.ClientAPI_ConnectionInfo_vpnIp4_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setVpnIp6(String value) {
|
||||
ovpncliJNI.ClientAPI_ConnectionInfo_vpnIp6_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getVpnIp6() {
|
||||
return ovpncliJNI.ClientAPI_ConnectionInfo_vpnIp6_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setGw4(String value) {
|
||||
ovpncliJNI.ClientAPI_ConnectionInfo_gw4_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getGw4() {
|
||||
return ovpncliJNI.ClientAPI_ConnectionInfo_gw4_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setGw6(String value) {
|
||||
ovpncliJNI.ClientAPI_ConnectionInfo_gw6_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getGw6() {
|
||||
return ovpncliJNI.ClientAPI_ConnectionInfo_gw6_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setClientIp(String value) {
|
||||
ovpncliJNI.ClientAPI_ConnectionInfo_clientIp_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getClientIp() {
|
||||
return ovpncliJNI.ClientAPI_ConnectionInfo_clientIp_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setTunName(String value) {
|
||||
ovpncliJNI.ClientAPI_ConnectionInfo_tunName_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getTunName() {
|
||||
return ovpncliJNI.ClientAPI_ConnectionInfo_tunName_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public ClientAPI_ConnectionInfo() {
|
||||
this(ovpncliJNI.new_ClientAPI_ConnectionInfo(), true);
|
||||
}
|
||||
|
||||
}
|
||||
-87
@@ -1,87 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_DynamicChallenge {
|
||||
private transient long swigCPtr;
|
||||
protected transient boolean swigCMemOwn;
|
||||
|
||||
protected ClientAPI_DynamicChallenge(long cPtr, boolean cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_DynamicChallenge obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_DynamicChallenge obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_DynamicChallenge(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void setChallenge(String value) {
|
||||
ovpncliJNI.ClientAPI_DynamicChallenge_challenge_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getChallenge() {
|
||||
return ovpncliJNI.ClientAPI_DynamicChallenge_challenge_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setEcho(boolean value) {
|
||||
ovpncliJNI.ClientAPI_DynamicChallenge_echo_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getEcho() {
|
||||
return ovpncliJNI.ClientAPI_DynamicChallenge_echo_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setResponseRequired(boolean value) {
|
||||
ovpncliJNI.ClientAPI_DynamicChallenge_responseRequired_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getResponseRequired() {
|
||||
return ovpncliJNI.ClientAPI_DynamicChallenge_responseRequired_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setStateID(String value) {
|
||||
ovpncliJNI.ClientAPI_DynamicChallenge_stateID_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getStateID() {
|
||||
return ovpncliJNI.ClientAPI_DynamicChallenge_stateID_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public ClientAPI_DynamicChallenge() {
|
||||
this(ovpncliJNI.new_ClientAPI_DynamicChallenge(), true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,184 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_EvalConfig {
|
||||
private transient long swigCPtr;
|
||||
protected transient boolean swigCMemOwn;
|
||||
|
||||
protected ClientAPI_EvalConfig(long cPtr, boolean cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_EvalConfig obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_EvalConfig obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_EvalConfig(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void setError(boolean value) {
|
||||
ovpncliJNI.ClientAPI_EvalConfig_error_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getError() {
|
||||
return ovpncliJNI.ClientAPI_EvalConfig_error_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setMessage(String value) {
|
||||
ovpncliJNI.ClientAPI_EvalConfig_message_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return ovpncliJNI.ClientAPI_EvalConfig_message_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setUserlockedUsername(String value) {
|
||||
ovpncliJNI.ClientAPI_EvalConfig_userlockedUsername_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getUserlockedUsername() {
|
||||
return ovpncliJNI.ClientAPI_EvalConfig_userlockedUsername_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setProfileName(String value) {
|
||||
ovpncliJNI.ClientAPI_EvalConfig_profileName_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getProfileName() {
|
||||
return ovpncliJNI.ClientAPI_EvalConfig_profileName_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setFriendlyName(String value) {
|
||||
ovpncliJNI.ClientAPI_EvalConfig_friendlyName_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getFriendlyName() {
|
||||
return ovpncliJNI.ClientAPI_EvalConfig_friendlyName_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setAutologin(boolean value) {
|
||||
ovpncliJNI.ClientAPI_EvalConfig_autologin_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getAutologin() {
|
||||
return ovpncliJNI.ClientAPI_EvalConfig_autologin_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setExternalPki(boolean value) {
|
||||
ovpncliJNI.ClientAPI_EvalConfig_externalPki_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getExternalPki() {
|
||||
return ovpncliJNI.ClientAPI_EvalConfig_externalPki_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setStaticChallenge(String value) {
|
||||
ovpncliJNI.ClientAPI_EvalConfig_staticChallenge_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getStaticChallenge() {
|
||||
return ovpncliJNI.ClientAPI_EvalConfig_staticChallenge_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setStaticChallengeEcho(boolean value) {
|
||||
ovpncliJNI.ClientAPI_EvalConfig_staticChallengeEcho_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getStaticChallengeEcho() {
|
||||
return ovpncliJNI.ClientAPI_EvalConfig_staticChallengeEcho_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setPrivateKeyPasswordRequired(boolean value) {
|
||||
ovpncliJNI.ClientAPI_EvalConfig_privateKeyPasswordRequired_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getPrivateKeyPasswordRequired() {
|
||||
return ovpncliJNI.ClientAPI_EvalConfig_privateKeyPasswordRequired_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setAllowPasswordSave(boolean value) {
|
||||
ovpncliJNI.ClientAPI_EvalConfig_allowPasswordSave_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getAllowPasswordSave() {
|
||||
return ovpncliJNI.ClientAPI_EvalConfig_allowPasswordSave_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setRemoteHost(String value) {
|
||||
ovpncliJNI.ClientAPI_EvalConfig_remoteHost_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getRemoteHost() {
|
||||
return ovpncliJNI.ClientAPI_EvalConfig_remoteHost_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setRemotePort(String value) {
|
||||
ovpncliJNI.ClientAPI_EvalConfig_remotePort_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getRemotePort() {
|
||||
return ovpncliJNI.ClientAPI_EvalConfig_remotePort_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setRemoteProto(String value) {
|
||||
ovpncliJNI.ClientAPI_EvalConfig_remoteProto_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getRemoteProto() {
|
||||
return ovpncliJNI.ClientAPI_EvalConfig_remoteProto_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setServerList(ClientAPI_ServerEntryVector value) {
|
||||
ovpncliJNI.ClientAPI_EvalConfig_serverList_set(swigCPtr, this, ClientAPI_ServerEntryVector.getCPtr(value), value);
|
||||
}
|
||||
|
||||
public ClientAPI_ServerEntryVector getServerList() {
|
||||
long cPtr = ovpncliJNI.ClientAPI_EvalConfig_serverList_get(swigCPtr, this);
|
||||
return (cPtr == 0) ? null : new ClientAPI_ServerEntryVector(cPtr, false);
|
||||
}
|
||||
|
||||
public void setWindowsDriver(String value) {
|
||||
ovpncliJNI.ClientAPI_EvalConfig_windowsDriver_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getWindowsDriver() {
|
||||
return ovpncliJNI.ClientAPI_EvalConfig_windowsDriver_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public ClientAPI_EvalConfig() {
|
||||
this(ovpncliJNI.new_ClientAPI_EvalConfig(), true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_Event {
|
||||
private transient long swigCPtr;
|
||||
protected transient boolean swigCMemOwn;
|
||||
|
||||
protected ClientAPI_Event(long cPtr, boolean cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_Event obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_Event obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_Event(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void setError(boolean value) {
|
||||
ovpncliJNI.ClientAPI_Event_error_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getError() {
|
||||
return ovpncliJNI.ClientAPI_Event_error_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setFatal(boolean value) {
|
||||
ovpncliJNI.ClientAPI_Event_fatal_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getFatal() {
|
||||
return ovpncliJNI.ClientAPI_Event_fatal_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setName(String value) {
|
||||
ovpncliJNI.ClientAPI_Event_name_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return ovpncliJNI.ClientAPI_Event_name_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setInfo(String value) {
|
||||
ovpncliJNI.ClientAPI_Event_info_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getInfo() {
|
||||
return ovpncliJNI.ClientAPI_Event_info_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public ClientAPI_Event() {
|
||||
this(ovpncliJNI.new_ClientAPI_Event(), true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_ExternalPKIBase {
|
||||
private transient long swigCPtr;
|
||||
protected transient boolean swigCMemOwn;
|
||||
|
||||
protected ClientAPI_ExternalPKIBase(long cPtr, boolean cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_ExternalPKIBase obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_ExternalPKIBase obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_ExternalPKIBase(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean sign(String data, SWIGTYPE_p_std__string sig, String algorithm) {
|
||||
return ovpncliJNI.ClientAPI_ExternalPKIBase_sign(swigCPtr, this, data, SWIGTYPE_p_std__string.getCPtr(sig), algorithm);
|
||||
}
|
||||
|
||||
}
|
||||
-71
@@ -1,71 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_ExternalPKICertRequest extends ClientAPI_ExternalPKIRequestBase {
|
||||
private transient long swigCPtr;
|
||||
|
||||
protected ClientAPI_ExternalPKICertRequest(long cPtr, boolean cMemoryOwn) {
|
||||
super(ovpncliJNI.ClientAPI_ExternalPKICertRequest_SWIGUpcast(cPtr), cMemoryOwn);
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_ExternalPKICertRequest obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_ExternalPKICertRequest obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_ExternalPKICertRequest(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
super.delete();
|
||||
}
|
||||
|
||||
public void setCert(String value) {
|
||||
ovpncliJNI.ClientAPI_ExternalPKICertRequest_cert_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getCert() {
|
||||
return ovpncliJNI.ClientAPI_ExternalPKICertRequest_cert_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setSupportingChain(String value) {
|
||||
ovpncliJNI.ClientAPI_ExternalPKICertRequest_supportingChain_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getSupportingChain() {
|
||||
return ovpncliJNI.ClientAPI_ExternalPKICertRequest_supportingChain_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public ClientAPI_ExternalPKICertRequest() {
|
||||
this(ovpncliJNI.new_ClientAPI_ExternalPKICertRequest(), true);
|
||||
}
|
||||
|
||||
}
|
||||
-87
@@ -1,87 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_ExternalPKIRequestBase {
|
||||
private transient long swigCPtr;
|
||||
protected transient boolean swigCMemOwn;
|
||||
|
||||
protected ClientAPI_ExternalPKIRequestBase(long cPtr, boolean cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_ExternalPKIRequestBase obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_ExternalPKIRequestBase obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_ExternalPKIRequestBase(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void setError(boolean value) {
|
||||
ovpncliJNI.ClientAPI_ExternalPKIRequestBase_error_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getError() {
|
||||
return ovpncliJNI.ClientAPI_ExternalPKIRequestBase_error_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setErrorText(String value) {
|
||||
ovpncliJNI.ClientAPI_ExternalPKIRequestBase_errorText_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getErrorText() {
|
||||
return ovpncliJNI.ClientAPI_ExternalPKIRequestBase_errorText_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setInvalidAlias(boolean value) {
|
||||
ovpncliJNI.ClientAPI_ExternalPKIRequestBase_invalidAlias_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getInvalidAlias() {
|
||||
return ovpncliJNI.ClientAPI_ExternalPKIRequestBase_invalidAlias_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setAlias(String value) {
|
||||
ovpncliJNI.ClientAPI_ExternalPKIRequestBase_alias_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return ovpncliJNI.ClientAPI_ExternalPKIRequestBase_alias_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public ClientAPI_ExternalPKIRequestBase() {
|
||||
this(ovpncliJNI.new_ClientAPI_ExternalPKIRequestBase(), true);
|
||||
}
|
||||
|
||||
}
|
||||
-79
@@ -1,79 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_ExternalPKISignRequest extends ClientAPI_ExternalPKIRequestBase {
|
||||
private transient long swigCPtr;
|
||||
|
||||
protected ClientAPI_ExternalPKISignRequest(long cPtr, boolean cMemoryOwn) {
|
||||
super(ovpncliJNI.ClientAPI_ExternalPKISignRequest_SWIGUpcast(cPtr), cMemoryOwn);
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_ExternalPKISignRequest obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_ExternalPKISignRequest obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_ExternalPKISignRequest(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
super.delete();
|
||||
}
|
||||
|
||||
public void setData(String value) {
|
||||
ovpncliJNI.ClientAPI_ExternalPKISignRequest_data_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return ovpncliJNI.ClientAPI_ExternalPKISignRequest_data_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setSig(String value) {
|
||||
ovpncliJNI.ClientAPI_ExternalPKISignRequest_sig_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getSig() {
|
||||
return ovpncliJNI.ClientAPI_ExternalPKISignRequest_sig_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setAlgorithm(String value) {
|
||||
ovpncliJNI.ClientAPI_ExternalPKISignRequest_algorithm_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getAlgorithm() {
|
||||
return ovpncliJNI.ClientAPI_ExternalPKISignRequest_algorithm_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public ClientAPI_ExternalPKISignRequest() {
|
||||
this(ovpncliJNI.new_ClientAPI_ExternalPKISignRequest(), true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_InterfaceStats {
|
||||
private transient long swigCPtr;
|
||||
protected transient boolean swigCMemOwn;
|
||||
|
||||
protected ClientAPI_InterfaceStats(long cPtr, boolean cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_InterfaceStats obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_InterfaceStats obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_InterfaceStats(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void setBytesIn(long value) {
|
||||
ovpncliJNI.ClientAPI_InterfaceStats_bytesIn_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public long getBytesIn() {
|
||||
return ovpncliJNI.ClientAPI_InterfaceStats_bytesIn_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setPacketsIn(long value) {
|
||||
ovpncliJNI.ClientAPI_InterfaceStats_packetsIn_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public long getPacketsIn() {
|
||||
return ovpncliJNI.ClientAPI_InterfaceStats_packetsIn_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setErrorsIn(long value) {
|
||||
ovpncliJNI.ClientAPI_InterfaceStats_errorsIn_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public long getErrorsIn() {
|
||||
return ovpncliJNI.ClientAPI_InterfaceStats_errorsIn_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setBytesOut(long value) {
|
||||
ovpncliJNI.ClientAPI_InterfaceStats_bytesOut_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public long getBytesOut() {
|
||||
return ovpncliJNI.ClientAPI_InterfaceStats_bytesOut_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setPacketsOut(long value) {
|
||||
ovpncliJNI.ClientAPI_InterfaceStats_packetsOut_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public long getPacketsOut() {
|
||||
return ovpncliJNI.ClientAPI_InterfaceStats_packetsOut_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setErrorsOut(long value) {
|
||||
ovpncliJNI.ClientAPI_InterfaceStats_errorsOut_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public long getErrorsOut() {
|
||||
return ovpncliJNI.ClientAPI_InterfaceStats_errorsOut_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public ClientAPI_InterfaceStats() {
|
||||
this(ovpncliJNI.new_ClientAPI_InterfaceStats(), true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_KeyValue {
|
||||
private transient long swigCPtr;
|
||||
protected transient boolean swigCMemOwn;
|
||||
|
||||
protected ClientAPI_KeyValue(long cPtr, boolean cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_KeyValue obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_KeyValue obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_KeyValue(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public ClientAPI_KeyValue() {
|
||||
this(ovpncliJNI.new_ClientAPI_KeyValue__SWIG_0(), true);
|
||||
}
|
||||
|
||||
public ClientAPI_KeyValue(String key_arg, String value_arg) {
|
||||
this(ovpncliJNI.new_ClientAPI_KeyValue__SWIG_1(key_arg, value_arg), true);
|
||||
}
|
||||
|
||||
public void setKey(String value) {
|
||||
ovpncliJNI.ClientAPI_KeyValue_key_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return ovpncliJNI.ClientAPI_KeyValue_key_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
ovpncliJNI.ClientAPI_KeyValue_value_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return ovpncliJNI.ClientAPI_KeyValue_value_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_LLVector extends java.util.AbstractList<Long> implements java.util.RandomAccess {
|
||||
private transient long swigCPtr;
|
||||
protected transient boolean swigCMemOwn;
|
||||
|
||||
protected ClientAPI_LLVector(long cPtr, boolean cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_LLVector obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_LLVector obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_LLVector(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public ClientAPI_LLVector(long[] initialElements) {
|
||||
this();
|
||||
reserve(initialElements.length);
|
||||
|
||||
for (long element : initialElements) {
|
||||
add(element);
|
||||
}
|
||||
}
|
||||
|
||||
public ClientAPI_LLVector(Iterable<Long> initialElements) {
|
||||
this();
|
||||
for (long element : initialElements) {
|
||||
add(element);
|
||||
}
|
||||
}
|
||||
|
||||
public Long get(int index) {
|
||||
return doGet(index);
|
||||
}
|
||||
|
||||
public Long set(int index, Long e) {
|
||||
return doSet(index, e);
|
||||
}
|
||||
|
||||
public boolean add(Long e) {
|
||||
modCount++;
|
||||
doAdd(e);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void add(int index, Long e) {
|
||||
modCount++;
|
||||
doAdd(index, e);
|
||||
}
|
||||
|
||||
public Long remove(int index) {
|
||||
modCount++;
|
||||
return doRemove(index);
|
||||
}
|
||||
|
||||
protected void removeRange(int fromIndex, int toIndex) {
|
||||
modCount++;
|
||||
doRemoveRange(fromIndex, toIndex);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return doSize();
|
||||
}
|
||||
|
||||
public ClientAPI_LLVector() {
|
||||
this(ovpncliJNI.new_ClientAPI_LLVector__SWIG_0(), true);
|
||||
}
|
||||
|
||||
public ClientAPI_LLVector(ClientAPI_LLVector other) {
|
||||
this(ovpncliJNI.new_ClientAPI_LLVector__SWIG_1(ClientAPI_LLVector.getCPtr(other), other), true);
|
||||
}
|
||||
|
||||
public long capacity() {
|
||||
return ovpncliJNI.ClientAPI_LLVector_capacity(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void reserve(long n) {
|
||||
ovpncliJNI.ClientAPI_LLVector_reserve(swigCPtr, this, n);
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return ovpncliJNI.ClientAPI_LLVector_isEmpty(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
ovpncliJNI.ClientAPI_LLVector_clear(swigCPtr, this);
|
||||
}
|
||||
|
||||
public ClientAPI_LLVector(int count, long value) {
|
||||
this(ovpncliJNI.new_ClientAPI_LLVector__SWIG_2(count, value), true);
|
||||
}
|
||||
|
||||
private int doSize() {
|
||||
return ovpncliJNI.ClientAPI_LLVector_doSize(swigCPtr, this);
|
||||
}
|
||||
|
||||
private void doAdd(long x) {
|
||||
ovpncliJNI.ClientAPI_LLVector_doAdd__SWIG_0(swigCPtr, this, x);
|
||||
}
|
||||
|
||||
private void doAdd(int index, long x) {
|
||||
ovpncliJNI.ClientAPI_LLVector_doAdd__SWIG_1(swigCPtr, this, index, x);
|
||||
}
|
||||
|
||||
private long doRemove(int index) {
|
||||
return ovpncliJNI.ClientAPI_LLVector_doRemove(swigCPtr, this, index);
|
||||
}
|
||||
|
||||
private long doGet(int index) {
|
||||
return ovpncliJNI.ClientAPI_LLVector_doGet(swigCPtr, this, index);
|
||||
}
|
||||
|
||||
private long doSet(int index, long val) {
|
||||
return ovpncliJNI.ClientAPI_LLVector_doSet(swigCPtr, this, index, val);
|
||||
}
|
||||
|
||||
private void doRemoveRange(int fromIndex, int toIndex) {
|
||||
ovpncliJNI.ClientAPI_LLVector_doRemoveRange(swigCPtr, this, fromIndex, toIndex);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_LogInfo {
|
||||
private transient long swigCPtr;
|
||||
protected transient boolean swigCMemOwn;
|
||||
|
||||
protected ClientAPI_LogInfo(long cPtr, boolean cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_LogInfo obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_LogInfo obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_LogInfo(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public ClientAPI_LogInfo() {
|
||||
this(ovpncliJNI.new_ClientAPI_LogInfo__SWIG_0(), true);
|
||||
}
|
||||
|
||||
public ClientAPI_LogInfo(String str) {
|
||||
this(ovpncliJNI.new_ClientAPI_LogInfo__SWIG_1(str), true);
|
||||
}
|
||||
|
||||
public void setText(String value) {
|
||||
ovpncliJNI.ClientAPI_LogInfo_text_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return ovpncliJNI.ClientAPI_LogInfo_text_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_MergeConfig {
|
||||
private transient long swigCPtr;
|
||||
protected transient boolean swigCMemOwn;
|
||||
|
||||
protected ClientAPI_MergeConfig(long cPtr, boolean cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_MergeConfig obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_MergeConfig obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_MergeConfig(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void setStatus(String value) {
|
||||
ovpncliJNI.ClientAPI_MergeConfig_status_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return ovpncliJNI.ClientAPI_MergeConfig_status_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setErrorText(String value) {
|
||||
ovpncliJNI.ClientAPI_MergeConfig_errorText_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getErrorText() {
|
||||
return ovpncliJNI.ClientAPI_MergeConfig_errorText_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setBasename(String value) {
|
||||
ovpncliJNI.ClientAPI_MergeConfig_basename_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getBasename() {
|
||||
return ovpncliJNI.ClientAPI_MergeConfig_basename_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setProfileContent(String value) {
|
||||
ovpncliJNI.ClientAPI_MergeConfig_profileContent_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getProfileContent() {
|
||||
return ovpncliJNI.ClientAPI_MergeConfig_profileContent_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setRefPathList(ClientAPI_StringVec value) {
|
||||
ovpncliJNI.ClientAPI_MergeConfig_refPathList_set(swigCPtr, this, ClientAPI_StringVec.getCPtr(value), value);
|
||||
}
|
||||
|
||||
public ClientAPI_StringVec getRefPathList() {
|
||||
long cPtr = ovpncliJNI.ClientAPI_MergeConfig_refPathList_get(swigCPtr, this);
|
||||
return (cPtr == 0) ? null : new ClientAPI_StringVec(cPtr, false);
|
||||
}
|
||||
|
||||
public ClientAPI_MergeConfig() {
|
||||
this(ovpncliJNI.new_ClientAPI_MergeConfig(), true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,171 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_OpenVPNClient extends ClientAPI_TunBuilderBase {
|
||||
private transient long swigCPtr;
|
||||
|
||||
protected ClientAPI_OpenVPNClient(long cPtr, boolean cMemoryOwn) {
|
||||
super(ovpncliJNI.ClientAPI_OpenVPNClient_SWIGUpcast(cPtr), cMemoryOwn);
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_OpenVPNClient obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_OpenVPNClient obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_OpenVPNClient(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
super.delete();
|
||||
}
|
||||
|
||||
protected void swigDirectorDisconnect() {
|
||||
swigCMemOwn = false;
|
||||
delete();
|
||||
}
|
||||
|
||||
public void swigReleaseOwnership() {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.ClientAPI_OpenVPNClient_change_ownership(this, swigCPtr, false);
|
||||
}
|
||||
|
||||
public void swigTakeOwnership() {
|
||||
swigCMemOwn = true;
|
||||
ovpncliJNI.ClientAPI_OpenVPNClient_change_ownership(this, swigCPtr, true);
|
||||
}
|
||||
|
||||
public ClientAPI_OpenVPNClient() {
|
||||
this(ovpncliJNI.new_ClientAPI_OpenVPNClient(), true);
|
||||
ovpncliJNI.ClientAPI_OpenVPNClient_director_connect(this, swigCPtr, true, true);
|
||||
}
|
||||
|
||||
public ClientAPI_EvalConfig eval_config(ClientAPI_Config arg0) {
|
||||
return new ClientAPI_EvalConfig(ovpncliJNI.ClientAPI_OpenVPNClient_eval_config(swigCPtr, this, ClientAPI_Config.getCPtr(arg0), arg0), true);
|
||||
}
|
||||
|
||||
public ClientAPI_Status provide_creds(ClientAPI_ProvideCreds arg0) {
|
||||
return new ClientAPI_Status(ovpncliJNI.ClientAPI_OpenVPNClient_provide_creds(swigCPtr, this, ClientAPI_ProvideCreds.getCPtr(arg0), arg0), true);
|
||||
}
|
||||
|
||||
public boolean socket_protect(int socket, String remote, boolean ipv6) {
|
||||
return (getClass() == ClientAPI_OpenVPNClient.class) ? ovpncliJNI.ClientAPI_OpenVPNClient_socket_protect(swigCPtr, this, socket, remote, ipv6) : ovpncliJNI.ClientAPI_OpenVPNClient_socket_protectSwigExplicitClientAPI_OpenVPNClient(swigCPtr, this, socket, remote, ipv6);
|
||||
}
|
||||
|
||||
public ClientAPI_Status connect() {
|
||||
return new ClientAPI_Status(ovpncliJNI.ClientAPI_OpenVPNClient_connect(swigCPtr, this), true);
|
||||
}
|
||||
|
||||
public ClientAPI_ConnectionInfo connection_info() {
|
||||
return new ClientAPI_ConnectionInfo(ovpncliJNI.ClientAPI_OpenVPNClient_connection_info(swigCPtr, this), true);
|
||||
}
|
||||
|
||||
public boolean session_token(ClientAPI_SessionToken tok) {
|
||||
return ovpncliJNI.ClientAPI_OpenVPNClient_session_token(swigCPtr, this, ClientAPI_SessionToken.getCPtr(tok), tok);
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
ovpncliJNI.ClientAPI_OpenVPNClient_stop(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void pause(String reason) {
|
||||
ovpncliJNI.ClientAPI_OpenVPNClient_pause(swigCPtr, this, reason);
|
||||
}
|
||||
|
||||
public void resume() {
|
||||
ovpncliJNI.ClientAPI_OpenVPNClient_resume(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void reconnect(int seconds) {
|
||||
ovpncliJNI.ClientAPI_OpenVPNClient_reconnect(swigCPtr, this, seconds);
|
||||
}
|
||||
|
||||
public boolean pause_on_connection_timeout() {
|
||||
return ovpncliJNI.ClientAPI_OpenVPNClient_pause_on_connection_timeout(swigCPtr, this);
|
||||
}
|
||||
|
||||
public static int stats_n() {
|
||||
return ovpncliJNI.ClientAPI_OpenVPNClient_stats_n();
|
||||
}
|
||||
|
||||
public static String stats_name(int index) {
|
||||
return ovpncliJNI.ClientAPI_OpenVPNClient_stats_name(index);
|
||||
}
|
||||
|
||||
public long stats_value(int index) {
|
||||
return ovpncliJNI.ClientAPI_OpenVPNClient_stats_value(swigCPtr, this, index);
|
||||
}
|
||||
|
||||
public ClientAPI_LLVector stats_bundle() {
|
||||
return new ClientAPI_LLVector(ovpncliJNI.ClientAPI_OpenVPNClient_stats_bundle(swigCPtr, this), true);
|
||||
}
|
||||
|
||||
public ClientAPI_InterfaceStats tun_stats() {
|
||||
return new ClientAPI_InterfaceStats(ovpncliJNI.ClientAPI_OpenVPNClient_tun_stats(swigCPtr, this), true);
|
||||
}
|
||||
|
||||
public ClientAPI_TransportStats transport_stats() {
|
||||
return new ClientAPI_TransportStats(ovpncliJNI.ClientAPI_OpenVPNClient_transport_stats(swigCPtr, this), true);
|
||||
}
|
||||
|
||||
public void post_cc_msg(String msg) {
|
||||
ovpncliJNI.ClientAPI_OpenVPNClient_post_cc_msg(swigCPtr, this, msg);
|
||||
}
|
||||
|
||||
public void event(ClientAPI_Event arg0) {
|
||||
ovpncliJNI.ClientAPI_OpenVPNClient_event(swigCPtr, this, ClientAPI_Event.getCPtr(arg0), arg0);
|
||||
}
|
||||
|
||||
public void log(ClientAPI_LogInfo arg0) {
|
||||
ovpncliJNI.ClientAPI_OpenVPNClient_log(swigCPtr, this, ClientAPI_LogInfo.getCPtr(arg0), arg0);
|
||||
}
|
||||
|
||||
public void external_pki_cert_request(ClientAPI_ExternalPKICertRequest arg0) {
|
||||
ovpncliJNI.ClientAPI_OpenVPNClient_external_pki_cert_request(swigCPtr, this, ClientAPI_ExternalPKICertRequest.getCPtr(arg0), arg0);
|
||||
}
|
||||
|
||||
public void external_pki_sign_request(ClientAPI_ExternalPKISignRequest arg0) {
|
||||
ovpncliJNI.ClientAPI_OpenVPNClient_external_pki_sign_request(swigCPtr, this, ClientAPI_ExternalPKISignRequest.getCPtr(arg0), arg0);
|
||||
}
|
||||
|
||||
public boolean remote_override_enabled() {
|
||||
return (getClass() == ClientAPI_OpenVPNClient.class) ? ovpncliJNI.ClientAPI_OpenVPNClient_remote_override_enabled(swigCPtr, this) : ovpncliJNI.ClientAPI_OpenVPNClient_remote_override_enabledSwigExplicitClientAPI_OpenVPNClient(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void remote_override(ClientAPI_RemoteOverride arg0) {
|
||||
if (getClass() == ClientAPI_OpenVPNClient.class) ovpncliJNI.ClientAPI_OpenVPNClient_remote_override(swigCPtr, this, ClientAPI_RemoteOverride.getCPtr(arg0), arg0); else ovpncliJNI.ClientAPI_OpenVPNClient_remote_overrideSwigExplicitClientAPI_OpenVPNClient(swigCPtr, this, ClientAPI_RemoteOverride.getCPtr(arg0), arg0);
|
||||
}
|
||||
|
||||
public void clock_tick() {
|
||||
if (getClass() == ClientAPI_OpenVPNClient.class) ovpncliJNI.ClientAPI_OpenVPNClient_clock_tick(swigCPtr, this); else ovpncliJNI.ClientAPI_OpenVPNClient_clock_tickSwigExplicitClientAPI_OpenVPNClient(swigCPtr, this);
|
||||
}
|
||||
|
||||
}
|
||||
-87
@@ -1,87 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_OpenVPNClientHelper {
|
||||
private transient long swigCPtr;
|
||||
protected transient boolean swigCMemOwn;
|
||||
|
||||
protected ClientAPI_OpenVPNClientHelper(long cPtr, boolean cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_OpenVPNClientHelper obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_OpenVPNClientHelper obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_OpenVPNClientHelper(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public ClientAPI_OpenVPNClientHelper() {
|
||||
this(ovpncliJNI.new_ClientAPI_OpenVPNClientHelper(), true);
|
||||
}
|
||||
|
||||
public ClientAPI_MergeConfig merge_config(String path, boolean follow_references) {
|
||||
return new ClientAPI_MergeConfig(ovpncliJNI.ClientAPI_OpenVPNClientHelper_merge_config(swigCPtr, this, path, follow_references), true);
|
||||
}
|
||||
|
||||
public ClientAPI_MergeConfig merge_config_string(String config_content) {
|
||||
return new ClientAPI_MergeConfig(ovpncliJNI.ClientAPI_OpenVPNClientHelper_merge_config_string(swigCPtr, this, config_content), true);
|
||||
}
|
||||
|
||||
public ClientAPI_EvalConfig eval_config(ClientAPI_Config config) {
|
||||
return new ClientAPI_EvalConfig(ovpncliJNI.ClientAPI_OpenVPNClientHelper_eval_config(swigCPtr, this, ClientAPI_Config.getCPtr(config), config), true);
|
||||
}
|
||||
|
||||
public static int max_profile_size() {
|
||||
return ovpncliJNI.ClientAPI_OpenVPNClientHelper_max_profile_size();
|
||||
}
|
||||
|
||||
public static boolean parse_dynamic_challenge(String cookie, ClientAPI_DynamicChallenge dc) {
|
||||
return ovpncliJNI.ClientAPI_OpenVPNClientHelper_parse_dynamic_challenge(cookie, ClientAPI_DynamicChallenge.getCPtr(dc), dc);
|
||||
}
|
||||
|
||||
public String crypto_self_test() {
|
||||
return ovpncliJNI.ClientAPI_OpenVPNClientHelper_crypto_self_test(swigCPtr, this);
|
||||
}
|
||||
|
||||
public static String platform() {
|
||||
return ovpncliJNI.ClientAPI_OpenVPNClientHelper_platform();
|
||||
}
|
||||
|
||||
public static String copyright() {
|
||||
return ovpncliJNI.ClientAPI_OpenVPNClientHelper_copyright();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_ProvideCreds {
|
||||
private transient long swigCPtr;
|
||||
protected transient boolean swigCMemOwn;
|
||||
|
||||
protected ClientAPI_ProvideCreds(long cPtr, boolean cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_ProvideCreds obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_ProvideCreds obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_ProvideCreds(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void setUsername(String value) {
|
||||
ovpncliJNI.ClientAPI_ProvideCreds_username_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return ovpncliJNI.ClientAPI_ProvideCreds_username_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setPassword(String value) {
|
||||
ovpncliJNI.ClientAPI_ProvideCreds_password_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return ovpncliJNI.ClientAPI_ProvideCreds_password_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setHttp_proxy_user(String value) {
|
||||
ovpncliJNI.ClientAPI_ProvideCreds_http_proxy_user_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getHttp_proxy_user() {
|
||||
return ovpncliJNI.ClientAPI_ProvideCreds_http_proxy_user_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setHttp_proxy_pass(String value) {
|
||||
ovpncliJNI.ClientAPI_ProvideCreds_http_proxy_pass_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getHttp_proxy_pass() {
|
||||
return ovpncliJNI.ClientAPI_ProvideCreds_http_proxy_pass_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setResponse(String value) {
|
||||
ovpncliJNI.ClientAPI_ProvideCreds_response_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getResponse() {
|
||||
return ovpncliJNI.ClientAPI_ProvideCreds_response_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setDynamicChallengeCookie(String value) {
|
||||
ovpncliJNI.ClientAPI_ProvideCreds_dynamicChallengeCookie_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getDynamicChallengeCookie() {
|
||||
return ovpncliJNI.ClientAPI_ProvideCreds_dynamicChallengeCookie_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setReplacePasswordWithSessionID(boolean value) {
|
||||
ovpncliJNI.ClientAPI_ProvideCreds_replacePasswordWithSessionID_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getReplacePasswordWithSessionID() {
|
||||
return ovpncliJNI.ClientAPI_ProvideCreds_replacePasswordWithSessionID_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setCachePassword(boolean value) {
|
||||
ovpncliJNI.ClientAPI_ProvideCreds_cachePassword_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getCachePassword() {
|
||||
return ovpncliJNI.ClientAPI_ProvideCreds_cachePassword_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public ClientAPI_ProvideCreds() {
|
||||
this(ovpncliJNI.new_ClientAPI_ProvideCreds(), true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_RemoteOverride {
|
||||
private transient long swigCPtr;
|
||||
protected transient boolean swigCMemOwn;
|
||||
|
||||
protected ClientAPI_RemoteOverride(long cPtr, boolean cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_RemoteOverride obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_RemoteOverride obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_RemoteOverride(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void setHost(String value) {
|
||||
ovpncliJNI.ClientAPI_RemoteOverride_host_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return ovpncliJNI.ClientAPI_RemoteOverride_host_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setIp(String value) {
|
||||
ovpncliJNI.ClientAPI_RemoteOverride_ip_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getIp() {
|
||||
return ovpncliJNI.ClientAPI_RemoteOverride_ip_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setPort(String value) {
|
||||
ovpncliJNI.ClientAPI_RemoteOverride_port_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getPort() {
|
||||
return ovpncliJNI.ClientAPI_RemoteOverride_port_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setProto(String value) {
|
||||
ovpncliJNI.ClientAPI_RemoteOverride_proto_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getProto() {
|
||||
return ovpncliJNI.ClientAPI_RemoteOverride_proto_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setError(String value) {
|
||||
ovpncliJNI.ClientAPI_RemoteOverride_error_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getError() {
|
||||
return ovpncliJNI.ClientAPI_RemoteOverride_error_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public ClientAPI_RemoteOverride() {
|
||||
this(ovpncliJNI.new_ClientAPI_RemoteOverride(), true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_ServerEntry {
|
||||
private transient long swigCPtr;
|
||||
protected transient boolean swigCMemOwn;
|
||||
|
||||
protected ClientAPI_ServerEntry(long cPtr, boolean cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_ServerEntry obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_ServerEntry obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_ServerEntry(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void setServer(String value) {
|
||||
ovpncliJNI.ClientAPI_ServerEntry_server_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getServer() {
|
||||
return ovpncliJNI.ClientAPI_ServerEntry_server_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setFriendlyName(String value) {
|
||||
ovpncliJNI.ClientAPI_ServerEntry_friendlyName_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getFriendlyName() {
|
||||
return ovpncliJNI.ClientAPI_ServerEntry_friendlyName_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public ClientAPI_ServerEntry() {
|
||||
this(ovpncliJNI.new_ClientAPI_ServerEntry(), true);
|
||||
}
|
||||
|
||||
}
|
||||
-156
@@ -1,156 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_ServerEntryVector extends java.util.AbstractList<ClientAPI_ServerEntry> implements java.util.RandomAccess {
|
||||
private transient long swigCPtr;
|
||||
protected transient boolean swigCMemOwn;
|
||||
|
||||
protected ClientAPI_ServerEntryVector(long cPtr, boolean cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_ServerEntryVector obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_ServerEntryVector obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_ServerEntryVector(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public ClientAPI_ServerEntryVector(ClientAPI_ServerEntry[] initialElements) {
|
||||
this();
|
||||
reserve(initialElements.length);
|
||||
|
||||
for (ClientAPI_ServerEntry element : initialElements) {
|
||||
add(element);
|
||||
}
|
||||
}
|
||||
|
||||
public ClientAPI_ServerEntryVector(Iterable<ClientAPI_ServerEntry> initialElements) {
|
||||
this();
|
||||
for (ClientAPI_ServerEntry element : initialElements) {
|
||||
add(element);
|
||||
}
|
||||
}
|
||||
|
||||
public ClientAPI_ServerEntry get(int index) {
|
||||
return doGet(index);
|
||||
}
|
||||
|
||||
public ClientAPI_ServerEntry set(int index, ClientAPI_ServerEntry e) {
|
||||
return doSet(index, e);
|
||||
}
|
||||
|
||||
public boolean add(ClientAPI_ServerEntry e) {
|
||||
modCount++;
|
||||
doAdd(e);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void add(int index, ClientAPI_ServerEntry e) {
|
||||
modCount++;
|
||||
doAdd(index, e);
|
||||
}
|
||||
|
||||
public ClientAPI_ServerEntry remove(int index) {
|
||||
modCount++;
|
||||
return doRemove(index);
|
||||
}
|
||||
|
||||
protected void removeRange(int fromIndex, int toIndex) {
|
||||
modCount++;
|
||||
doRemoveRange(fromIndex, toIndex);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return doSize();
|
||||
}
|
||||
|
||||
public ClientAPI_ServerEntryVector() {
|
||||
this(ovpncliJNI.new_ClientAPI_ServerEntryVector__SWIG_0(), true);
|
||||
}
|
||||
|
||||
public ClientAPI_ServerEntryVector(ClientAPI_ServerEntryVector other) {
|
||||
this(ovpncliJNI.new_ClientAPI_ServerEntryVector__SWIG_1(ClientAPI_ServerEntryVector.getCPtr(other), other), true);
|
||||
}
|
||||
|
||||
public long capacity() {
|
||||
return ovpncliJNI.ClientAPI_ServerEntryVector_capacity(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void reserve(long n) {
|
||||
ovpncliJNI.ClientAPI_ServerEntryVector_reserve(swigCPtr, this, n);
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return ovpncliJNI.ClientAPI_ServerEntryVector_isEmpty(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
ovpncliJNI.ClientAPI_ServerEntryVector_clear(swigCPtr, this);
|
||||
}
|
||||
|
||||
public ClientAPI_ServerEntryVector(int count, ClientAPI_ServerEntry value) {
|
||||
this(ovpncliJNI.new_ClientAPI_ServerEntryVector__SWIG_2(count, ClientAPI_ServerEntry.getCPtr(value), value), true);
|
||||
}
|
||||
|
||||
private int doSize() {
|
||||
return ovpncliJNI.ClientAPI_ServerEntryVector_doSize(swigCPtr, this);
|
||||
}
|
||||
|
||||
private void doAdd(ClientAPI_ServerEntry x) {
|
||||
ovpncliJNI.ClientAPI_ServerEntryVector_doAdd__SWIG_0(swigCPtr, this, ClientAPI_ServerEntry.getCPtr(x), x);
|
||||
}
|
||||
|
||||
private void doAdd(int index, ClientAPI_ServerEntry x) {
|
||||
ovpncliJNI.ClientAPI_ServerEntryVector_doAdd__SWIG_1(swigCPtr, this, index, ClientAPI_ServerEntry.getCPtr(x), x);
|
||||
}
|
||||
|
||||
private ClientAPI_ServerEntry doRemove(int index) {
|
||||
return new ClientAPI_ServerEntry(ovpncliJNI.ClientAPI_ServerEntryVector_doRemove(swigCPtr, this, index), true);
|
||||
}
|
||||
|
||||
private ClientAPI_ServerEntry doGet(int index) {
|
||||
return new ClientAPI_ServerEntry(ovpncliJNI.ClientAPI_ServerEntryVector_doGet(swigCPtr, this, index), false);
|
||||
}
|
||||
|
||||
private ClientAPI_ServerEntry doSet(int index, ClientAPI_ServerEntry val) {
|
||||
return new ClientAPI_ServerEntry(ovpncliJNI.ClientAPI_ServerEntryVector_doSet(swigCPtr, this, index, ClientAPI_ServerEntry.getCPtr(val), val), true);
|
||||
}
|
||||
|
||||
private void doRemoveRange(int fromIndex, int toIndex) {
|
||||
ovpncliJNI.ClientAPI_ServerEntryVector_doRemoveRange(swigCPtr, this, fromIndex, toIndex);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_SessionToken {
|
||||
private transient long swigCPtr;
|
||||
protected transient boolean swigCMemOwn;
|
||||
|
||||
protected ClientAPI_SessionToken(long cPtr, boolean cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_SessionToken obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_SessionToken obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_SessionToken(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void setUsername(String value) {
|
||||
ovpncliJNI.ClientAPI_SessionToken_username_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return ovpncliJNI.ClientAPI_SessionToken_username_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setSession_id(String value) {
|
||||
ovpncliJNI.ClientAPI_SessionToken_session_id_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getSession_id() {
|
||||
return ovpncliJNI.ClientAPI_SessionToken_session_id_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public ClientAPI_SessionToken() {
|
||||
this(ovpncliJNI.new_ClientAPI_SessionToken(), true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_Status {
|
||||
private transient long swigCPtr;
|
||||
protected transient boolean swigCMemOwn;
|
||||
|
||||
protected ClientAPI_Status(long cPtr, boolean cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_Status obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_Status obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_Status(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void setError(boolean value) {
|
||||
ovpncliJNI.ClientAPI_Status_error_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public boolean getError() {
|
||||
return ovpncliJNI.ClientAPI_Status_error_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setStatus(String value) {
|
||||
ovpncliJNI.ClientAPI_Status_status_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return ovpncliJNI.ClientAPI_Status_status_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setMessage(String value) {
|
||||
ovpncliJNI.ClientAPI_Status_message_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return ovpncliJNI.ClientAPI_Status_message_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public ClientAPI_Status() {
|
||||
this(ovpncliJNI.new_ClientAPI_Status(), true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_StringVec extends java.util.AbstractList<String> implements java.util.RandomAccess {
|
||||
private transient long swigCPtr;
|
||||
protected transient boolean swigCMemOwn;
|
||||
|
||||
protected ClientAPI_StringVec(long cPtr, boolean cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_StringVec obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_StringVec obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_StringVec(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public ClientAPI_StringVec(String[] initialElements) {
|
||||
this();
|
||||
reserve(initialElements.length);
|
||||
|
||||
for (String element : initialElements) {
|
||||
add(element);
|
||||
}
|
||||
}
|
||||
|
||||
public ClientAPI_StringVec(Iterable<String> initialElements) {
|
||||
this();
|
||||
for (String element : initialElements) {
|
||||
add(element);
|
||||
}
|
||||
}
|
||||
|
||||
public String get(int index) {
|
||||
return doGet(index);
|
||||
}
|
||||
|
||||
public String set(int index, String e) {
|
||||
return doSet(index, e);
|
||||
}
|
||||
|
||||
public boolean add(String e) {
|
||||
modCount++;
|
||||
doAdd(e);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void add(int index, String e) {
|
||||
modCount++;
|
||||
doAdd(index, e);
|
||||
}
|
||||
|
||||
public String remove(int index) {
|
||||
modCount++;
|
||||
return doRemove(index);
|
||||
}
|
||||
|
||||
protected void removeRange(int fromIndex, int toIndex) {
|
||||
modCount++;
|
||||
doRemoveRange(fromIndex, toIndex);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return doSize();
|
||||
}
|
||||
|
||||
public ClientAPI_StringVec() {
|
||||
this(ovpncliJNI.new_ClientAPI_StringVec__SWIG_0(), true);
|
||||
}
|
||||
|
||||
public ClientAPI_StringVec(ClientAPI_StringVec other) {
|
||||
this(ovpncliJNI.new_ClientAPI_StringVec__SWIG_1(ClientAPI_StringVec.getCPtr(other), other), true);
|
||||
}
|
||||
|
||||
public long capacity() {
|
||||
return ovpncliJNI.ClientAPI_StringVec_capacity(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void reserve(long n) {
|
||||
ovpncliJNI.ClientAPI_StringVec_reserve(swigCPtr, this, n);
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return ovpncliJNI.ClientAPI_StringVec_isEmpty(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
ovpncliJNI.ClientAPI_StringVec_clear(swigCPtr, this);
|
||||
}
|
||||
|
||||
public ClientAPI_StringVec(int count, String value) {
|
||||
this(ovpncliJNI.new_ClientAPI_StringVec__SWIG_2(count, value), true);
|
||||
}
|
||||
|
||||
private int doSize() {
|
||||
return ovpncliJNI.ClientAPI_StringVec_doSize(swigCPtr, this);
|
||||
}
|
||||
|
||||
private void doAdd(String x) {
|
||||
ovpncliJNI.ClientAPI_StringVec_doAdd__SWIG_0(swigCPtr, this, x);
|
||||
}
|
||||
|
||||
private void doAdd(int index, String x) {
|
||||
ovpncliJNI.ClientAPI_StringVec_doAdd__SWIG_1(swigCPtr, this, index, x);
|
||||
}
|
||||
|
||||
private String doRemove(int index) {
|
||||
return ovpncliJNI.ClientAPI_StringVec_doRemove(swigCPtr, this, index);
|
||||
}
|
||||
|
||||
private String doGet(int index) {
|
||||
return ovpncliJNI.ClientAPI_StringVec_doGet(swigCPtr, this, index);
|
||||
}
|
||||
|
||||
private String doSet(int index, String val) {
|
||||
return ovpncliJNI.ClientAPI_StringVec_doSet(swigCPtr, this, index, val);
|
||||
}
|
||||
|
||||
private void doRemoveRange(int fromIndex, int toIndex) {
|
||||
ovpncliJNI.ClientAPI_StringVec_doRemoveRange(swigCPtr, this, fromIndex, toIndex);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_TransportStats {
|
||||
private transient long swigCPtr;
|
||||
protected transient boolean swigCMemOwn;
|
||||
|
||||
protected ClientAPI_TransportStats(long cPtr, boolean cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_TransportStats obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_TransportStats obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_TransportStats(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void setBytesIn(long value) {
|
||||
ovpncliJNI.ClientAPI_TransportStats_bytesIn_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public long getBytesIn() {
|
||||
return ovpncliJNI.ClientAPI_TransportStats_bytesIn_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setBytesOut(long value) {
|
||||
ovpncliJNI.ClientAPI_TransportStats_bytesOut_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public long getBytesOut() {
|
||||
return ovpncliJNI.ClientAPI_TransportStats_bytesOut_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setPacketsIn(long value) {
|
||||
ovpncliJNI.ClientAPI_TransportStats_packetsIn_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public long getPacketsIn() {
|
||||
return ovpncliJNI.ClientAPI_TransportStats_packetsIn_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setPacketsOut(long value) {
|
||||
ovpncliJNI.ClientAPI_TransportStats_packetsOut_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public long getPacketsOut() {
|
||||
return ovpncliJNI.ClientAPI_TransportStats_packetsOut_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void setLastPacketReceived(int value) {
|
||||
ovpncliJNI.ClientAPI_TransportStats_lastPacketReceived_set(swigCPtr, this, value);
|
||||
}
|
||||
|
||||
public int getLastPacketReceived() {
|
||||
return ovpncliJNI.ClientAPI_TransportStats_lastPacketReceived_get(swigCPtr, this);
|
||||
}
|
||||
|
||||
public ClientAPI_TransportStats() {
|
||||
this(ovpncliJNI.new_ClientAPI_TransportStats(), true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ClientAPI_TunBuilderBase {
|
||||
private transient long swigCPtr;
|
||||
protected transient boolean swigCMemOwn;
|
||||
|
||||
protected ClientAPI_TunBuilderBase(long cPtr, boolean cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected static long getCPtr(ClientAPI_TunBuilderBase obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(ClientAPI_TunBuilderBase obj) {
|
||||
long ptr = 0;
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new RuntimeException("Cannot release ownership as memory is not owned");
|
||||
ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.delete();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
||||
public synchronized void delete() {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
ovpncliJNI.delete_ClientAPI_TunBuilderBase(swigCPtr);
|
||||
}
|
||||
swigCPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean tun_builder_new() {
|
||||
return ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_new(swigCPtr, this);
|
||||
}
|
||||
|
||||
public boolean tun_builder_set_layer(int layer) {
|
||||
return ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_set_layer(swigCPtr, this, layer);
|
||||
}
|
||||
|
||||
public boolean tun_builder_set_remote_address(String address, boolean ipv6) {
|
||||
return ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_set_remote_address(swigCPtr, this, address, ipv6);
|
||||
}
|
||||
|
||||
public boolean tun_builder_add_address(String address, int prefix_length, String gateway, boolean ipv6, boolean net30) {
|
||||
return ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_add_address(swigCPtr, this, address, prefix_length, gateway, ipv6, net30);
|
||||
}
|
||||
|
||||
public boolean tun_builder_set_route_metric_default(int metric) {
|
||||
return ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_set_route_metric_default(swigCPtr, this, metric);
|
||||
}
|
||||
|
||||
public boolean tun_builder_reroute_gw(boolean ipv4, boolean ipv6, long flags) {
|
||||
return ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_reroute_gw(swigCPtr, this, ipv4, ipv6, flags);
|
||||
}
|
||||
|
||||
public boolean tun_builder_add_route(String address, int prefix_length, int metric, boolean ipv6) {
|
||||
return ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_add_route(swigCPtr, this, address, prefix_length, metric, ipv6);
|
||||
}
|
||||
|
||||
public boolean tun_builder_exclude_route(String address, int prefix_length, int metric, boolean ipv6) {
|
||||
return ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_exclude_route(swigCPtr, this, address, prefix_length, metric, ipv6);
|
||||
}
|
||||
|
||||
public boolean tun_builder_add_dns_server(String address, boolean ipv6) {
|
||||
return ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_add_dns_server(swigCPtr, this, address, ipv6);
|
||||
}
|
||||
|
||||
public boolean tun_builder_add_search_domain(String domain) {
|
||||
return ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_add_search_domain(swigCPtr, this, domain);
|
||||
}
|
||||
|
||||
public boolean tun_builder_set_mtu(int mtu) {
|
||||
return ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_set_mtu(swigCPtr, this, mtu);
|
||||
}
|
||||
|
||||
public boolean tun_builder_set_session_name(String name) {
|
||||
return ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_set_session_name(swigCPtr, this, name);
|
||||
}
|
||||
|
||||
public boolean tun_builder_add_proxy_bypass(String bypass_host) {
|
||||
return ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_add_proxy_bypass(swigCPtr, this, bypass_host);
|
||||
}
|
||||
|
||||
public boolean tun_builder_set_proxy_auto_config_url(String url) {
|
||||
return ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_set_proxy_auto_config_url(swigCPtr, this, url);
|
||||
}
|
||||
|
||||
public boolean tun_builder_set_proxy_http(String host, int port) {
|
||||
return ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_set_proxy_http(swigCPtr, this, host, port);
|
||||
}
|
||||
|
||||
public boolean tun_builder_set_proxy_https(String host, int port) {
|
||||
return ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_set_proxy_https(swigCPtr, this, host, port);
|
||||
}
|
||||
|
||||
public boolean tun_builder_add_wins_server(String address) {
|
||||
return ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_add_wins_server(swigCPtr, this, address);
|
||||
}
|
||||
|
||||
public boolean tun_builder_set_allow_family(int af, boolean allow) {
|
||||
return ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_set_allow_family(swigCPtr, this, af, allow);
|
||||
}
|
||||
|
||||
public boolean tun_builder_set_adapter_domain_suffix(String name) {
|
||||
return ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_set_adapter_domain_suffix(swigCPtr, this, name);
|
||||
}
|
||||
|
||||
public int tun_builder_establish() {
|
||||
return ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_establish(swigCPtr, this);
|
||||
}
|
||||
|
||||
public boolean tun_builder_persist() {
|
||||
return ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_persist(swigCPtr, this);
|
||||
}
|
||||
|
||||
public ClientAPI_StringVec tun_builder_get_local_networks(boolean ipv6) {
|
||||
return new ClientAPI_StringVec(ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_get_local_networks(swigCPtr, this, ipv6), true);
|
||||
}
|
||||
|
||||
public void tun_builder_establish_lite() {
|
||||
ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_establish_lite(swigCPtr, this);
|
||||
}
|
||||
|
||||
public void tun_builder_teardown(boolean disconnect) {
|
||||
ovpncliJNI.ClientAPI_TunBuilderBase_tun_builder_teardown(swigCPtr, this, disconnect);
|
||||
}
|
||||
|
||||
public ClientAPI_TunBuilderBase() {
|
||||
this(ovpncliJNI.new_ClientAPI_TunBuilderBase(), true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class SWIGTYPE_p_std__string {
|
||||
private transient long swigCPtr;
|
||||
|
||||
protected SWIGTYPE_p_std__string(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected SWIGTYPE_p_std__string() {
|
||||
swigCPtr = 0;
|
||||
}
|
||||
|
||||
protected static long getCPtr(SWIGTYPE_p_std__string obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(SWIGTYPE_p_std__string obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
}
|
||||
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class SWIGTYPE_p_std__vectorT_openvpn__ClientAPI__KeyValue_t {
|
||||
private transient long swigCPtr;
|
||||
|
||||
protected SWIGTYPE_p_std__vectorT_openvpn__ClientAPI__KeyValue_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected SWIGTYPE_p_std__vectorT_openvpn__ClientAPI__KeyValue_t() {
|
||||
swigCPtr = 0;
|
||||
}
|
||||
|
||||
protected static long getCPtr(SWIGTYPE_p_std__vectorT_openvpn__ClientAPI__KeyValue_t obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
protected static long swigRelease(SWIGTYPE_p_std__vectorT_openvpn__ClientAPI__KeyValue_t obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ovpncli {
|
||||
}
|
||||
@@ -1,532 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (https://www.swig.org).
|
||||
* Version 4.1.1
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing - modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package net.openvpn.ovpn3;
|
||||
|
||||
public class ovpncliJNI {
|
||||
public final static native long new_ClientAPI_ServerEntryVector__SWIG_0();
|
||||
public final static native long new_ClientAPI_ServerEntryVector__SWIG_1(long jarg1, ClientAPI_ServerEntryVector jarg1_);
|
||||
public final static native long ClientAPI_ServerEntryVector_capacity(long jarg1, ClientAPI_ServerEntryVector jarg1_);
|
||||
public final static native void ClientAPI_ServerEntryVector_reserve(long jarg1, ClientAPI_ServerEntryVector jarg1_, long jarg2);
|
||||
public final static native boolean ClientAPI_ServerEntryVector_isEmpty(long jarg1, ClientAPI_ServerEntryVector jarg1_);
|
||||
public final static native void ClientAPI_ServerEntryVector_clear(long jarg1, ClientAPI_ServerEntryVector jarg1_);
|
||||
public final static native long new_ClientAPI_ServerEntryVector__SWIG_2(int jarg1, long jarg2, ClientAPI_ServerEntry jarg2_);
|
||||
public final static native int ClientAPI_ServerEntryVector_doSize(long jarg1, ClientAPI_ServerEntryVector jarg1_);
|
||||
public final static native void ClientAPI_ServerEntryVector_doAdd__SWIG_0(long jarg1, ClientAPI_ServerEntryVector jarg1_, long jarg2, ClientAPI_ServerEntry jarg2_);
|
||||
public final static native void ClientAPI_ServerEntryVector_doAdd__SWIG_1(long jarg1, ClientAPI_ServerEntryVector jarg1_, int jarg2, long jarg3, ClientAPI_ServerEntry jarg3_);
|
||||
public final static native long ClientAPI_ServerEntryVector_doRemove(long jarg1, ClientAPI_ServerEntryVector jarg1_, int jarg2);
|
||||
public final static native long ClientAPI_ServerEntryVector_doGet(long jarg1, ClientAPI_ServerEntryVector jarg1_, int jarg2);
|
||||
public final static native long ClientAPI_ServerEntryVector_doSet(long jarg1, ClientAPI_ServerEntryVector jarg1_, int jarg2, long jarg3, ClientAPI_ServerEntry jarg3_);
|
||||
public final static native void ClientAPI_ServerEntryVector_doRemoveRange(long jarg1, ClientAPI_ServerEntryVector jarg1_, int jarg2, int jarg3);
|
||||
public final static native void delete_ClientAPI_ServerEntryVector(long jarg1);
|
||||
public final static native long new_ClientAPI_LLVector__SWIG_0();
|
||||
public final static native long new_ClientAPI_LLVector__SWIG_1(long jarg1, ClientAPI_LLVector jarg1_);
|
||||
public final static native long ClientAPI_LLVector_capacity(long jarg1, ClientAPI_LLVector jarg1_);
|
||||
public final static native void ClientAPI_LLVector_reserve(long jarg1, ClientAPI_LLVector jarg1_, long jarg2);
|
||||
public final static native boolean ClientAPI_LLVector_isEmpty(long jarg1, ClientAPI_LLVector jarg1_);
|
||||
public final static native void ClientAPI_LLVector_clear(long jarg1, ClientAPI_LLVector jarg1_);
|
||||
public final static native long new_ClientAPI_LLVector__SWIG_2(int jarg1, long jarg2);
|
||||
public final static native int ClientAPI_LLVector_doSize(long jarg1, ClientAPI_LLVector jarg1_);
|
||||
public final static native void ClientAPI_LLVector_doAdd__SWIG_0(long jarg1, ClientAPI_LLVector jarg1_, long jarg2);
|
||||
public final static native void ClientAPI_LLVector_doAdd__SWIG_1(long jarg1, ClientAPI_LLVector jarg1_, int jarg2, long jarg3);
|
||||
public final static native long ClientAPI_LLVector_doRemove(long jarg1, ClientAPI_LLVector jarg1_, int jarg2);
|
||||
public final static native long ClientAPI_LLVector_doGet(long jarg1, ClientAPI_LLVector jarg1_, int jarg2);
|
||||
public final static native long ClientAPI_LLVector_doSet(long jarg1, ClientAPI_LLVector jarg1_, int jarg2, long jarg3);
|
||||
public final static native void ClientAPI_LLVector_doRemoveRange(long jarg1, ClientAPI_LLVector jarg1_, int jarg2, int jarg3);
|
||||
public final static native void delete_ClientAPI_LLVector(long jarg1);
|
||||
public final static native long new_ClientAPI_StringVec__SWIG_0();
|
||||
public final static native long new_ClientAPI_StringVec__SWIG_1(long jarg1, ClientAPI_StringVec jarg1_);
|
||||
public final static native long ClientAPI_StringVec_capacity(long jarg1, ClientAPI_StringVec jarg1_);
|
||||
public final static native void ClientAPI_StringVec_reserve(long jarg1, ClientAPI_StringVec jarg1_, long jarg2);
|
||||
public final static native boolean ClientAPI_StringVec_isEmpty(long jarg1, ClientAPI_StringVec jarg1_);
|
||||
public final static native void ClientAPI_StringVec_clear(long jarg1, ClientAPI_StringVec jarg1_);
|
||||
public final static native long new_ClientAPI_StringVec__SWIG_2(int jarg1, String jarg2);
|
||||
public final static native int ClientAPI_StringVec_doSize(long jarg1, ClientAPI_StringVec jarg1_);
|
||||
public final static native void ClientAPI_StringVec_doAdd__SWIG_0(long jarg1, ClientAPI_StringVec jarg1_, String jarg2);
|
||||
public final static native void ClientAPI_StringVec_doAdd__SWIG_1(long jarg1, ClientAPI_StringVec jarg1_, int jarg2, String jarg3);
|
||||
public final static native String ClientAPI_StringVec_doRemove(long jarg1, ClientAPI_StringVec jarg1_, int jarg2);
|
||||
public final static native String ClientAPI_StringVec_doGet(long jarg1, ClientAPI_StringVec jarg1_, int jarg2);
|
||||
public final static native String ClientAPI_StringVec_doSet(long jarg1, ClientAPI_StringVec jarg1_, int jarg2, String jarg3);
|
||||
public final static native void ClientAPI_StringVec_doRemoveRange(long jarg1, ClientAPI_StringVec jarg1_, int jarg2, int jarg3);
|
||||
public final static native void delete_ClientAPI_StringVec(long jarg1);
|
||||
public final static native boolean ClientAPI_ExternalPKIBase_sign(long jarg1, ClientAPI_ExternalPKIBase jarg1_, String jarg2, long jarg3, String jarg4);
|
||||
public final static native void delete_ClientAPI_ExternalPKIBase(long jarg1);
|
||||
public final static native boolean ClientAPI_TunBuilderBase_tun_builder_new(long jarg1, ClientAPI_TunBuilderBase jarg1_);
|
||||
public final static native boolean ClientAPI_TunBuilderBase_tun_builder_set_layer(long jarg1, ClientAPI_TunBuilderBase jarg1_, int jarg2);
|
||||
public final static native boolean ClientAPI_TunBuilderBase_tun_builder_set_remote_address(long jarg1, ClientAPI_TunBuilderBase jarg1_, String jarg2, boolean jarg3);
|
||||
public final static native boolean ClientAPI_TunBuilderBase_tun_builder_add_address(long jarg1, ClientAPI_TunBuilderBase jarg1_, String jarg2, int jarg3, String jarg4, boolean jarg5, boolean jarg6);
|
||||
public final static native boolean ClientAPI_TunBuilderBase_tun_builder_set_route_metric_default(long jarg1, ClientAPI_TunBuilderBase jarg1_, int jarg2);
|
||||
public final static native boolean ClientAPI_TunBuilderBase_tun_builder_reroute_gw(long jarg1, ClientAPI_TunBuilderBase jarg1_, boolean jarg2, boolean jarg3, long jarg4);
|
||||
public final static native boolean ClientAPI_TunBuilderBase_tun_builder_add_route(long jarg1, ClientAPI_TunBuilderBase jarg1_, String jarg2, int jarg3, int jarg4, boolean jarg5);
|
||||
public final static native boolean ClientAPI_TunBuilderBase_tun_builder_exclude_route(long jarg1, ClientAPI_TunBuilderBase jarg1_, String jarg2, int jarg3, int jarg4, boolean jarg5);
|
||||
public final static native boolean ClientAPI_TunBuilderBase_tun_builder_add_dns_server(long jarg1, ClientAPI_TunBuilderBase jarg1_, String jarg2, boolean jarg3);
|
||||
public final static native boolean ClientAPI_TunBuilderBase_tun_builder_add_search_domain(long jarg1, ClientAPI_TunBuilderBase jarg1_, String jarg2);
|
||||
public final static native boolean ClientAPI_TunBuilderBase_tun_builder_set_mtu(long jarg1, ClientAPI_TunBuilderBase jarg1_, int jarg2);
|
||||
public final static native boolean ClientAPI_TunBuilderBase_tun_builder_set_session_name(long jarg1, ClientAPI_TunBuilderBase jarg1_, String jarg2);
|
||||
public final static native boolean ClientAPI_TunBuilderBase_tun_builder_add_proxy_bypass(long jarg1, ClientAPI_TunBuilderBase jarg1_, String jarg2);
|
||||
public final static native boolean ClientAPI_TunBuilderBase_tun_builder_set_proxy_auto_config_url(long jarg1, ClientAPI_TunBuilderBase jarg1_, String jarg2);
|
||||
public final static native boolean ClientAPI_TunBuilderBase_tun_builder_set_proxy_http(long jarg1, ClientAPI_TunBuilderBase jarg1_, String jarg2, int jarg3);
|
||||
public final static native boolean ClientAPI_TunBuilderBase_tun_builder_set_proxy_https(long jarg1, ClientAPI_TunBuilderBase jarg1_, String jarg2, int jarg3);
|
||||
public final static native boolean ClientAPI_TunBuilderBase_tun_builder_add_wins_server(long jarg1, ClientAPI_TunBuilderBase jarg1_, String jarg2);
|
||||
public final static native boolean ClientAPI_TunBuilderBase_tun_builder_set_allow_family(long jarg1, ClientAPI_TunBuilderBase jarg1_, int jarg2, boolean jarg3);
|
||||
public final static native boolean ClientAPI_TunBuilderBase_tun_builder_set_adapter_domain_suffix(long jarg1, ClientAPI_TunBuilderBase jarg1_, String jarg2);
|
||||
public final static native int ClientAPI_TunBuilderBase_tun_builder_establish(long jarg1, ClientAPI_TunBuilderBase jarg1_);
|
||||
public final static native boolean ClientAPI_TunBuilderBase_tun_builder_persist(long jarg1, ClientAPI_TunBuilderBase jarg1_);
|
||||
public final static native long ClientAPI_TunBuilderBase_tun_builder_get_local_networks(long jarg1, ClientAPI_TunBuilderBase jarg1_, boolean jarg2);
|
||||
public final static native void ClientAPI_TunBuilderBase_tun_builder_establish_lite(long jarg1, ClientAPI_TunBuilderBase jarg1_);
|
||||
public final static native void ClientAPI_TunBuilderBase_tun_builder_teardown(long jarg1, ClientAPI_TunBuilderBase jarg1_, boolean jarg2);
|
||||
public final static native void delete_ClientAPI_TunBuilderBase(long jarg1);
|
||||
public final static native long new_ClientAPI_TunBuilderBase();
|
||||
public final static native void ClientAPI_ServerEntry_server_set(long jarg1, ClientAPI_ServerEntry jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ServerEntry_server_get(long jarg1, ClientAPI_ServerEntry jarg1_);
|
||||
public final static native void ClientAPI_ServerEntry_friendlyName_set(long jarg1, ClientAPI_ServerEntry jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ServerEntry_friendlyName_get(long jarg1, ClientAPI_ServerEntry jarg1_);
|
||||
public final static native long new_ClientAPI_ServerEntry();
|
||||
public final static native void delete_ClientAPI_ServerEntry(long jarg1);
|
||||
public final static native void ClientAPI_EvalConfig_error_set(long jarg1, ClientAPI_EvalConfig jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_EvalConfig_error_get(long jarg1, ClientAPI_EvalConfig jarg1_);
|
||||
public final static native void ClientAPI_EvalConfig_message_set(long jarg1, ClientAPI_EvalConfig jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_EvalConfig_message_get(long jarg1, ClientAPI_EvalConfig jarg1_);
|
||||
public final static native void ClientAPI_EvalConfig_userlockedUsername_set(long jarg1, ClientAPI_EvalConfig jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_EvalConfig_userlockedUsername_get(long jarg1, ClientAPI_EvalConfig jarg1_);
|
||||
public final static native void ClientAPI_EvalConfig_profileName_set(long jarg1, ClientAPI_EvalConfig jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_EvalConfig_profileName_get(long jarg1, ClientAPI_EvalConfig jarg1_);
|
||||
public final static native void ClientAPI_EvalConfig_friendlyName_set(long jarg1, ClientAPI_EvalConfig jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_EvalConfig_friendlyName_get(long jarg1, ClientAPI_EvalConfig jarg1_);
|
||||
public final static native void ClientAPI_EvalConfig_autologin_set(long jarg1, ClientAPI_EvalConfig jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_EvalConfig_autologin_get(long jarg1, ClientAPI_EvalConfig jarg1_);
|
||||
public final static native void ClientAPI_EvalConfig_externalPki_set(long jarg1, ClientAPI_EvalConfig jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_EvalConfig_externalPki_get(long jarg1, ClientAPI_EvalConfig jarg1_);
|
||||
public final static native void ClientAPI_EvalConfig_staticChallenge_set(long jarg1, ClientAPI_EvalConfig jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_EvalConfig_staticChallenge_get(long jarg1, ClientAPI_EvalConfig jarg1_);
|
||||
public final static native void ClientAPI_EvalConfig_staticChallengeEcho_set(long jarg1, ClientAPI_EvalConfig jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_EvalConfig_staticChallengeEcho_get(long jarg1, ClientAPI_EvalConfig jarg1_);
|
||||
public final static native void ClientAPI_EvalConfig_privateKeyPasswordRequired_set(long jarg1, ClientAPI_EvalConfig jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_EvalConfig_privateKeyPasswordRequired_get(long jarg1, ClientAPI_EvalConfig jarg1_);
|
||||
public final static native void ClientAPI_EvalConfig_allowPasswordSave_set(long jarg1, ClientAPI_EvalConfig jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_EvalConfig_allowPasswordSave_get(long jarg1, ClientAPI_EvalConfig jarg1_);
|
||||
public final static native void ClientAPI_EvalConfig_remoteHost_set(long jarg1, ClientAPI_EvalConfig jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_EvalConfig_remoteHost_get(long jarg1, ClientAPI_EvalConfig jarg1_);
|
||||
public final static native void ClientAPI_EvalConfig_remotePort_set(long jarg1, ClientAPI_EvalConfig jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_EvalConfig_remotePort_get(long jarg1, ClientAPI_EvalConfig jarg1_);
|
||||
public final static native void ClientAPI_EvalConfig_remoteProto_set(long jarg1, ClientAPI_EvalConfig jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_EvalConfig_remoteProto_get(long jarg1, ClientAPI_EvalConfig jarg1_);
|
||||
public final static native void ClientAPI_EvalConfig_serverList_set(long jarg1, ClientAPI_EvalConfig jarg1_, long jarg2, ClientAPI_ServerEntryVector jarg2_);
|
||||
public final static native long ClientAPI_EvalConfig_serverList_get(long jarg1, ClientAPI_EvalConfig jarg1_);
|
||||
public final static native void ClientAPI_EvalConfig_windowsDriver_set(long jarg1, ClientAPI_EvalConfig jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_EvalConfig_windowsDriver_get(long jarg1, ClientAPI_EvalConfig jarg1_);
|
||||
public final static native long new_ClientAPI_EvalConfig();
|
||||
public final static native void delete_ClientAPI_EvalConfig(long jarg1);
|
||||
public final static native void ClientAPI_ProvideCreds_username_set(long jarg1, ClientAPI_ProvideCreds jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ProvideCreds_username_get(long jarg1, ClientAPI_ProvideCreds jarg1_);
|
||||
public final static native void ClientAPI_ProvideCreds_password_set(long jarg1, ClientAPI_ProvideCreds jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ProvideCreds_password_get(long jarg1, ClientAPI_ProvideCreds jarg1_);
|
||||
public final static native void ClientAPI_ProvideCreds_http_proxy_user_set(long jarg1, ClientAPI_ProvideCreds jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ProvideCreds_http_proxy_user_get(long jarg1, ClientAPI_ProvideCreds jarg1_);
|
||||
public final static native void ClientAPI_ProvideCreds_http_proxy_pass_set(long jarg1, ClientAPI_ProvideCreds jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ProvideCreds_http_proxy_pass_get(long jarg1, ClientAPI_ProvideCreds jarg1_);
|
||||
public final static native void ClientAPI_ProvideCreds_response_set(long jarg1, ClientAPI_ProvideCreds jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ProvideCreds_response_get(long jarg1, ClientAPI_ProvideCreds jarg1_);
|
||||
public final static native void ClientAPI_ProvideCreds_dynamicChallengeCookie_set(long jarg1, ClientAPI_ProvideCreds jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ProvideCreds_dynamicChallengeCookie_get(long jarg1, ClientAPI_ProvideCreds jarg1_);
|
||||
public final static native void ClientAPI_ProvideCreds_replacePasswordWithSessionID_set(long jarg1, ClientAPI_ProvideCreds jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_ProvideCreds_replacePasswordWithSessionID_get(long jarg1, ClientAPI_ProvideCreds jarg1_);
|
||||
public final static native void ClientAPI_ProvideCreds_cachePassword_set(long jarg1, ClientAPI_ProvideCreds jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_ProvideCreds_cachePassword_get(long jarg1, ClientAPI_ProvideCreds jarg1_);
|
||||
public final static native long new_ClientAPI_ProvideCreds();
|
||||
public final static native void delete_ClientAPI_ProvideCreds(long jarg1);
|
||||
public final static native void ClientAPI_SessionToken_username_set(long jarg1, ClientAPI_SessionToken jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_SessionToken_username_get(long jarg1, ClientAPI_SessionToken jarg1_);
|
||||
public final static native void ClientAPI_SessionToken_session_id_set(long jarg1, ClientAPI_SessionToken jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_SessionToken_session_id_get(long jarg1, ClientAPI_SessionToken jarg1_);
|
||||
public final static native long new_ClientAPI_SessionToken();
|
||||
public final static native void delete_ClientAPI_SessionToken(long jarg1);
|
||||
public final static native void ClientAPI_DynamicChallenge_challenge_set(long jarg1, ClientAPI_DynamicChallenge jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_DynamicChallenge_challenge_get(long jarg1, ClientAPI_DynamicChallenge jarg1_);
|
||||
public final static native void ClientAPI_DynamicChallenge_echo_set(long jarg1, ClientAPI_DynamicChallenge jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_DynamicChallenge_echo_get(long jarg1, ClientAPI_DynamicChallenge jarg1_);
|
||||
public final static native void ClientAPI_DynamicChallenge_responseRequired_set(long jarg1, ClientAPI_DynamicChallenge jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_DynamicChallenge_responseRequired_get(long jarg1, ClientAPI_DynamicChallenge jarg1_);
|
||||
public final static native void ClientAPI_DynamicChallenge_stateID_set(long jarg1, ClientAPI_DynamicChallenge jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_DynamicChallenge_stateID_get(long jarg1, ClientAPI_DynamicChallenge jarg1_);
|
||||
public final static native long new_ClientAPI_DynamicChallenge();
|
||||
public final static native void delete_ClientAPI_DynamicChallenge(long jarg1);
|
||||
public final static native long new_ClientAPI_KeyValue__SWIG_0();
|
||||
public final static native long new_ClientAPI_KeyValue__SWIG_1(String jarg1, String jarg2);
|
||||
public final static native void ClientAPI_KeyValue_key_set(long jarg1, ClientAPI_KeyValue jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_KeyValue_key_get(long jarg1, ClientAPI_KeyValue jarg1_);
|
||||
public final static native void ClientAPI_KeyValue_value_set(long jarg1, ClientAPI_KeyValue jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_KeyValue_value_get(long jarg1, ClientAPI_KeyValue jarg1_);
|
||||
public final static native void delete_ClientAPI_KeyValue(long jarg1);
|
||||
public final static native void ClientAPI_Config_content_set(long jarg1, ClientAPI_Config jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Config_content_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_contentList_set(long jarg1, ClientAPI_Config jarg1_, long jarg2);
|
||||
public final static native long ClientAPI_Config_contentList_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_guiVersion_set(long jarg1, ClientAPI_Config jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Config_guiVersion_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_ssoMethods_set(long jarg1, ClientAPI_Config jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Config_ssoMethods_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_hwAddrOverride_set(long jarg1, ClientAPI_Config jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Config_hwAddrOverride_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_platformVersion_set(long jarg1, ClientAPI_Config jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Config_platformVersion_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_serverOverride_set(long jarg1, ClientAPI_Config jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Config_serverOverride_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_portOverride_set(long jarg1, ClientAPI_Config jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Config_portOverride_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_protoOverride_set(long jarg1, ClientAPI_Config jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Config_protoOverride_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_protoVersionOverride_set(long jarg1, ClientAPI_Config jarg1_, int jarg2);
|
||||
public final static native int ClientAPI_Config_protoVersionOverride_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_allowUnusedAddrFamilies_set(long jarg1, ClientAPI_Config jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Config_allowUnusedAddrFamilies_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_connTimeout_set(long jarg1, ClientAPI_Config jarg1_, int jarg2);
|
||||
public final static native int ClientAPI_Config_connTimeout_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_tunPersist_set(long jarg1, ClientAPI_Config jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_Config_tunPersist_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_googleDnsFallback_set(long jarg1, ClientAPI_Config jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_Config_googleDnsFallback_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_synchronousDnsLookup_set(long jarg1, ClientAPI_Config jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_Config_synchronousDnsLookup_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_autologinSessions_set(long jarg1, ClientAPI_Config jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_Config_autologinSessions_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_retryOnAuthFailed_set(long jarg1, ClientAPI_Config jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_Config_retryOnAuthFailed_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_externalPkiAlias_set(long jarg1, ClientAPI_Config jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Config_externalPkiAlias_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_disableClientCert_set(long jarg1, ClientAPI_Config jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_Config_disableClientCert_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_sslDebugLevel_set(long jarg1, ClientAPI_Config jarg1_, int jarg2);
|
||||
public final static native int ClientAPI_Config_sslDebugLevel_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_compressionMode_set(long jarg1, ClientAPI_Config jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Config_compressionMode_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_privateKeyPassword_set(long jarg1, ClientAPI_Config jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Config_privateKeyPassword_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_defaultKeyDirection_set(long jarg1, ClientAPI_Config jarg1_, int jarg2);
|
||||
public final static native int ClientAPI_Config_defaultKeyDirection_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_tlsVersionMinOverride_set(long jarg1, ClientAPI_Config jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Config_tlsVersionMinOverride_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_tlsCertProfileOverride_set(long jarg1, ClientAPI_Config jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Config_tlsCertProfileOverride_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_tlsCipherList_set(long jarg1, ClientAPI_Config jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Config_tlsCipherList_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_tlsCiphersuitesList_set(long jarg1, ClientAPI_Config jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Config_tlsCiphersuitesList_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_peerInfo_set(long jarg1, ClientAPI_Config jarg1_, long jarg2);
|
||||
public final static native long ClientAPI_Config_peerInfo_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_proxyHost_set(long jarg1, ClientAPI_Config jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Config_proxyHost_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_proxyPort_set(long jarg1, ClientAPI_Config jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Config_proxyPort_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_proxyUsername_set(long jarg1, ClientAPI_Config jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Config_proxyUsername_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_proxyPassword_set(long jarg1, ClientAPI_Config jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Config_proxyPassword_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_proxyAllowCleartextAuth_set(long jarg1, ClientAPI_Config jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_Config_proxyAllowCleartextAuth_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_altProxy_set(long jarg1, ClientAPI_Config jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_Config_altProxy_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_dco_set(long jarg1, ClientAPI_Config jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_Config_dco_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_echo_set(long jarg1, ClientAPI_Config jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_Config_echo_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_info_set(long jarg1, ClientAPI_Config jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_Config_info_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_allowLocalLanAccess_set(long jarg1, ClientAPI_Config jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_Config_allowLocalLanAccess_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_clockTickMS_set(long jarg1, ClientAPI_Config jarg1_, long jarg2);
|
||||
public final static native long ClientAPI_Config_clockTickMS_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_gremlinConfig_set(long jarg1, ClientAPI_Config jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Config_gremlinConfig_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_usePluggableTransports_set(long jarg1, ClientAPI_Config jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_Config_usePluggableTransports_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_wintun_set(long jarg1, ClientAPI_Config jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_Config_wintun_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_allowLocalDnsResolvers_set(long jarg1, ClientAPI_Config jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_Config_allowLocalDnsResolvers_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_enableLegacyAlgorithms_set(long jarg1, ClientAPI_Config jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_Config_enableLegacyAlgorithms_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native void ClientAPI_Config_enableNonPreferredDCAlgorithms_set(long jarg1, ClientAPI_Config jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_Config_enableNonPreferredDCAlgorithms_get(long jarg1, ClientAPI_Config jarg1_);
|
||||
public final static native long new_ClientAPI_Config();
|
||||
public final static native void delete_ClientAPI_Config(long jarg1);
|
||||
public final static native void ClientAPI_Event_error_set(long jarg1, ClientAPI_Event jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_Event_error_get(long jarg1, ClientAPI_Event jarg1_);
|
||||
public final static native void ClientAPI_Event_fatal_set(long jarg1, ClientAPI_Event jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_Event_fatal_get(long jarg1, ClientAPI_Event jarg1_);
|
||||
public final static native void ClientAPI_Event_name_set(long jarg1, ClientAPI_Event jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Event_name_get(long jarg1, ClientAPI_Event jarg1_);
|
||||
public final static native void ClientAPI_Event_info_set(long jarg1, ClientAPI_Event jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Event_info_get(long jarg1, ClientAPI_Event jarg1_);
|
||||
public final static native long new_ClientAPI_Event();
|
||||
public final static native void delete_ClientAPI_Event(long jarg1);
|
||||
public final static native void ClientAPI_ConnectionInfo_defined_set(long jarg1, ClientAPI_ConnectionInfo jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_ConnectionInfo_defined_get(long jarg1, ClientAPI_ConnectionInfo jarg1_);
|
||||
public final static native void ClientAPI_ConnectionInfo_user_set(long jarg1, ClientAPI_ConnectionInfo jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ConnectionInfo_user_get(long jarg1, ClientAPI_ConnectionInfo jarg1_);
|
||||
public final static native void ClientAPI_ConnectionInfo_serverHost_set(long jarg1, ClientAPI_ConnectionInfo jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ConnectionInfo_serverHost_get(long jarg1, ClientAPI_ConnectionInfo jarg1_);
|
||||
public final static native void ClientAPI_ConnectionInfo_serverPort_set(long jarg1, ClientAPI_ConnectionInfo jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ConnectionInfo_serverPort_get(long jarg1, ClientAPI_ConnectionInfo jarg1_);
|
||||
public final static native void ClientAPI_ConnectionInfo_serverProto_set(long jarg1, ClientAPI_ConnectionInfo jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ConnectionInfo_serverProto_get(long jarg1, ClientAPI_ConnectionInfo jarg1_);
|
||||
public final static native void ClientAPI_ConnectionInfo_serverIp_set(long jarg1, ClientAPI_ConnectionInfo jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ConnectionInfo_serverIp_get(long jarg1, ClientAPI_ConnectionInfo jarg1_);
|
||||
public final static native void ClientAPI_ConnectionInfo_vpnIp4_set(long jarg1, ClientAPI_ConnectionInfo jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ConnectionInfo_vpnIp4_get(long jarg1, ClientAPI_ConnectionInfo jarg1_);
|
||||
public final static native void ClientAPI_ConnectionInfo_vpnIp6_set(long jarg1, ClientAPI_ConnectionInfo jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ConnectionInfo_vpnIp6_get(long jarg1, ClientAPI_ConnectionInfo jarg1_);
|
||||
public final static native void ClientAPI_ConnectionInfo_gw4_set(long jarg1, ClientAPI_ConnectionInfo jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ConnectionInfo_gw4_get(long jarg1, ClientAPI_ConnectionInfo jarg1_);
|
||||
public final static native void ClientAPI_ConnectionInfo_gw6_set(long jarg1, ClientAPI_ConnectionInfo jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ConnectionInfo_gw6_get(long jarg1, ClientAPI_ConnectionInfo jarg1_);
|
||||
public final static native void ClientAPI_ConnectionInfo_clientIp_set(long jarg1, ClientAPI_ConnectionInfo jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ConnectionInfo_clientIp_get(long jarg1, ClientAPI_ConnectionInfo jarg1_);
|
||||
public final static native void ClientAPI_ConnectionInfo_tunName_set(long jarg1, ClientAPI_ConnectionInfo jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ConnectionInfo_tunName_get(long jarg1, ClientAPI_ConnectionInfo jarg1_);
|
||||
public final static native long new_ClientAPI_ConnectionInfo();
|
||||
public final static native void delete_ClientAPI_ConnectionInfo(long jarg1);
|
||||
public final static native void ClientAPI_Status_error_set(long jarg1, ClientAPI_Status jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_Status_error_get(long jarg1, ClientAPI_Status jarg1_);
|
||||
public final static native void ClientAPI_Status_status_set(long jarg1, ClientAPI_Status jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Status_status_get(long jarg1, ClientAPI_Status jarg1_);
|
||||
public final static native void ClientAPI_Status_message_set(long jarg1, ClientAPI_Status jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_Status_message_get(long jarg1, ClientAPI_Status jarg1_);
|
||||
public final static native long new_ClientAPI_Status();
|
||||
public final static native void delete_ClientAPI_Status(long jarg1);
|
||||
public final static native long new_ClientAPI_LogInfo__SWIG_0();
|
||||
public final static native long new_ClientAPI_LogInfo__SWIG_1(String jarg1);
|
||||
public final static native void ClientAPI_LogInfo_text_set(long jarg1, ClientAPI_LogInfo jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_LogInfo_text_get(long jarg1, ClientAPI_LogInfo jarg1_);
|
||||
public final static native void delete_ClientAPI_LogInfo(long jarg1);
|
||||
public final static native void ClientAPI_InterfaceStats_bytesIn_set(long jarg1, ClientAPI_InterfaceStats jarg1_, long jarg2);
|
||||
public final static native long ClientAPI_InterfaceStats_bytesIn_get(long jarg1, ClientAPI_InterfaceStats jarg1_);
|
||||
public final static native void ClientAPI_InterfaceStats_packetsIn_set(long jarg1, ClientAPI_InterfaceStats jarg1_, long jarg2);
|
||||
public final static native long ClientAPI_InterfaceStats_packetsIn_get(long jarg1, ClientAPI_InterfaceStats jarg1_);
|
||||
public final static native void ClientAPI_InterfaceStats_errorsIn_set(long jarg1, ClientAPI_InterfaceStats jarg1_, long jarg2);
|
||||
public final static native long ClientAPI_InterfaceStats_errorsIn_get(long jarg1, ClientAPI_InterfaceStats jarg1_);
|
||||
public final static native void ClientAPI_InterfaceStats_bytesOut_set(long jarg1, ClientAPI_InterfaceStats jarg1_, long jarg2);
|
||||
public final static native long ClientAPI_InterfaceStats_bytesOut_get(long jarg1, ClientAPI_InterfaceStats jarg1_);
|
||||
public final static native void ClientAPI_InterfaceStats_packetsOut_set(long jarg1, ClientAPI_InterfaceStats jarg1_, long jarg2);
|
||||
public final static native long ClientAPI_InterfaceStats_packetsOut_get(long jarg1, ClientAPI_InterfaceStats jarg1_);
|
||||
public final static native void ClientAPI_InterfaceStats_errorsOut_set(long jarg1, ClientAPI_InterfaceStats jarg1_, long jarg2);
|
||||
public final static native long ClientAPI_InterfaceStats_errorsOut_get(long jarg1, ClientAPI_InterfaceStats jarg1_);
|
||||
public final static native long new_ClientAPI_InterfaceStats();
|
||||
public final static native void delete_ClientAPI_InterfaceStats(long jarg1);
|
||||
public final static native void ClientAPI_TransportStats_bytesIn_set(long jarg1, ClientAPI_TransportStats jarg1_, long jarg2);
|
||||
public final static native long ClientAPI_TransportStats_bytesIn_get(long jarg1, ClientAPI_TransportStats jarg1_);
|
||||
public final static native void ClientAPI_TransportStats_bytesOut_set(long jarg1, ClientAPI_TransportStats jarg1_, long jarg2);
|
||||
public final static native long ClientAPI_TransportStats_bytesOut_get(long jarg1, ClientAPI_TransportStats jarg1_);
|
||||
public final static native void ClientAPI_TransportStats_packetsIn_set(long jarg1, ClientAPI_TransportStats jarg1_, long jarg2);
|
||||
public final static native long ClientAPI_TransportStats_packetsIn_get(long jarg1, ClientAPI_TransportStats jarg1_);
|
||||
public final static native void ClientAPI_TransportStats_packetsOut_set(long jarg1, ClientAPI_TransportStats jarg1_, long jarg2);
|
||||
public final static native long ClientAPI_TransportStats_packetsOut_get(long jarg1, ClientAPI_TransportStats jarg1_);
|
||||
public final static native void ClientAPI_TransportStats_lastPacketReceived_set(long jarg1, ClientAPI_TransportStats jarg1_, int jarg2);
|
||||
public final static native int ClientAPI_TransportStats_lastPacketReceived_get(long jarg1, ClientAPI_TransportStats jarg1_);
|
||||
public final static native long new_ClientAPI_TransportStats();
|
||||
public final static native void delete_ClientAPI_TransportStats(long jarg1);
|
||||
public final static native void ClientAPI_MergeConfig_status_set(long jarg1, ClientAPI_MergeConfig jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_MergeConfig_status_get(long jarg1, ClientAPI_MergeConfig jarg1_);
|
||||
public final static native void ClientAPI_MergeConfig_errorText_set(long jarg1, ClientAPI_MergeConfig jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_MergeConfig_errorText_get(long jarg1, ClientAPI_MergeConfig jarg1_);
|
||||
public final static native void ClientAPI_MergeConfig_basename_set(long jarg1, ClientAPI_MergeConfig jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_MergeConfig_basename_get(long jarg1, ClientAPI_MergeConfig jarg1_);
|
||||
public final static native void ClientAPI_MergeConfig_profileContent_set(long jarg1, ClientAPI_MergeConfig jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_MergeConfig_profileContent_get(long jarg1, ClientAPI_MergeConfig jarg1_);
|
||||
public final static native void ClientAPI_MergeConfig_refPathList_set(long jarg1, ClientAPI_MergeConfig jarg1_, long jarg2, ClientAPI_StringVec jarg2_);
|
||||
public final static native long ClientAPI_MergeConfig_refPathList_get(long jarg1, ClientAPI_MergeConfig jarg1_);
|
||||
public final static native long new_ClientAPI_MergeConfig();
|
||||
public final static native void delete_ClientAPI_MergeConfig(long jarg1);
|
||||
public final static native void ClientAPI_ExternalPKIRequestBase_error_set(long jarg1, ClientAPI_ExternalPKIRequestBase jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_ExternalPKIRequestBase_error_get(long jarg1, ClientAPI_ExternalPKIRequestBase jarg1_);
|
||||
public final static native void ClientAPI_ExternalPKIRequestBase_errorText_set(long jarg1, ClientAPI_ExternalPKIRequestBase jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ExternalPKIRequestBase_errorText_get(long jarg1, ClientAPI_ExternalPKIRequestBase jarg1_);
|
||||
public final static native void ClientAPI_ExternalPKIRequestBase_invalidAlias_set(long jarg1, ClientAPI_ExternalPKIRequestBase jarg1_, boolean jarg2);
|
||||
public final static native boolean ClientAPI_ExternalPKIRequestBase_invalidAlias_get(long jarg1, ClientAPI_ExternalPKIRequestBase jarg1_);
|
||||
public final static native void ClientAPI_ExternalPKIRequestBase_alias_set(long jarg1, ClientAPI_ExternalPKIRequestBase jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ExternalPKIRequestBase_alias_get(long jarg1, ClientAPI_ExternalPKIRequestBase jarg1_);
|
||||
public final static native long new_ClientAPI_ExternalPKIRequestBase();
|
||||
public final static native void delete_ClientAPI_ExternalPKIRequestBase(long jarg1);
|
||||
public final static native void ClientAPI_ExternalPKICertRequest_cert_set(long jarg1, ClientAPI_ExternalPKICertRequest jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ExternalPKICertRequest_cert_get(long jarg1, ClientAPI_ExternalPKICertRequest jarg1_);
|
||||
public final static native void ClientAPI_ExternalPKICertRequest_supportingChain_set(long jarg1, ClientAPI_ExternalPKICertRequest jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ExternalPKICertRequest_supportingChain_get(long jarg1, ClientAPI_ExternalPKICertRequest jarg1_);
|
||||
public final static native long new_ClientAPI_ExternalPKICertRequest();
|
||||
public final static native void delete_ClientAPI_ExternalPKICertRequest(long jarg1);
|
||||
public final static native void ClientAPI_ExternalPKISignRequest_data_set(long jarg1, ClientAPI_ExternalPKISignRequest jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ExternalPKISignRequest_data_get(long jarg1, ClientAPI_ExternalPKISignRequest jarg1_);
|
||||
public final static native void ClientAPI_ExternalPKISignRequest_sig_set(long jarg1, ClientAPI_ExternalPKISignRequest jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ExternalPKISignRequest_sig_get(long jarg1, ClientAPI_ExternalPKISignRequest jarg1_);
|
||||
public final static native void ClientAPI_ExternalPKISignRequest_algorithm_set(long jarg1, ClientAPI_ExternalPKISignRequest jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_ExternalPKISignRequest_algorithm_get(long jarg1, ClientAPI_ExternalPKISignRequest jarg1_);
|
||||
public final static native long new_ClientAPI_ExternalPKISignRequest();
|
||||
public final static native void delete_ClientAPI_ExternalPKISignRequest(long jarg1);
|
||||
public final static native void ClientAPI_RemoteOverride_host_set(long jarg1, ClientAPI_RemoteOverride jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_RemoteOverride_host_get(long jarg1, ClientAPI_RemoteOverride jarg1_);
|
||||
public final static native void ClientAPI_RemoteOverride_ip_set(long jarg1, ClientAPI_RemoteOverride jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_RemoteOverride_ip_get(long jarg1, ClientAPI_RemoteOverride jarg1_);
|
||||
public final static native void ClientAPI_RemoteOverride_port_set(long jarg1, ClientAPI_RemoteOverride jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_RemoteOverride_port_get(long jarg1, ClientAPI_RemoteOverride jarg1_);
|
||||
public final static native void ClientAPI_RemoteOverride_proto_set(long jarg1, ClientAPI_RemoteOverride jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_RemoteOverride_proto_get(long jarg1, ClientAPI_RemoteOverride jarg1_);
|
||||
public final static native void ClientAPI_RemoteOverride_error_set(long jarg1, ClientAPI_RemoteOverride jarg1_, String jarg2);
|
||||
public final static native String ClientAPI_RemoteOverride_error_get(long jarg1, ClientAPI_RemoteOverride jarg1_);
|
||||
public final static native long new_ClientAPI_RemoteOverride();
|
||||
public final static native void delete_ClientAPI_RemoteOverride(long jarg1);
|
||||
public final static native long new_ClientAPI_OpenVPNClientHelper();
|
||||
public final static native void delete_ClientAPI_OpenVPNClientHelper(long jarg1);
|
||||
public final static native long ClientAPI_OpenVPNClientHelper_merge_config(long jarg1, ClientAPI_OpenVPNClientHelper jarg1_, String jarg2, boolean jarg3);
|
||||
public final static native long ClientAPI_OpenVPNClientHelper_merge_config_string(long jarg1, ClientAPI_OpenVPNClientHelper jarg1_, String jarg2);
|
||||
public final static native long ClientAPI_OpenVPNClientHelper_eval_config(long jarg1, ClientAPI_OpenVPNClientHelper jarg1_, long jarg2, ClientAPI_Config jarg2_);
|
||||
public final static native int ClientAPI_OpenVPNClientHelper_max_profile_size();
|
||||
public final static native boolean ClientAPI_OpenVPNClientHelper_parse_dynamic_challenge(String jarg1, long jarg2, ClientAPI_DynamicChallenge jarg2_);
|
||||
public final static native String ClientAPI_OpenVPNClientHelper_crypto_self_test(long jarg1, ClientAPI_OpenVPNClientHelper jarg1_);
|
||||
public final static native String ClientAPI_OpenVPNClientHelper_platform();
|
||||
public final static native String ClientAPI_OpenVPNClientHelper_copyright();
|
||||
public final static native long new_ClientAPI_OpenVPNClient();
|
||||
public final static native void delete_ClientAPI_OpenVPNClient(long jarg1);
|
||||
public final static native long ClientAPI_OpenVPNClient_eval_config(long jarg1, ClientAPI_OpenVPNClient jarg1_, long jarg2, ClientAPI_Config jarg2_);
|
||||
public final static native long ClientAPI_OpenVPNClient_provide_creds(long jarg1, ClientAPI_OpenVPNClient jarg1_, long jarg2, ClientAPI_ProvideCreds jarg2_);
|
||||
public final static native boolean ClientAPI_OpenVPNClient_socket_protect(long jarg1, ClientAPI_OpenVPNClient jarg1_, int jarg2, String jarg3, boolean jarg4);
|
||||
public final static native boolean ClientAPI_OpenVPNClient_socket_protectSwigExplicitClientAPI_OpenVPNClient(long jarg1, ClientAPI_OpenVPNClient jarg1_, int jarg2, String jarg3, boolean jarg4);
|
||||
public final static native long ClientAPI_OpenVPNClient_connect(long jarg1, ClientAPI_OpenVPNClient jarg1_);
|
||||
public final static native long ClientAPI_OpenVPNClient_connection_info(long jarg1, ClientAPI_OpenVPNClient jarg1_);
|
||||
public final static native boolean ClientAPI_OpenVPNClient_session_token(long jarg1, ClientAPI_OpenVPNClient jarg1_, long jarg2, ClientAPI_SessionToken jarg2_);
|
||||
public final static native void ClientAPI_OpenVPNClient_stop(long jarg1, ClientAPI_OpenVPNClient jarg1_);
|
||||
public final static native void ClientAPI_OpenVPNClient_pause(long jarg1, ClientAPI_OpenVPNClient jarg1_, String jarg2);
|
||||
public final static native void ClientAPI_OpenVPNClient_resume(long jarg1, ClientAPI_OpenVPNClient jarg1_);
|
||||
public final static native void ClientAPI_OpenVPNClient_reconnect(long jarg1, ClientAPI_OpenVPNClient jarg1_, int jarg2);
|
||||
public final static native boolean ClientAPI_OpenVPNClient_pause_on_connection_timeout(long jarg1, ClientAPI_OpenVPNClient jarg1_);
|
||||
public final static native int ClientAPI_OpenVPNClient_stats_n();
|
||||
public final static native String ClientAPI_OpenVPNClient_stats_name(int jarg1);
|
||||
public final static native long ClientAPI_OpenVPNClient_stats_value(long jarg1, ClientAPI_OpenVPNClient jarg1_, int jarg2);
|
||||
public final static native long ClientAPI_OpenVPNClient_stats_bundle(long jarg1, ClientAPI_OpenVPNClient jarg1_);
|
||||
public final static native long ClientAPI_OpenVPNClient_tun_stats(long jarg1, ClientAPI_OpenVPNClient jarg1_);
|
||||
public final static native long ClientAPI_OpenVPNClient_transport_stats(long jarg1, ClientAPI_OpenVPNClient jarg1_);
|
||||
public final static native void ClientAPI_OpenVPNClient_post_cc_msg(long jarg1, ClientAPI_OpenVPNClient jarg1_, String jarg2);
|
||||
public final static native void ClientAPI_OpenVPNClient_event(long jarg1, ClientAPI_OpenVPNClient jarg1_, long jarg2, ClientAPI_Event jarg2_);
|
||||
public final static native void ClientAPI_OpenVPNClient_log(long jarg1, ClientAPI_OpenVPNClient jarg1_, long jarg2, ClientAPI_LogInfo jarg2_);
|
||||
public final static native void ClientAPI_OpenVPNClient_external_pki_cert_request(long jarg1, ClientAPI_OpenVPNClient jarg1_, long jarg2, ClientAPI_ExternalPKICertRequest jarg2_);
|
||||
public final static native void ClientAPI_OpenVPNClient_external_pki_sign_request(long jarg1, ClientAPI_OpenVPNClient jarg1_, long jarg2, ClientAPI_ExternalPKISignRequest jarg2_);
|
||||
public final static native boolean ClientAPI_OpenVPNClient_remote_override_enabled(long jarg1, ClientAPI_OpenVPNClient jarg1_);
|
||||
public final static native boolean ClientAPI_OpenVPNClient_remote_override_enabledSwigExplicitClientAPI_OpenVPNClient(long jarg1, ClientAPI_OpenVPNClient jarg1_);
|
||||
public final static native void ClientAPI_OpenVPNClient_remote_override(long jarg1, ClientAPI_OpenVPNClient jarg1_, long jarg2, ClientAPI_RemoteOverride jarg2_);
|
||||
public final static native void ClientAPI_OpenVPNClient_remote_overrideSwigExplicitClientAPI_OpenVPNClient(long jarg1, ClientAPI_OpenVPNClient jarg1_, long jarg2, ClientAPI_RemoteOverride jarg2_);
|
||||
public final static native void ClientAPI_OpenVPNClient_clock_tick(long jarg1, ClientAPI_OpenVPNClient jarg1_);
|
||||
public final static native void ClientAPI_OpenVPNClient_clock_tickSwigExplicitClientAPI_OpenVPNClient(long jarg1, ClientAPI_OpenVPNClient jarg1_);
|
||||
public final static native void ClientAPI_OpenVPNClient_director_connect(ClientAPI_OpenVPNClient obj, long cptr, boolean mem_own, boolean weak_global);
|
||||
public final static native void ClientAPI_OpenVPNClient_change_ownership(ClientAPI_OpenVPNClient obj, long cptr, boolean take_or_release);
|
||||
public final static native long ClientAPI_ExternalPKICertRequest_SWIGUpcast(long jarg1);
|
||||
public final static native long ClientAPI_ExternalPKISignRequest_SWIGUpcast(long jarg1);
|
||||
public final static native long ClientAPI_OpenVPNClient_SWIGUpcast(long jarg1);
|
||||
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_tun_builder_new(ClientAPI_OpenVPNClient jself) {
|
||||
return jself.tun_builder_new();
|
||||
}
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_tun_builder_set_layer(ClientAPI_OpenVPNClient jself, int layer) {
|
||||
return jself.tun_builder_set_layer(layer);
|
||||
}
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_tun_builder_set_remote_address(ClientAPI_OpenVPNClient jself, String address, boolean ipv6) {
|
||||
return jself.tun_builder_set_remote_address(address, ipv6);
|
||||
}
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_tun_builder_add_address(ClientAPI_OpenVPNClient jself, String address, int prefix_length, String gateway, boolean ipv6, boolean net30) {
|
||||
return jself.tun_builder_add_address(address, prefix_length, gateway, ipv6, net30);
|
||||
}
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_tun_builder_set_route_metric_default(ClientAPI_OpenVPNClient jself, int metric) {
|
||||
return jself.tun_builder_set_route_metric_default(metric);
|
||||
}
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_tun_builder_reroute_gw(ClientAPI_OpenVPNClient jself, boolean ipv4, boolean ipv6, long flags) {
|
||||
return jself.tun_builder_reroute_gw(ipv4, ipv6, flags);
|
||||
}
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_tun_builder_add_route(ClientAPI_OpenVPNClient jself, String address, int prefix_length, int metric, boolean ipv6) {
|
||||
return jself.tun_builder_add_route(address, prefix_length, metric, ipv6);
|
||||
}
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_tun_builder_exclude_route(ClientAPI_OpenVPNClient jself, String address, int prefix_length, int metric, boolean ipv6) {
|
||||
return jself.tun_builder_exclude_route(address, prefix_length, metric, ipv6);
|
||||
}
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_tun_builder_add_dns_server(ClientAPI_OpenVPNClient jself, String address, boolean ipv6) {
|
||||
return jself.tun_builder_add_dns_server(address, ipv6);
|
||||
}
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_tun_builder_add_search_domain(ClientAPI_OpenVPNClient jself, String domain) {
|
||||
return jself.tun_builder_add_search_domain(domain);
|
||||
}
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_tun_builder_set_mtu(ClientAPI_OpenVPNClient jself, int mtu) {
|
||||
return jself.tun_builder_set_mtu(mtu);
|
||||
}
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_tun_builder_set_session_name(ClientAPI_OpenVPNClient jself, String name) {
|
||||
return jself.tun_builder_set_session_name(name);
|
||||
}
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_tun_builder_add_proxy_bypass(ClientAPI_OpenVPNClient jself, String bypass_host) {
|
||||
return jself.tun_builder_add_proxy_bypass(bypass_host);
|
||||
}
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_tun_builder_set_proxy_auto_config_url(ClientAPI_OpenVPNClient jself, String url) {
|
||||
return jself.tun_builder_set_proxy_auto_config_url(url);
|
||||
}
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_tun_builder_set_proxy_http(ClientAPI_OpenVPNClient jself, String host, int port) {
|
||||
return jself.tun_builder_set_proxy_http(host, port);
|
||||
}
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_tun_builder_set_proxy_https(ClientAPI_OpenVPNClient jself, String host, int port) {
|
||||
return jself.tun_builder_set_proxy_https(host, port);
|
||||
}
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_tun_builder_add_wins_server(ClientAPI_OpenVPNClient jself, String address) {
|
||||
return jself.tun_builder_add_wins_server(address);
|
||||
}
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_tun_builder_set_allow_family(ClientAPI_OpenVPNClient jself, int af, boolean allow) {
|
||||
return jself.tun_builder_set_allow_family(af, allow);
|
||||
}
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_tun_builder_set_adapter_domain_suffix(ClientAPI_OpenVPNClient jself, String name) {
|
||||
return jself.tun_builder_set_adapter_domain_suffix(name);
|
||||
}
|
||||
public static int SwigDirector_ClientAPI_OpenVPNClient_tun_builder_establish(ClientAPI_OpenVPNClient jself) {
|
||||
return jself.tun_builder_establish();
|
||||
}
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_tun_builder_persist(ClientAPI_OpenVPNClient jself) {
|
||||
return jself.tun_builder_persist();
|
||||
}
|
||||
public static long SwigDirector_ClientAPI_OpenVPNClient_tun_builder_get_local_networks(ClientAPI_OpenVPNClient jself, boolean ipv6) {
|
||||
return ClientAPI_StringVec.getCPtr(jself.tun_builder_get_local_networks(ipv6));
|
||||
}
|
||||
public static void SwigDirector_ClientAPI_OpenVPNClient_tun_builder_establish_lite(ClientAPI_OpenVPNClient jself) {
|
||||
jself.tun_builder_establish_lite();
|
||||
}
|
||||
public static void SwigDirector_ClientAPI_OpenVPNClient_tun_builder_teardown(ClientAPI_OpenVPNClient jself, boolean disconnect) {
|
||||
jself.tun_builder_teardown(disconnect);
|
||||
}
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_socket_protect(ClientAPI_OpenVPNClient jself, int socket, String remote, boolean ipv6) {
|
||||
return jself.socket_protect(socket, remote, ipv6);
|
||||
}
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_pause_on_connection_timeout(ClientAPI_OpenVPNClient jself) {
|
||||
return jself.pause_on_connection_timeout();
|
||||
}
|
||||
public static void SwigDirector_ClientAPI_OpenVPNClient_event(ClientAPI_OpenVPNClient jself, long arg0) {
|
||||
jself.event(new ClientAPI_Event(arg0, false));
|
||||
}
|
||||
public static void SwigDirector_ClientAPI_OpenVPNClient_log(ClientAPI_OpenVPNClient jself, long arg0) {
|
||||
jself.log(new ClientAPI_LogInfo(arg0, false));
|
||||
}
|
||||
public static void SwigDirector_ClientAPI_OpenVPNClient_external_pki_cert_request(ClientAPI_OpenVPNClient jself, long arg0) {
|
||||
jself.external_pki_cert_request(new ClientAPI_ExternalPKICertRequest(arg0, false));
|
||||
}
|
||||
public static void SwigDirector_ClientAPI_OpenVPNClient_external_pki_sign_request(ClientAPI_OpenVPNClient jself, long arg0) {
|
||||
jself.external_pki_sign_request(new ClientAPI_ExternalPKISignRequest(arg0, false));
|
||||
}
|
||||
public static boolean SwigDirector_ClientAPI_OpenVPNClient_remote_override_enabled(ClientAPI_OpenVPNClient jself) {
|
||||
return jself.remote_override_enabled();
|
||||
}
|
||||
public static void SwigDirector_ClientAPI_OpenVPNClient_remote_override(ClientAPI_OpenVPNClient jself, long arg0) {
|
||||
jself.remote_override(new ClientAPI_RemoteOverride(arg0, false));
|
||||
}
|
||||
public static void SwigDirector_ClientAPI_OpenVPNClient_clock_tick(ClientAPI_OpenVPNClient jself) {
|
||||
jself.clock_tick();
|
||||
}
|
||||
|
||||
private final static native void swig_module_init();
|
||||
static {
|
||||
swig_module_init();
|
||||
}
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
package org.amnezia.vpn.protocol.openvpn
|
||||
|
||||
import android.net.VpnService.Builder
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.cancel
|
||||
import kotlinx.coroutines.launch
|
||||
import net.openvpn.ovpn3.ClientAPI_Config
|
||||
import org.amnezia.vpn.protocol.BadConfigException
|
||||
import org.amnezia.vpn.protocol.Protocol
|
||||
import org.amnezia.vpn.protocol.ProtocolState.DISCONNECTED
|
||||
import org.amnezia.vpn.protocol.Statistics
|
||||
import org.amnezia.vpn.protocol.VpnStartException
|
||||
import org.amnezia.vpn.util.LibraryLoader.loadSharedLibrary
|
||||
import org.amnezia.vpn.util.net.InetNetwork
|
||||
import org.amnezia.vpn.util.net.getLocalNetworks
|
||||
import org.amnezia.vpn.util.net.parseInetAddress
|
||||
import org.json.JSONObject
|
||||
|
||||
open class OpenVpn : Protocol() {
|
||||
|
||||
private var openVpnClient: OpenVpnClient? = null
|
||||
private lateinit var scope: CoroutineScope
|
||||
|
||||
override val statistics: Statistics
|
||||
get() {
|
||||
openVpnClient?.let { client ->
|
||||
val stats = client.transport_stats()
|
||||
return Statistics.build {
|
||||
setRxBytes(stats.bytesIn)
|
||||
setTxBytes(stats.bytesOut)
|
||||
}
|
||||
}
|
||||
return Statistics.EMPTY_STATISTICS
|
||||
}
|
||||
|
||||
override fun internalInit() {
|
||||
if (!isInitialized) {
|
||||
loadSharedLibrary(context, "ovpn3")
|
||||
loadSharedLibrary(context, "ovpnutil")
|
||||
}
|
||||
if (this::scope.isInitialized) {
|
||||
scope.cancel()
|
||||
}
|
||||
scope = CoroutineScope(Dispatchers.IO)
|
||||
}
|
||||
|
||||
override suspend fun startVpn(config: JSONObject, vpnBuilder: Builder, protect: (Int) -> Boolean) {
|
||||
val configBuilder = OpenVpnConfig.Builder()
|
||||
|
||||
openVpnClient = OpenVpnClient(
|
||||
configBuilder = configBuilder,
|
||||
state = state,
|
||||
getLocalNetworks = { ipv6 -> getLocalNetworks(context, ipv6) },
|
||||
establish = makeEstablish(vpnBuilder),
|
||||
protect = protect,
|
||||
onError = onError
|
||||
)
|
||||
|
||||
try {
|
||||
openVpnClient?.let { client ->
|
||||
val openVpnConfig = parseConfig(config)
|
||||
val evalConfig = client.eval_config(openVpnConfig)
|
||||
if (evalConfig.error) {
|
||||
throw BadConfigException("OpenVPN config parse error: ${evalConfig.message}")
|
||||
}
|
||||
|
||||
// exclude remote server ip from vpn routes
|
||||
val remoteServer = config.getString("hostName")
|
||||
val remoteServerAddress = InetNetwork(parseInetAddress(remoteServer))
|
||||
configBuilder.excludeRoute(remoteServerAddress)
|
||||
|
||||
configPluggableTransport(configBuilder, config)
|
||||
configBuilder.configSplitTunneling(config)
|
||||
configBuilder.configAppSplitTunneling(config)
|
||||
|
||||
scope.launch {
|
||||
val status = client.connect()
|
||||
if (status.error) {
|
||||
state.value = DISCONNECTED
|
||||
onError("OpenVpn connect() error: ${status.status}: ${status.message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
openVpnClient = null
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
override fun stopVpn() {
|
||||
openVpnClient?.stop()
|
||||
openVpnClient = null
|
||||
}
|
||||
|
||||
override fun reconnectVpn(vpnBuilder: Builder) {
|
||||
openVpnClient?.let {
|
||||
it.establish = makeEstablish(vpnBuilder)
|
||||
it.reconnect(0)
|
||||
}
|
||||
}
|
||||
|
||||
protected open fun parseConfig(config: JSONObject): ClientAPI_Config {
|
||||
val openVpnConfig = ClientAPI_Config()
|
||||
openVpnConfig.content = config.getJSONObject("openvpn_config_data").getString("config")
|
||||
return openVpnConfig
|
||||
}
|
||||
|
||||
protected open fun configPluggableTransport(configBuilder: OpenVpnConfig.Builder, config: JSONObject) {}
|
||||
|
||||
private fun makeEstablish(vpnBuilder: Builder): (OpenVpnConfig.Builder) -> Int = { configBuilder ->
|
||||
val openVpnConfig = configBuilder.build()
|
||||
buildVpnInterface(openVpnConfig, vpnBuilder)
|
||||
|
||||
vpnBuilder.establish().use { tunFd ->
|
||||
if (tunFd == null) {
|
||||
throw VpnStartException("Create VPN interface: permission not granted or revoked")
|
||||
}
|
||||
return@use tunFd.detachFd()
|
||||
}
|
||||
}
|
||||
}
|
||||
-426
@@ -1,426 +0,0 @@
|
||||
package org.amnezia.vpn.protocol.openvpn
|
||||
|
||||
import android.net.ProxyInfo
|
||||
import android.os.Build
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.getAndUpdate
|
||||
import net.openvpn.ovpn3.ClientAPI_Config
|
||||
import net.openvpn.ovpn3.ClientAPI_EvalConfig
|
||||
import net.openvpn.ovpn3.ClientAPI_Event
|
||||
import net.openvpn.ovpn3.ClientAPI_LogInfo
|
||||
import net.openvpn.ovpn3.ClientAPI_OpenVPNClient
|
||||
import net.openvpn.ovpn3.ClientAPI_Status
|
||||
import net.openvpn.ovpn3.ClientAPI_StringVec
|
||||
import net.openvpn.ovpn3.ClientAPI_TransportStats
|
||||
import org.amnezia.vpn.protocol.ProtocolState
|
||||
import org.amnezia.vpn.protocol.ProtocolState.CONNECTED
|
||||
import org.amnezia.vpn.protocol.ProtocolState.DISCONNECTED
|
||||
import org.amnezia.vpn.protocol.ProtocolState.RECONNECTING
|
||||
import org.amnezia.vpn.util.Log
|
||||
import org.amnezia.vpn.util.net.InetNetwork
|
||||
import org.amnezia.vpn.util.net.parseInetAddress
|
||||
|
||||
private const val TAG = "OpenVpnClient"
|
||||
private const val EMULATED_EXCLUDE_ROUTES = (1 shl 16)
|
||||
|
||||
class OpenVpnClient(
|
||||
private val configBuilder: OpenVpnConfig.Builder,
|
||||
private val state: MutableStateFlow<ProtocolState>,
|
||||
private val getLocalNetworks: (Boolean) -> List<InetNetwork>,
|
||||
internal var establish: (OpenVpnConfig.Builder) -> Int,
|
||||
private val protect: (Int) -> Boolean,
|
||||
private val onError: (String) -> Unit
|
||||
) : ClientAPI_OpenVPNClient() {
|
||||
|
||||
/**************************************************************************
|
||||
* Tun builder callbacks
|
||||
**************************************************************************/
|
||||
|
||||
// Tun builder methods, loosely based on the Android VpnService.Builder
|
||||
// abstraction. These methods comprise an abstraction layer that
|
||||
// allows the OpenVPN C++ core to call out to external methods for
|
||||
// establishing the tunnel, adding routes, etc.
|
||||
|
||||
// All methods returning bool use the return
|
||||
// value to indicate success (true) or fail (false).
|
||||
// tun_builder_new() should be called first, then arbitrary setter methods,
|
||||
// and finally tun_builder_establish to return the socket descriptor
|
||||
// for the session. IP addresses are pre-validated before being passed to
|
||||
// these methods.
|
||||
// This interface is based on Android's VpnService.Builder.
|
||||
|
||||
// Callback to construct a new tun builder
|
||||
// Should be called first.
|
||||
override fun tun_builder_new(): Boolean {
|
||||
Log.d(TAG, "tun_builder_new")
|
||||
configBuilder.clearAddresses()
|
||||
return true
|
||||
}
|
||||
|
||||
// Callback to set MTU of the VPN interface
|
||||
// Never called more than once per tun_builder session.
|
||||
override fun tun_builder_set_mtu(mtu: Int): Boolean {
|
||||
Log.d(TAG, "tun_builder_set_mtu: $mtu")
|
||||
configBuilder.setMtu(mtu)
|
||||
return true
|
||||
}
|
||||
|
||||
// Callback to add network address to VPN interface
|
||||
// May be called more than once per tun_builder session
|
||||
override fun tun_builder_add_address(
|
||||
address: String, prefix_length: Int,
|
||||
gateway: String, ipv6: Boolean, net30: Boolean
|
||||
): Boolean {
|
||||
Log.d(TAG, "tun_builder_add_address: $address, $prefix_length, $gateway, $ipv6, $net30")
|
||||
configBuilder.addAddress(InetNetwork(address, prefix_length))
|
||||
return true
|
||||
}
|
||||
|
||||
// Callback to add route to VPN interface
|
||||
// May be called more than once per tun_builder session
|
||||
// metric is optional and should be ignored if < 0
|
||||
override fun tun_builder_add_route(address: String, prefix_length: Int, metric: Int, ipv6: Boolean): Boolean {
|
||||
Log.d(TAG, "tun_builder_add_route: $address, $prefix_length, $metric, $ipv6")
|
||||
if (address == "remote_host") return false
|
||||
configBuilder.addRoute(InetNetwork(address, prefix_length))
|
||||
return true
|
||||
}
|
||||
|
||||
// Callback to exclude route from VPN interface
|
||||
// May be called more than once per tun_builder session
|
||||
// metric is optional and should be ignored if < 0
|
||||
override fun tun_builder_exclude_route(address: String, prefix_length: Int, metric: Int, ipv6: Boolean): Boolean {
|
||||
Log.d(TAG, "tun_builder_exclude_route: $address, $prefix_length, $metric, $ipv6")
|
||||
configBuilder.excludeRoute(InetNetwork(address, prefix_length))
|
||||
return true
|
||||
}
|
||||
|
||||
// Callback to add DNS server to VPN interface
|
||||
// May be called more than once per tun_builder session
|
||||
// If reroute_dns is true, all DNS traffic should be routed over the
|
||||
// tunnel, while if false, only DNS traffic that matches an added search
|
||||
// domain should be routed.
|
||||
// Guaranteed to be called after tun_builder_reroute_gw.
|
||||
override fun tun_builder_add_dns_server(address: String, ipv6: Boolean): Boolean {
|
||||
Log.d(TAG, "tun_builder_add_dns_server: $address, $ipv6")
|
||||
configBuilder.addDnsServer(parseInetAddress(address))
|
||||
return true
|
||||
}
|
||||
|
||||
// Optional callback that indicates whether traffic of a certain
|
||||
// address family (AF_INET or AF_INET6) should be
|
||||
// blocked or allowed, to prevent unencrypted packet leakage when
|
||||
// the tunnel is IPv4-only/IPv6-only, but the local machine
|
||||
// has connectivity with the other protocol to the internet.
|
||||
// Controlled by "block-ipv6" and block-ipv6 config var.
|
||||
// If addresses are added for a family this setting should be
|
||||
// ignored for that family
|
||||
// See also Android's VPNService.Builder.allowFamily method
|
||||
/* override fun tun_builder_set_allow_family(af: Int, allow: Boolean): Boolean {
|
||||
Log.d(TAG, "tun_builder_set_allow_family: $af, $allow")
|
||||
return true
|
||||
} */
|
||||
|
||||
// Callback to set address of remote server
|
||||
// Never called more than once per tun_builder session.
|
||||
override fun tun_builder_set_remote_address(address: String, ipv6: Boolean): Boolean {
|
||||
Log.d(TAG, "tun_builder_set_remote_address: $address, $ipv6")
|
||||
return true
|
||||
}
|
||||
|
||||
// Optional callback that indicates OSI layer, should be 2 or 3.
|
||||
// Defaults to 3.
|
||||
override fun tun_builder_set_layer(layer: Int): Boolean {
|
||||
Log.d(TAG, "tun_builder_set_layer: $layer")
|
||||
return layer == 3
|
||||
}
|
||||
|
||||
// Callback to set the session name
|
||||
// Never called more than once per tun_builder session.
|
||||
override fun tun_builder_set_session_name(name: String): Boolean {
|
||||
Log.d(TAG, "tun_builder_set_session_name: $name")
|
||||
return true
|
||||
}
|
||||
|
||||
// Callback to establish the VPN tunnel, returning a file descriptor
|
||||
// to the tunnel, which the caller will henceforth own. Returns -1
|
||||
// if the tunnel could not be established.
|
||||
// Always called last after tun_builder session has been configured.
|
||||
override fun tun_builder_establish(): Int {
|
||||
Log.d(TAG, "tun_builder_establish")
|
||||
return establish(configBuilder)
|
||||
}
|
||||
|
||||
// Callback to reroute default gateway to VPN interface.
|
||||
// ipv4 is true if the default route to be added should be IPv4.
|
||||
// ipv6 is true if the default route to be added should be IPv6.
|
||||
// flags are defined in RGWFlags (rgwflags.hpp).
|
||||
// Never called more than once per tun_builder session.
|
||||
override fun tun_builder_reroute_gw(ipv4: Boolean, ipv6: Boolean, flags: Long): Boolean {
|
||||
Log.d(TAG, "tun_builder_reroute_gw: $ipv4, $ipv6, $flags")
|
||||
if ((flags and EMULATED_EXCLUDE_ROUTES.toLong()) != 0L) return true
|
||||
if (ipv4) {
|
||||
configBuilder.addRoute(InetNetwork("0.0.0.0", 0))
|
||||
}
|
||||
if (ipv6) {
|
||||
configBuilder.addRoute(InetNetwork("::", 0))
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Callback to add search domain to DNS resolver
|
||||
// May be called more than once per tun_builder session
|
||||
// See tun_builder_add_dns_server above for description of
|
||||
// reroute_dns parameter.
|
||||
// Guaranteed to be called after tun_builder_reroute_gw.
|
||||
override fun tun_builder_add_search_domain(domain: String): Boolean {
|
||||
Log.d(TAG, "tun_builder_add_search_domain: $domain")
|
||||
configBuilder.setSearchDomain(domain)
|
||||
return true
|
||||
}
|
||||
|
||||
// Callback to set the HTTP proxy
|
||||
// Never called more than once per tun_builder session.
|
||||
override fun tun_builder_set_proxy_http(host: String, port: Int): Boolean {
|
||||
Log.d(TAG, "tun_builder_set_proxy_http: $host, $port")
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
try {
|
||||
configBuilder.setHttpProxy(ProxyInfo.buildDirectProxy(host, port))
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Could not set proxy: ${e.message}")
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Callback to set the HTTPS proxy
|
||||
// Never called more than once per tun_builder session.
|
||||
override fun tun_builder_set_proxy_https(host: String, port: Int): Boolean {
|
||||
Log.d(TAG, "tun_builder_set_proxy_https: $host, $port")
|
||||
return false
|
||||
}
|
||||
|
||||
// When the exclude local network option is enabled this
|
||||
// function is called to get a list of local networks so routes
|
||||
// to exclude them from the VPN network are generated
|
||||
// This should be a list of CIDR networks (e.g. 192.168.0.0/24)
|
||||
override fun tun_builder_get_local_networks(ipv6: Boolean): ClientAPI_StringVec {
|
||||
Log.d(TAG, "tun_builder_get_local_networks: $ipv6")
|
||||
val networks = ClientAPI_StringVec()
|
||||
for (address in getLocalNetworks(ipv6)) {
|
||||
networks.add(address.toString())
|
||||
}
|
||||
return networks
|
||||
}
|
||||
|
||||
// Optional callback to set default value for route metric.
|
||||
// Guaranteed to be called before other methods that deal
|
||||
// with routes such as tun_builder_add_route and
|
||||
// tun_builder_reroute_gw. Route metric is ignored
|
||||
// if < 0.
|
||||
/* override fun tun_builder_set_route_metric_default(metric: Int): Boolean {
|
||||
Log.d(TAG, "tun_builder_set_route_metric_default: $metric")
|
||||
return super.tun_builder_set_route_metric_default(metric)
|
||||
} */
|
||||
|
||||
// Callback to add a host which should bypass the proxy
|
||||
// May be called more than once per tun_builder session
|
||||
/* override fun tun_builder_add_proxy_bypass(bypass_host: String): Boolean {
|
||||
Log.d(TAG, "tun_builder_add_proxy_bypass: $bypass_host")
|
||||
return super.tun_builder_add_proxy_bypass(bypass_host)
|
||||
} */
|
||||
|
||||
// Callback to set the proxy "Auto Config URL"
|
||||
// Never called more than once per tun_builder session.
|
||||
/* override fun tun_builder_set_proxy_auto_config_url(url: String): Boolean {
|
||||
Log.d(TAG, "tun_builder_set_proxy_auto_config_url: $url")
|
||||
return super.tun_builder_set_proxy_auto_config_url(url)
|
||||
} */
|
||||
|
||||
// Callback to add Windows WINS server to VPN interface.
|
||||
// WINS server addresses are always IPv4.
|
||||
// May be called more than once per tun_builder session.
|
||||
// Guaranteed to be called after tun_builder_reroute_gw.
|
||||
/* override fun tun_builder_add_wins_server(address: String): Boolean {
|
||||
Log.d(TAG, "tun_builder_add_wins_server: $address")
|
||||
return super.tun_builder_add_wins_server(address)
|
||||
} */
|
||||
|
||||
// Optional callback to set a DNS suffix on tun/tap adapter.
|
||||
// Currently only implemented on Windows, where it will
|
||||
// set the "Connection-specific DNS Suffix" property on
|
||||
// the TAP driver.
|
||||
/* override fun tun_builder_set_adapter_domain_suffix(name: String): Boolean {
|
||||
Log.d(TAG, "tun_builder_set_adapter_domain_suffix: $name")
|
||||
return super.tun_builder_set_adapter_domain_suffix(name)
|
||||
} */
|
||||
|
||||
// Return true if tun interface may be persisted, i.e. rolled
|
||||
// into a new session with properties untouched. This method
|
||||
// is only called after all other tests of persistence
|
||||
// allowability succeed, therefore it can veto persistence.
|
||||
// If persistence is ultimately enabled,
|
||||
// tun_builder_establish_lite() will be called. Otherwise,
|
||||
// tun_builder_establish() will be called.
|
||||
/* override fun tun_builder_persist(): Boolean {
|
||||
Log.d(TAG, "tun_builder_persist")
|
||||
return super.tun_builder_persist()
|
||||
} */
|
||||
|
||||
// Indicates a reconnection with persisted tun state.
|
||||
/* override fun tun_builder_establish_lite() {
|
||||
Log.d(TAG, "tun_builder_establish_lite")
|
||||
super.tun_builder_establish_lite()
|
||||
} */
|
||||
|
||||
// Indicates that tunnel is being torn down.
|
||||
// If disconnect == true, then the teardown is occurring
|
||||
// prior to final disconnect.
|
||||
/* override fun tun_builder_teardown(disconnect: Boolean) {
|
||||
Log.d(TAG, "tun_builder_teardown: $disconnect")
|
||||
super.tun_builder_teardown(disconnect)
|
||||
} */
|
||||
|
||||
/**************************************************************************
|
||||
* Connection control methods
|
||||
**************************************************************************/
|
||||
|
||||
// Parse OpenVPN configuration file.
|
||||
override fun eval_config(arg0: ClientAPI_Config): ClientAPI_EvalConfig {
|
||||
Log.d(TAG, "eval_config")
|
||||
return super.eval_config(arg0)
|
||||
}
|
||||
|
||||
// Primary VPN client connect method, doesn't return until disconnect.
|
||||
// Should be called by a worker thread. This method will make callbacks
|
||||
// to event() and log() functions. Make sure to call eval_config()
|
||||
// and possibly provide_creds() as well before this function.
|
||||
override fun connect(): ClientAPI_Status {
|
||||
Log.d(TAG, "connect")
|
||||
return super.connect()
|
||||
}
|
||||
|
||||
// Callback to "protect" a socket from being routed through the tunnel.
|
||||
// Will be called from the thread executing connect().
|
||||
// The remote and ipv6 are the remote host this socket will connect to
|
||||
override fun socket_protect(socket: Int, remote: String, ipv6: Boolean): Boolean {
|
||||
Log.d(TAG, "socket_protect: $socket, $remote, $ipv6")
|
||||
return protect(socket)
|
||||
}
|
||||
|
||||
// Stop the client. Only meaningful when connect() is running.
|
||||
// May be called asynchronously from a different thread
|
||||
// when connect() is running.
|
||||
override fun stop() {
|
||||
Log.d(TAG, "stop")
|
||||
super.stop()
|
||||
}
|
||||
|
||||
// Pause the client -- useful to avoid continuous reconnection attempts
|
||||
// when network is down. May be called from a different thread
|
||||
// when connect() is running.
|
||||
override fun pause(reason: String) {
|
||||
Log.d(TAG, "pause: $reason")
|
||||
super.pause(reason)
|
||||
}
|
||||
|
||||
// Resume the client after it has been paused. May be called from a
|
||||
// different thread when connect() is running.
|
||||
override fun resume() {
|
||||
Log.d(TAG, "resume")
|
||||
super.resume()
|
||||
}
|
||||
|
||||
// Do a disconnect/reconnect cycle n seconds from now. May be called
|
||||
// from a different thread when connect() is running.
|
||||
override fun reconnect(seconds: Int) {
|
||||
Log.d(TAG, "reconnect: $seconds")
|
||||
super.reconnect(seconds)
|
||||
}
|
||||
|
||||
// When a connection is close to timeout, the core will call this
|
||||
// method. If it returns false, the core will disconnect with a
|
||||
// CONNECTION_TIMEOUT event. If true, the core will enter a PAUSE
|
||||
// state.
|
||||
override fun pause_on_connection_timeout(): Boolean {
|
||||
Log.d(TAG, "pause_on_connection_timeout")
|
||||
return false
|
||||
}
|
||||
|
||||
// Return information about the most recent connection. Should be called
|
||||
// after an event of type "CONNECTED".
|
||||
/* override fun connection_info(): ClientAPI_ConnectionInfo {
|
||||
Log.d(TAG, "connection_info")
|
||||
return super.connection_info()
|
||||
} */
|
||||
|
||||
/**************************************************************************
|
||||
* Status callbacks
|
||||
**************************************************************************/
|
||||
|
||||
// Callback for delivering events during connect() call.
|
||||
// Will be called from the thread executing connect().
|
||||
override fun event(event: ClientAPI_Event) {
|
||||
val name = event.name
|
||||
val info = event.info
|
||||
Log.d(TAG, "OpenVpn event: $name: $info")
|
||||
when (name) {
|
||||
"COMPRESSION_ENABLED", "WARN" -> Log.w(TAG, "$name: $info")
|
||||
"CONNECTED" -> state.value = CONNECTED
|
||||
"DISCONNECTED" -> state.value = DISCONNECTED
|
||||
"RECONNECTING" -> {
|
||||
state.getAndUpdate { state ->
|
||||
if (state == DISCONNECTED || state == CONNECTED) RECONNECTING
|
||||
else state
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event.error || event.fatal) {
|
||||
state.value = DISCONNECTED
|
||||
onError("OpenVpn ${if (event.error) "ERROR" else "FATAL"}: $name: $info")
|
||||
}
|
||||
}
|
||||
|
||||
// Callback for logging.
|
||||
// Will be called from the thread executing connect().
|
||||
override fun log(arg0: ClientAPI_LogInfo) {
|
||||
arg0.text.dropLastWhile { it == '\n' }.let {
|
||||
Log.d(TAG, "OpenVpnLog: $it")
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* Stats methods
|
||||
**************************************************************************/
|
||||
|
||||
// return transport stats only
|
||||
override fun transport_stats(): ClientAPI_TransportStats {
|
||||
Log.d(TAG, "transport_stats")
|
||||
return super.transport_stats()
|
||||
}
|
||||
|
||||
// return a stats value, index should be >= 0 and < stats_n()
|
||||
/* override fun stats_value(index: Int): Long {
|
||||
Log.d(TAG, "stats_value: $index")
|
||||
return super.stats_value(index)
|
||||
} */
|
||||
|
||||
// return all stats in a bundle
|
||||
/* override fun stats_bundle(): ClientAPI_LLVector {
|
||||
Log.d(TAG, "stats_bundle")
|
||||
return super.stats_bundle()
|
||||
} */
|
||||
|
||||
// return tun stats only
|
||||
/* override fun tun_stats(): ClientAPI_InterfaceStats {
|
||||
Log.d(TAG, "tun_stats")
|
||||
return super.tun_stats()
|
||||
} */
|
||||
|
||||
// post control channel message
|
||||
/* override fun post_cc_msg(msg: String) {
|
||||
Log.d(TAG, "post_cc_msg: $msg")
|
||||
super.post_cc_msg(msg)
|
||||
} */
|
||||
}
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
package org.amnezia.vpn.protocol.openvpn
|
||||
|
||||
import org.amnezia.vpn.protocol.ProtocolConfig
|
||||
|
||||
private const val OPENVPN_DEFAULT_MTU = 1500
|
||||
|
||||
class OpenVpnConfig private constructor(
|
||||
protocolConfigBuilder: ProtocolConfig.Builder
|
||||
) : ProtocolConfig(protocolConfigBuilder) {
|
||||
|
||||
class Builder : ProtocolConfig.Builder(false) {
|
||||
override var mtu: Int = OPENVPN_DEFAULT_MTU
|
||||
|
||||
override fun build(): OpenVpnConfig = configBuild().run { OpenVpnConfig(this@Builder) }
|
||||
}
|
||||
|
||||
companion object {
|
||||
inline fun build(block: Builder.() -> Unit): OpenVpnConfig = Builder().apply(block).build()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.amnezia.vpn
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
|
||||
class BillingPaymentRepository(@Suppress("UNUSED_PARAMETER") context: Context) : BillingRepository {
|
||||
override suspend fun getCountryCode(): String = ""
|
||||
override suspend fun getSubscriptionPlans(): String = ""
|
||||
override suspend fun purchaseSubscription(activity: Activity, offerToken: String): String = ""
|
||||
override suspend fun upgradeSubscription(activity: Activity, offerToken: String, oldPurchaseToken: String): String = ""
|
||||
override suspend fun acknowledge(purchaseToken: String): String = ""
|
||||
override suspend fun queryPurchases(): String = ""
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.amnezia.vpn
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import BillingProvider.Companion.withBillingProvider
|
||||
|
||||
class BillingPaymentRepository(private val context: Context) : BillingRepository {
|
||||
|
||||
override suspend fun getCountryCode(): String = withBillingProvider(context) {
|
||||
getCustomerCountryCode()
|
||||
}
|
||||
|
||||
override suspend fun getSubscriptionPlans(): String = withBillingProvider(context) {
|
||||
getSubscriptionPlans()
|
||||
}
|
||||
|
||||
override suspend fun purchaseSubscription(activity: Activity, offerToken: String): String =
|
||||
withBillingProvider(context) {
|
||||
purchaseSubscription(activity, offerToken)
|
||||
}
|
||||
|
||||
override suspend fun upgradeSubscription(activity: Activity, offerToken: String, oldPurchaseToken: String): String =
|
||||
withBillingProvider(context) {
|
||||
purchaseSubscription(activity, offerToken, oldPurchaseToken)
|
||||
}
|
||||
|
||||
override suspend fun acknowledge(purchaseToken: String): String = withBillingProvider(context) {
|
||||
acknowledge(purchaseToken)
|
||||
}
|
||||
|
||||
override suspend fun queryPurchases(): String = withBillingProvider(context) {
|
||||
getPurchases()
|
||||
}
|
||||
}
|
||||
@@ -5,4 +5,3 @@ sealed class ProtocolException(message: String? = null, cause: Throwable? = null
|
||||
class BadConfigException(message: String? = null, cause: Throwable? = null) : ProtocolException(message, cause)
|
||||
|
||||
class VpnStartException(message: String? = null, cause: Throwable? = null) : ProtocolException(message, cause)
|
||||
class VpnException(message: String? = null, cause: Throwable? = null) : ProtocolException(message, cause)
|
||||
@@ -5,7 +5,6 @@ import android.net.IpPrefix
|
||||
import android.net.VpnService
|
||||
import android.net.VpnService.Builder
|
||||
import android.os.Build
|
||||
import android.system.OsConstants
|
||||
import androidx.annotation.RequiresApi
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import org.amnezia.vpn.util.Log
|
||||
@@ -22,7 +21,6 @@ private const val SPLIT_TUNNEL_EXCLUDE = 2
|
||||
|
||||
abstract class Protocol {
|
||||
|
||||
abstract val statistics: Statistics
|
||||
protected lateinit var context: Context
|
||||
protected lateinit var state: MutableStateFlow<ProtocolState>
|
||||
protected lateinit var onError: (String) -> Unit
|
||||
@@ -40,32 +38,11 @@ abstract class Protocol {
|
||||
|
||||
abstract suspend fun startVpn(config: JSONObject, vpnBuilder: Builder, protect: (Int) -> Boolean)
|
||||
|
||||
abstract fun switchProxy(config: JSONObject, vpnBuilder: Builder, protect: (Int) -> Boolean)
|
||||
|
||||
abstract fun stopVpn()
|
||||
|
||||
abstract fun reconnectVpn(vpnBuilder: Builder)
|
||||
|
||||
protected fun ProtocolConfig.Builder.configSplitTunneling(config: JSONObject) {
|
||||
if (!allowSplitTunneling) {
|
||||
Log.i(TAG, "Global address split tunneling is prohibited, " +
|
||||
"only tunneling from the protocol config is used")
|
||||
return
|
||||
}
|
||||
|
||||
val splitTunnelType = config.optInt("splitTunnelType")
|
||||
if (splitTunnelType == SPLIT_TUNNEL_DISABLE) return
|
||||
val splitTunnelSites = config.getJSONArray("splitTunnelSites")
|
||||
val addressHandlerFunc = when (splitTunnelType) {
|
||||
SPLIT_TUNNEL_INCLUDE -> ::includeAddress
|
||||
SPLIT_TUNNEL_EXCLUDE -> ::excludeAddress
|
||||
|
||||
else -> throw BadConfigException("Unexpected value of the 'splitTunnelType' parameter: $splitTunnelType")
|
||||
}
|
||||
|
||||
for (i in 0 until splitTunnelSites.length()) {
|
||||
val address = InetNetwork.parse(splitTunnelSites.getString(i))
|
||||
addressHandlerFunc(address)
|
||||
}
|
||||
}
|
||||
abstract fun reconnectVpn(vpnBuilder: Builder, protect: (Int) -> Boolean)
|
||||
|
||||
protected fun ProtocolConfig.Builder.configAppSplitTunneling(config: JSONObject) {
|
||||
val splitTunnelType = config.optInt("appSplitTunnelType")
|
||||
@@ -103,11 +80,6 @@ abstract class Protocol {
|
||||
}
|
||||
}
|
||||
|
||||
config.searchDomain?.let {
|
||||
Log.d(TAG, "addSearchDomain: $it")
|
||||
vpnBuilder.addSearchDomain(it)
|
||||
}
|
||||
|
||||
for ((inetNetwork, include) in config.routes) {
|
||||
if (include) {
|
||||
Log.d(TAG, "addRoute: $inetNetwork")
|
||||
@@ -135,19 +107,6 @@ abstract class Protocol {
|
||||
Log.d(TAG, "setMtu: ${config.mtu}")
|
||||
vpnBuilder.setMtu(config.mtu)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
config.httpProxy?.let {
|
||||
Log.d(TAG, "setHttpProxy: $it")
|
||||
vpnBuilder.setHttpProxy(it)
|
||||
}
|
||||
}
|
||||
|
||||
if (config.allowAllAF) {
|
||||
Log.d(TAG, "allowFamily")
|
||||
vpnBuilder.allowFamily(OsConstants.AF_INET)
|
||||
vpnBuilder.allowFamily(OsConstants.AF_INET6)
|
||||
}
|
||||
|
||||
Log.d(TAG, "setBlocking: ${config.blockingMode}")
|
||||
vpnBuilder.setBlocking(config.blockingMode)
|
||||
vpnBuilder.setUnderlyingNetworks(null)
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package org.amnezia.vpn.protocol
|
||||
|
||||
import android.net.ProxyInfo
|
||||
import android.os.Build
|
||||
import androidx.annotation.RequiresApi
|
||||
import java.net.InetAddress
|
||||
import org.amnezia.vpn.util.net.InetNetwork
|
||||
import org.amnezia.vpn.util.net.IpRange
|
||||
@@ -11,14 +9,9 @@ import org.amnezia.vpn.util.net.IpRangeSet
|
||||
open class ProtocolConfig protected constructor(
|
||||
val addresses: Set<InetNetwork>,
|
||||
val dnsServers: Set<InetAddress>,
|
||||
val searchDomain: String?,
|
||||
val routes: Set<Route>,
|
||||
val includedAddresses: Set<InetNetwork>,
|
||||
val excludedAddresses: Set<InetNetwork>,
|
||||
val includedApplications: Set<String>,
|
||||
val excludedApplications: Set<String>,
|
||||
val httpProxy: ProxyInfo?,
|
||||
val allowAllAF: Boolean,
|
||||
val blockingMode: Boolean,
|
||||
val mtu: Int
|
||||
) {
|
||||
@@ -26,14 +19,9 @@ open class ProtocolConfig protected constructor(
|
||||
protected constructor(builder: Builder) : this(
|
||||
builder.addresses,
|
||||
builder.dnsServers,
|
||||
builder.searchDomain,
|
||||
builder.routes,
|
||||
builder.includedAddresses,
|
||||
builder.excludedAddresses,
|
||||
builder.includedApplications,
|
||||
builder.excludedApplications,
|
||||
builder.httpProxy,
|
||||
builder.allowAllAF,
|
||||
builder.blockingMode,
|
||||
builder.mtu
|
||||
)
|
||||
@@ -42,26 +30,12 @@ open class ProtocolConfig protected constructor(
|
||||
internal val addresses: MutableSet<InetNetwork> = hashSetOf()
|
||||
internal val dnsServers: MutableSet<InetAddress> = hashSetOf()
|
||||
internal val routes: MutableSet<Route> = mutableSetOf()
|
||||
internal val includedAddresses: MutableSet<InetNetwork> = hashSetOf()
|
||||
internal val excludedAddresses: MutableSet<InetNetwork> = hashSetOf()
|
||||
internal val includedApplications: MutableSet<String> = hashSetOf()
|
||||
internal val excludedApplications: MutableSet<String> = hashSetOf()
|
||||
|
||||
internal var searchDomain: String? = null
|
||||
private set
|
||||
|
||||
internal var httpProxy: ProxyInfo? = null
|
||||
private set
|
||||
|
||||
internal var allowAllAF: Boolean = false
|
||||
private set
|
||||
|
||||
internal var blockingMode: Boolean = blockingMode
|
||||
private set
|
||||
|
||||
internal var allowSplitTunneling: Boolean = true
|
||||
private set
|
||||
|
||||
open var mtu: Int = 0
|
||||
protected set
|
||||
|
||||
@@ -72,15 +46,12 @@ open class ProtocolConfig protected constructor(
|
||||
fun addDnsServer(dnsServer: InetAddress) = apply { this.dnsServers += dnsServer }
|
||||
fun addDnsServers(dnsServers: Collection<InetAddress>) = apply { this.dnsServers += dnsServers }
|
||||
|
||||
fun setSearchDomain(domain: String) = apply { this.searchDomain = domain }
|
||||
|
||||
fun addRoute(route: InetNetwork) = apply { this.routes += Route(route, true) }
|
||||
fun addRoutes(routes: Collection<InetNetwork>) = apply { this.routes += routes.map { Route(it, true) } }
|
||||
|
||||
fun excludeRoute(route: InetNetwork) = apply { this.routes += Route(route, false) }
|
||||
fun excludeRoutes(routes: Collection<InetNetwork>) = apply { this.routes += routes.map { Route(it, false) } }
|
||||
|
||||
fun removeRoute(route: InetNetwork) = apply { this.routes.removeIf { it.inetNetwork == route } }
|
||||
fun clearRoutes() = apply { this.routes.clear() }
|
||||
|
||||
fun prependRoutes(block: Builder.() -> Unit) = apply {
|
||||
@@ -90,51 +61,16 @@ open class ProtocolConfig protected constructor(
|
||||
routes.addAll(savedRoutes)
|
||||
}
|
||||
|
||||
fun includeAddress(addr: InetNetwork) = apply { this.includedAddresses += addr }
|
||||
fun includeAddresses(addresses: Collection<InetNetwork>) = apply { this.includedAddresses += addresses }
|
||||
|
||||
fun excludeAddress(addr: InetNetwork) = apply { this.excludedAddresses += addr }
|
||||
fun excludeAddresses(addresses: Collection<InetNetwork>) = apply { this.excludedAddresses += addresses }
|
||||
|
||||
fun includeApplication(application: String) = apply { this.includedApplications += application }
|
||||
fun includeApplications(applications: Collection<String>) = apply { this.includedApplications += applications }
|
||||
|
||||
fun excludeApplication(application: String) = apply { this.excludedApplications += application }
|
||||
fun excludeApplications(applications: Collection<String>) = apply { this.excludedApplications += applications }
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.Q)
|
||||
fun setHttpProxy(httpProxy: ProxyInfo) = apply { this.httpProxy = httpProxy }
|
||||
|
||||
fun setAllowAllAF(allowAllAF: Boolean) = apply { this.allowAllAF = allowAllAF }
|
||||
|
||||
fun setBlockingMode(blockingMode: Boolean) = apply { this.blockingMode = blockingMode }
|
||||
|
||||
fun disableSplitTunneling() = apply { this.allowSplitTunneling = false }
|
||||
|
||||
fun setMtu(mtu: Int) = apply { this.mtu = mtu }
|
||||
|
||||
private fun processSplitTunneling() {
|
||||
if (includedAddresses.isNotEmpty() && excludedAddresses.isNotEmpty()) {
|
||||
throw BadConfigException("Config contains addresses for inclusive and exclusive split tunneling at the same time")
|
||||
}
|
||||
|
||||
if (includedAddresses.isNotEmpty()) {
|
||||
// remove default routes, if any
|
||||
removeRoute(InetNetwork("0.0.0.0", 0))
|
||||
removeRoute(InetNetwork("::", 0))
|
||||
removeRoute(InetNetwork("2000::", 3))
|
||||
prependRoutes {
|
||||
addRoutes(includedAddresses)
|
||||
}
|
||||
} else if (excludedAddresses.isNotEmpty()) {
|
||||
prependRoutes {
|
||||
addRoute(InetNetwork("0.0.0.0", 0))
|
||||
addRoute(InetNetwork("2000::", 3))
|
||||
excludeRoutes(excludedAddresses)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun processRoutes() {
|
||||
// replace ::/0 as it may cause LAN connection issues
|
||||
val ipv6DefaultRoute = InetNetwork("::", 0)
|
||||
@@ -178,7 +114,6 @@ open class ProtocolConfig protected constructor(
|
||||
}
|
||||
|
||||
protected fun configBuild() {
|
||||
processSplitTunneling()
|
||||
processRoutes()
|
||||
validate()
|
||||
}
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
package org.amnezia.vpn.protocol
|
||||
|
||||
import android.os.Bundle
|
||||
|
||||
private const val RX_BYTES_KEY = "rxBytes"
|
||||
private const val TX_BYTES_KEY = "txBytes"
|
||||
|
||||
@Suppress("DataClassPrivateConstructor")
|
||||
data class Statistics private constructor(
|
||||
val rxBytes: Long = 0L,
|
||||
val txBytes: Long = 0L
|
||||
) {
|
||||
|
||||
private constructor(builder: Builder) : this(builder.rxBytes, builder.txBytes)
|
||||
|
||||
@Suppress("SuspiciousEqualsCombination")
|
||||
fun isEmpty(): Boolean = this === EMPTY_STATISTICS || this == EMPTY_STATISTICS
|
||||
|
||||
class Builder {
|
||||
var rxBytes: Long = 0L
|
||||
private set
|
||||
|
||||
var txBytes: Long = 0L
|
||||
private set
|
||||
|
||||
fun setRxBytes(rxBytes: Long) = apply { this.rxBytes = rxBytes }
|
||||
fun setTxBytes(txBytes: Long) = apply { this.txBytes = txBytes }
|
||||
|
||||
fun build(): Statistics =
|
||||
if (rxBytes + txBytes == 0L) EMPTY_STATISTICS
|
||||
else Statistics(this)
|
||||
}
|
||||
|
||||
companion object {
|
||||
val EMPTY_STATISTICS: Statistics = Statistics()
|
||||
|
||||
inline fun build(block: Builder.() -> Unit): Statistics = Builder().apply(block).build()
|
||||
}
|
||||
}
|
||||
|
||||
fun Bundle.putStatistics(statistics: Statistics) {
|
||||
putLong(RX_BYTES_KEY, statistics.rxBytes)
|
||||
putLong(TX_BYTES_KEY, statistics.txBytes)
|
||||
}
|
||||
|
||||
fun Bundle.getStatistics(): Statistics =
|
||||
Statistics.build {
|
||||
setRxBytes(getLong(RX_BYTES_KEY))
|
||||
setTxBytes(getLong(TX_BYTES_KEY))
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:type="linear"
|
||||
android:angle="135"
|
||||
android:startColor="#2A2A2E"
|
||||
android:centerColor="#17171A"
|
||||
android:endColor="#0E0E11" />
|
||||
</shape>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<inset xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:drawable="@drawable/ic_amnezia_round"
|
||||
android:insetLeft="19.5%"
|
||||
android:insetTop="19.5%"
|
||||
android:insetRight="19.5%"
|
||||
android:insetBottom="19.5%" />
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_monochrome" />
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_monochrome" />
|
||||
</adaptive-icon>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="NoActionBar">
|
||||
<item name="android:windowBackground">@color/black</item>
|
||||
<item name="android:colorBackground">@color/black</item>
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
||||
<item name="android:enforceNavigationBarContrast">false</item>
|
||||
<item name="android:enforceStatusBarContrast">false</item>
|
||||
|
||||
<item name="android:windowSplashScreenBackground">@color/ic_launcher_background</item>
|
||||
<item name="android:windowSplashScreenIconBackgroundColor">@color/ic_launcher_background</item>
|
||||
<item name="android:windowSplashScreenAnimatedIcon">@mipmap/icon</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#0E0E11</color>
|
||||
</resources>
|
||||
@@ -1,11 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="black">#FF0E0E11</color>
|
||||
<color name="black">#FF101012</color>
|
||||
<style name="NoActionBar">
|
||||
<item name="android:windowBackground">@color/black</item>
|
||||
<item name="android:colorBackground">@color/black</item>
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
||||
<item name="android:enforceNavigationBarContrast">false</item>
|
||||
<item name="android:enforceStatusBarContrast">false</item>
|
||||
</style>
|
||||
<style name="Translucent" parent="NoActionBar">
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
|
||||
@@ -16,6 +16,7 @@ dependencyResolutionManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven("https://maven.amnezia.org/releases")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,18 +27,13 @@ plugins {
|
||||
id("settings-property-delegate")
|
||||
}
|
||||
|
||||
rootProject.name = "AmneziaVPN"
|
||||
rootProject.buildFileName = "build.gradle.kts"
|
||||
|
||||
include(":qt")
|
||||
include(":utils")
|
||||
include(":billing")
|
||||
include(":protocolApi")
|
||||
include(":wireguard")
|
||||
include(":awg")
|
||||
include(":openvpn")
|
||||
include(":cloak")
|
||||
include(":xray")
|
||||
include(":xray:libXray")
|
||||
include(":xtun")
|
||||
|
||||
// get values from gradle or local properties
|
||||
val androidBuildToolsVersion: String by gradleProperties
|
||||
@@ -48,15 +44,7 @@ val qtMinSdkVersion: String by gradleProperties
|
||||
// set default values for all modules
|
||||
configure<SettingsExtension> {
|
||||
buildToolsVersion = androidBuildToolsVersion
|
||||
compileSdk = androidCompileSdkVersion.substringAfter('-').toInt()
|
||||
compileSdk = androidCompileSdkVersion.split('-')[1].toInt()
|
||||
minSdk = qtMinSdkVersion.toInt()
|
||||
ndkVersion = androidNdkVersion
|
||||
}
|
||||
|
||||
// stop Gradle running by androiddeployqt
|
||||
gradle.taskGraph.whenReady {
|
||||
if (providers.environmentVariable("ANDROIDDEPLOYQT_RUN").isPresent
|
||||
&& !providers.systemProperty("explicitRun").isPresent) {
|
||||
allTasks.forEach { it.enabled = false }
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,8 @@ import android.os.ParcelFileDescriptor
|
||||
import android.os.SystemClock
|
||||
import android.provider.OpenableColumns
|
||||
import android.provider.Settings
|
||||
import android.view.InputDevice
|
||||
import android.view.KeyEvent
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@@ -35,7 +37,15 @@ import android.widget.Toast
|
||||
import androidx.annotation.MainThread
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.core.graphics.Insets
|
||||
import androidx.core.view.OnApplyWindowInsetsListener
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.WindowInsetsControllerCompat
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.io.OutputStream
|
||||
import kotlin.LazyThreadSafetyMode.NONE
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
import kotlin.text.RegexOption.IGNORE_CASE
|
||||
@@ -48,11 +58,8 @@ import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.cancel
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.amnezia.vpn.protocol.getStatistics
|
||||
import org.amnezia.vpn.protocol.getStatus
|
||||
import org.amnezia.vpn.qt.QtAndroidController
|
||||
import org.amnezia.vpn.util.LibraryLoader.loadSharedLibrary
|
||||
import org.amnezia.vpn.util.Log
|
||||
import org.amnezia.vpn.util.Prefs
|
||||
import org.json.JSONException
|
||||
@@ -68,6 +75,9 @@ private const val OPEN_FILE_ACTION_CODE = 3
|
||||
private const val CHECK_NOTIFICATION_PERMISSION_ACTION_CODE = 4
|
||||
|
||||
private const val PREFS_NOTIFICATION_PERMISSION_ASKED = "NOTIFICATION_PERMISSION_ASKED"
|
||||
private const val OPEN_FILE_AFTER_RESUME_DELAY_MS = 400L
|
||||
private const val KEY_PENDING_OPEN_FILE_URI = "pending_open_file_uri"
|
||||
private const val FILE_PROVIDER_AUTHORITY = "org.amnezia.vpn.qtprovider"
|
||||
|
||||
class AmneziaActivity : QtActivity() {
|
||||
|
||||
@@ -80,10 +90,18 @@ class AmneziaActivity : QtActivity() {
|
||||
private var notificationStateReceiver: BroadcastReceiver? = null
|
||||
private lateinit var vpnServiceMessenger: IpcMessenger
|
||||
private var pfd: ParcelFileDescriptor? = null
|
||||
private lateinit var billingRepository: BillingRepository
|
||||
|
||||
private val actionResultHandlers = mutableMapOf<Int, ActivityResultHandler>()
|
||||
private val permissionRequestHandlers = mutableMapOf<Int, PermissionRequestHandler>()
|
||||
|
||||
private var isActivityResumed = false
|
||||
private var hasWindowFocus = false
|
||||
private val resumeHandler = Handler(Looper.getMainLooper())
|
||||
private var pendingOpenFileUri: String? = null
|
||||
private var openFileDeliveryScheduled = false
|
||||
|
||||
|
||||
private val vpnServiceEventHandler: Handler by lazy(NONE) {
|
||||
object : Handler(Looper.getMainLooper()) {
|
||||
override fun handleMessage(msg: Message) {
|
||||
@@ -104,12 +122,6 @@ class AmneziaActivity : QtActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
ServiceEvent.STATISTICS_UPDATE -> {
|
||||
msg.data?.getStatistics()?.let { (rxBytes, txBytes) ->
|
||||
QtAndroidController.onStatisticsUpdate(rxBytes, txBytes)
|
||||
}
|
||||
}
|
||||
|
||||
ServiceEvent.ERROR -> {
|
||||
msg.data?.getString(MSG_ERROR)?.let { error ->
|
||||
Log.e(TAG, "From VpnService: $error")
|
||||
@@ -169,11 +181,9 @@ class AmneziaActivity : QtActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
Log.d(TAG, "Create Amnezia activity")
|
||||
loadLibs()
|
||||
window.apply {
|
||||
addFlags(LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
|
||||
statusBarColor = getColor(R.color.black)
|
||||
}
|
||||
|
||||
// Configure window for edge-to-edge display
|
||||
configureWindowForEdgeToEdge()
|
||||
mainScope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
|
||||
val proto = mainScope.async(Dispatchers.IO) {
|
||||
VpnStateStore.getVpnState().vpnProto
|
||||
@@ -186,20 +196,17 @@ class AmneziaActivity : QtActivity() {
|
||||
doBindService()
|
||||
}
|
||||
)
|
||||
pendingOpenFileUri = savedInstanceState?.getString(KEY_PENDING_OPEN_FILE_URI)
|
||||
openFileDeliveryScheduled = false
|
||||
registerBroadcastReceivers()
|
||||
intent?.let(::processIntent)
|
||||
runBlocking { vpnProto = proto.await() }
|
||||
billingRepository = BillingPaymentRepository(applicationContext)
|
||||
}
|
||||
|
||||
private fun loadLibs() {
|
||||
listOf(
|
||||
"rsapss",
|
||||
"crypto_3",
|
||||
"ssl_3",
|
||||
"ssh"
|
||||
).forEach {
|
||||
loadSharedLibrary(this.applicationContext, it)
|
||||
}
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(outState)
|
||||
pendingOpenFileUri?.let { outState.putString(KEY_PENDING_OPEN_FILE_URI, it) }
|
||||
}
|
||||
|
||||
private fun registerBroadcastReceivers() {
|
||||
@@ -256,6 +263,11 @@ class AmneziaActivity : QtActivity() {
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
isActivityResumed = false
|
||||
hasWindowFocus = false
|
||||
// Cancel all pending operations when activity stops
|
||||
resumeHandler.removeCallbacksAndMessages(null)
|
||||
openFileDeliveryScheduled = false
|
||||
Log.d(TAG, "Stop Amnezia activity")
|
||||
doUnbindService()
|
||||
mainScope.launch {
|
||||
@@ -265,7 +277,197 @@ class AmneziaActivity : QtActivity() {
|
||||
super.onStop()
|
||||
}
|
||||
|
||||
override fun onWindowFocusChanged(hasFocus: Boolean) {
|
||||
super.onWindowFocusChanged(hasFocus)
|
||||
hasWindowFocus = hasFocus
|
||||
Log.d(TAG, "Window focus changed: hasFocus=$hasFocus")
|
||||
|
||||
if (!hasFocus) {
|
||||
// Cancel pending operations if window loses focus
|
||||
resumeHandler.removeCallbacksAndMessages(null)
|
||||
} else if (isActivityResumed && Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
||||
window.decorView.apply {
|
||||
invalidate()
|
||||
resumeHandler.postDelayed({
|
||||
if (isActivityResumed && hasWindowFocus && !isFinishing && !isDestroyed) {
|
||||
sendTouch(1f, 1f)
|
||||
}
|
||||
}, 50)
|
||||
resumeHandler.postDelayed({
|
||||
if (isActivityResumed && hasWindowFocus && !isFinishing && !isDestroyed) {
|
||||
sendTouch(2f, 2f)
|
||||
requestLayout()
|
||||
invalidate()
|
||||
}
|
||||
}, 150)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun dispatchKeyEvent(event: KeyEvent): Boolean {
|
||||
val keyCode = event.keyCode
|
||||
val pressed = event.action == KeyEvent.ACTION_DOWN
|
||||
|
||||
when (keyCode) {
|
||||
KeyEvent.KEYCODE_BUTTON_A,
|
||||
KeyEvent.KEYCODE_BUTTON_B,
|
||||
KeyEvent.KEYCODE_BUTTON_X,
|
||||
KeyEvent.KEYCODE_BUTTON_Y,
|
||||
KeyEvent.KEYCODE_BUTTON_START,
|
||||
KeyEvent.KEYCODE_BUTTON_SELECT -> {
|
||||
nativeGamepadKeyEvent(0, keyCode, pressed)
|
||||
return true
|
||||
}
|
||||
KeyEvent.KEYCODE_DPAD_CENTER,
|
||||
KeyEvent.KEYCODE_DPAD_UP,
|
||||
KeyEvent.KEYCODE_DPAD_DOWN,
|
||||
KeyEvent.KEYCODE_DPAD_LEFT,
|
||||
KeyEvent.KEYCODE_DPAD_RIGHT -> {
|
||||
val syntheticKeyCode = if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) KeyEvent.KEYCODE_ENTER else keyCode
|
||||
val synthetic = KeyEvent(
|
||||
event.downTime, event.eventTime, event.action, syntheticKeyCode,
|
||||
event.repeatCount, event.metaState, -1, event.scanCode,
|
||||
event.flags, InputDevice.SOURCE_KEYBOARD
|
||||
)
|
||||
return super.dispatchKeyEvent(synthetic)
|
||||
}
|
||||
}
|
||||
|
||||
return super.dispatchKeyEvent(event)
|
||||
}
|
||||
|
||||
private external fun nativeGamepadKeyEvent(deviceId: Int, keyCode: Int, pressed: Boolean)
|
||||
|
||||
override fun onPause() {
|
||||
// Notify Qt to stop rendering BEFORE super.onPause() destroys the EGL surface.
|
||||
// Using a coroutine here would be too late — the surface is gone by the time
|
||||
// the coroutine runs. A direct synchronous call gives Qt's render thread the
|
||||
// best chance to process visible=false before surface destruction.
|
||||
if (qtInitialized.isCompleted) {
|
||||
QtAndroidController.onActivityPaused()
|
||||
}
|
||||
super.onPause()
|
||||
isActivityResumed = false
|
||||
// Cancel all pending operations when activity pauses
|
||||
resumeHandler.removeCallbacksAndMessages(null)
|
||||
openFileDeliveryScheduled = false
|
||||
Log.d(TAG, "Pause Amnezia activity")
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
isActivityResumed = true
|
||||
Log.d(TAG, "Resume Amnezia activity")
|
||||
if (qtInitialized.isCompleted) {
|
||||
QtAndroidController.onActivityResumed()
|
||||
}
|
||||
|
||||
if (pendingOpenFileUri != null && !openFileDeliveryScheduled) {
|
||||
val uri = pendingOpenFileUri!!
|
||||
openFileDeliveryScheduled = true
|
||||
resumeHandler.postDelayed({
|
||||
if (!isFinishing && !isDestroyed) {
|
||||
pendingOpenFileUri = null
|
||||
openFileDeliveryScheduled = false
|
||||
mainScope.launch {
|
||||
qtInitialized.await()
|
||||
QtAndroidController.onFileOpened(uri)
|
||||
}
|
||||
}
|
||||
}, OPEN_FILE_AFTER_RESUME_DELAY_MS)
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
||||
window.decorView.apply {
|
||||
invalidate()
|
||||
|
||||
resumeHandler.postDelayed({
|
||||
// Check if activity is still resumed and has focus before executing
|
||||
if (isActivityResumed && hasWindowFocus && !isFinishing && !isDestroyed) {
|
||||
sendTouch(1f, 1f)
|
||||
}
|
||||
}, 100)
|
||||
|
||||
resumeHandler.postDelayed({
|
||||
if (isActivityResumed && hasWindowFocus && !isFinishing && !isDestroyed) {
|
||||
sendTouch(2f, 2f)
|
||||
}
|
||||
}, 200)
|
||||
|
||||
resumeHandler.postDelayed({
|
||||
if (isActivityResumed && hasWindowFocus && !isFinishing && !isDestroyed) {
|
||||
requestLayout()
|
||||
invalidate()
|
||||
}
|
||||
}, 250)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun configureWindowForEdgeToEdge() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
||||
window.apply {
|
||||
addFlags(LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
|
||||
addFlags(LayoutParams.FLAG_LAYOUT_NO_LIMITS)
|
||||
statusBarColor = android.graphics.Color.TRANSPARENT
|
||||
navigationBarColor = android.graphics.Color.TRANSPARENT
|
||||
}
|
||||
|
||||
WindowInsetsControllerCompat(window, window.decorView).apply {
|
||||
isAppearanceLightStatusBars = false
|
||||
isAppearanceLightNavigationBars = false
|
||||
}
|
||||
|
||||
// Workaround for Android 14 (API 34+) IME adjustResize bug
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
||||
setupImeInsetsListener()
|
||||
}
|
||||
} else {
|
||||
window.apply {
|
||||
addFlags(LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
|
||||
statusBarColor = getColor(R.color.black)
|
||||
}
|
||||
|
||||
WindowInsetsControllerCompat(window, window.decorView).apply {
|
||||
isAppearanceLightStatusBars = false
|
||||
isAppearanceLightNavigationBars = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupImeInsetsListener() {
|
||||
ViewCompat.setOnApplyWindowInsetsListener(window.decorView) { view, windowInsets ->
|
||||
val imeInsets = windowInsets.getInsets(WindowInsetsCompat.Type.ime())
|
||||
val imeVisible = windowInsets.isVisible(WindowInsetsCompat.Type.ime())
|
||||
|
||||
val imeHeight = if (imeVisible) imeInsets.bottom else 0
|
||||
|
||||
val density = resources.displayMetrics.density
|
||||
val imeHeightDp = (imeHeight / density).toInt()
|
||||
|
||||
// Also track system bars (navigation bar, status bar) changes
|
||||
val systemBarsInsets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
val navBarHeight = systemBarsInsets.bottom
|
||||
val navBarHeightDp = (navBarHeight / density).toInt()
|
||||
val statusBarHeight = systemBarsInsets.top
|
||||
val statusBarHeightDp = (statusBarHeight / density).toInt()
|
||||
|
||||
mainScope.launch {
|
||||
qtInitialized.await()
|
||||
QtAndroidController.onImeInsetsChanged(imeHeightDp)
|
||||
QtAndroidController.onSystemBarsInsetsChanged(navBarHeightDp, statusBarHeightDp)
|
||||
}
|
||||
|
||||
// Return windowInsets instead of CONSUMED to allow proper handling
|
||||
windowInsets
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
isActivityResumed = false
|
||||
hasWindowFocus = false
|
||||
// Cancel all pending operations when activity is destroyed
|
||||
resumeHandler.removeCallbacksAndMessages(null)
|
||||
Log.d(TAG, "Destroy Amnezia activity")
|
||||
unregisterBroadcastReceiver(notificationStateReceiver)
|
||||
notificationStateReceiver = null
|
||||
@@ -431,12 +633,13 @@ class AmneziaActivity : QtActivity() {
|
||||
|
||||
private fun getVpnProto(vpnConfig: String): VpnProto? = try {
|
||||
require(vpnConfig.isNotBlank()) { "Blank VPN config" }
|
||||
VpnProto.get(JSONObject(vpnConfig).getString("protocol"))
|
||||
JSONObject(vpnConfig)
|
||||
VpnProto.XTUN
|
||||
} catch (e: JSONException) {
|
||||
Log.e(TAG, "Invalid VPN config json format: ${e.message}")
|
||||
null
|
||||
} catch (e: IllegalArgumentException) {
|
||||
Log.e(TAG, "Protocol not found: ${e.message}")
|
||||
Log.e(TAG, "Invalid VPN config: ${e.message}")
|
||||
null
|
||||
}
|
||||
|
||||
@@ -463,6 +666,16 @@ class AmneziaActivity : QtActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
@MainThread
|
||||
private fun switchVpnProxy(vpnConfig: String) {
|
||||
Log.d(TAG, "Switch VPN proxy")
|
||||
vpnServiceMessenger.send {
|
||||
Action.SWITCH_PROXY.packToMessage {
|
||||
putString(MSG_VPN_CONFIG, vpnConfig)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@MainThread
|
||||
private fun disconnectFromVpn() {
|
||||
Log.d(TAG, "Disconnect from VPN")
|
||||
@@ -490,6 +703,14 @@ class AmneziaActivity : QtActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun switchProxy(vpnConfig: String) {
|
||||
Log.v(TAG, "Switch VPN proxy")
|
||||
mainScope.launch {
|
||||
switchVpnProxy(vpnConfig)
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun stop() {
|
||||
Log.v(TAG, "Stop VPN")
|
||||
@@ -517,28 +738,69 @@ class AmneziaActivity : QtActivity() {
|
||||
@Suppress("unused")
|
||||
fun saveFile(fileName: String, data: String) {
|
||||
Log.d(TAG, "Save file $fileName")
|
||||
createFile(fileName, "text/*") { os -> os.bufferedWriter().use { it.write(data) } }
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun saveFileBytes(fileName: String, data: ByteArray, mime: String) {
|
||||
Log.d(TAG, "Save file $fileName, ${data.size} bytes, $mime")
|
||||
createFile(fileName, mime) { os -> os.write(data) }
|
||||
}
|
||||
|
||||
private fun createFile(fileName: String, mime: String, write: (OutputStream) -> Unit) {
|
||||
mainScope.launch {
|
||||
Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
|
||||
addCategory(Intent.CATEGORY_OPENABLE)
|
||||
type = "text/*"
|
||||
type = mime
|
||||
putExtra(Intent.EXTRA_TITLE, fileName)
|
||||
}.also {
|
||||
try {
|
||||
startActivityForResult(it, CREATE_FILE_ACTION_CODE, ActivityResultHandler(
|
||||
onSuccess = {
|
||||
it?.data?.let { uri ->
|
||||
val uri = it?.data
|
||||
var saved = false
|
||||
if (uri != null) {
|
||||
Log.v(TAG, "Save file to $uri")
|
||||
try {
|
||||
contentResolver.openOutputStream(uri)?.use { os ->
|
||||
os.bufferedWriter().use { it.write(data) }
|
||||
write(os)
|
||||
saved = true
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
Log.e(TAG, "Failed to save file $uri: $e")
|
||||
// todo: send error to Qt
|
||||
}
|
||||
}
|
||||
QtAndroidController.onFileSaved(saved, false)
|
||||
},
|
||||
onFail = {
|
||||
QtAndroidController.onFileSaved(false, true)
|
||||
}
|
||||
))
|
||||
} catch (_: ActivityNotFoundException) {
|
||||
Toast.makeText(this@AmneziaActivity, "Unsupported", Toast.LENGTH_LONG).show()
|
||||
QtAndroidController.onFileSaved(false, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun shareFile(path: String, mime: String) {
|
||||
Log.d(TAG, "Share file $path, $mime")
|
||||
mainScope.launch {
|
||||
val uri = try {
|
||||
FileProvider.getUriForFile(this@AmneziaActivity, FILE_PROVIDER_AUTHORITY, File(path))
|
||||
} catch (e: IllegalArgumentException) {
|
||||
Log.e(TAG, "Failed to share file $path: $e")
|
||||
return@launch
|
||||
}
|
||||
Intent(Intent.ACTION_SEND).apply {
|
||||
type = mime
|
||||
putExtra(Intent.EXTRA_STREAM, uri)
|
||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||
}.also {
|
||||
try {
|
||||
startActivity(Intent.createChooser(it, null))
|
||||
} catch (_: ActivityNotFoundException) {
|
||||
Toast.makeText(this@AmneziaActivity, "Unsupported", Toast.LENGTH_LONG).show()
|
||||
}
|
||||
@@ -550,7 +812,13 @@ class AmneziaActivity : QtActivity() {
|
||||
fun openFile(filter: String?) {
|
||||
Log.v(TAG, "Open file with filter: $filter")
|
||||
mainScope.launch {
|
||||
val intent = if (!isOnTv()) {
|
||||
val systemPickerPackage = listOf("com.google.android.documentsui", "com.android.documentsui")
|
||||
.firstOrNull { pkg ->
|
||||
try { packageManager.getPackageInfo(pkg, 0); true }
|
||||
catch (_: PackageManager.NameNotFoundException) { false }
|
||||
}
|
||||
|
||||
val intent = if (!isOnTv() && systemPickerPackage != null) {
|
||||
val mimeTypes = if (!filter.isNullOrEmpty()) {
|
||||
val extensionRegex = "\\*\\.([a-z0-9]+)".toRegex(IGNORE_CASE)
|
||||
val mime = MimeTypeMap.getSingleton()
|
||||
@@ -576,28 +844,48 @@ class AmneziaActivity : QtActivity() {
|
||||
else -> type = "*/*"
|
||||
}
|
||||
}
|
||||
`package` = systemPickerPackage
|
||||
if (resolveActivity(packageManager) == null) {
|
||||
`package` = null
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Intent(this@AmneziaActivity, TvFilePicker::class.java)
|
||||
}
|
||||
|
||||
try {
|
||||
startActivityForResult(intent, OPEN_FILE_ACTION_CODE, ActivityResultHandler(
|
||||
onAny = {
|
||||
if (isOnTv() && it?.hasExtra("activityNotFound") == true) {
|
||||
showNoFileBrowserAlertDialog()
|
||||
val resultHandler = ActivityResultHandler(
|
||||
onAny = {
|
||||
if (isOnTv() && it?.hasExtra("activityNotFound") == true) {
|
||||
showNoFileBrowserAlertDialog()
|
||||
}
|
||||
val uri = it?.data?.let { u ->
|
||||
if (u.scheme == "content") {
|
||||
try { grantUriPermission(packageName, u, Intent.FLAG_GRANT_READ_URI_PERMISSION) } catch (_: Exception) {}
|
||||
}
|
||||
val uri = it?.data?.apply {
|
||||
grantUriPermission(packageName, this, Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||
}?.toString() ?: ""
|
||||
Log.v(TAG, "Open file: $uri")
|
||||
u
|
||||
}?.toString() ?: ""
|
||||
Log.v(TAG, "Open file: $uri")
|
||||
if (uri.isNotEmpty()) {
|
||||
pendingOpenFileUri = uri
|
||||
} else {
|
||||
mainScope.launch {
|
||||
qtInitialized.await()
|
||||
QtAndroidController.onFileOpened(uri)
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
)
|
||||
|
||||
try {
|
||||
startActivityForResult(intent, OPEN_FILE_ACTION_CODE, resultHandler)
|
||||
} catch (_: ActivityNotFoundException) {
|
||||
if (intent.`package` != null) {
|
||||
intent.`package` = null
|
||||
try {
|
||||
startActivityForResult(intent, OPEN_FILE_ACTION_CODE, resultHandler)
|
||||
return@launch
|
||||
} catch (_: ActivityNotFoundException) {}
|
||||
}
|
||||
showNoFileBrowserAlertDialog()
|
||||
mainScope.launch {
|
||||
qtInitialized.await()
|
||||
@@ -622,9 +910,14 @@ class AmneziaActivity : QtActivity() {
|
||||
@Suppress("unused")
|
||||
fun getFd(fileName: String): Int {
|
||||
Log.v(TAG, "Get fd for $fileName")
|
||||
return blockingCall {
|
||||
return blockingCall(Dispatchers.IO) {
|
||||
try {
|
||||
pfd = contentResolver.openFileDescriptor(Uri.parse(fileName), "r")
|
||||
val uri = Uri.parse(fileName)
|
||||
pfd = if (uri.scheme == "file") {
|
||||
ParcelFileDescriptor.open(File(uri.path!!), ParcelFileDescriptor.MODE_READ_ONLY)
|
||||
} else {
|
||||
contentResolver.openFileDescriptor(uri, "r")
|
||||
}
|
||||
pfd?.fd ?: -1
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Failed to get fd: $e")
|
||||
@@ -666,6 +959,43 @@ class AmneziaActivity : QtActivity() {
|
||||
@Suppress("unused")
|
||||
fun isOnTv(): Boolean = applicationContext.packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK)
|
||||
|
||||
@Suppress("unused")
|
||||
fun isEdgeToEdgeEnabled(): Boolean = Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE
|
||||
|
||||
@Suppress("unused")
|
||||
fun getStatusBarHeight(): Int {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE) return 0
|
||||
|
||||
val resourceId = resources.getIdentifier("status_bar_height", "dimen", "android")
|
||||
val heightPx = if (resourceId > 0) {
|
||||
resources.getDimensionPixelSize(resourceId)
|
||||
} else {
|
||||
0
|
||||
}
|
||||
|
||||
// Convert physical pixels to device-independent pixels for QML
|
||||
val density = resources.displayMetrics.density
|
||||
val heightDp = (heightPx / density).toInt()
|
||||
return heightDp
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun getNavigationBarHeight(): Int {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE) return 0
|
||||
|
||||
val resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android")
|
||||
val heightPx = if (resourceId > 0) {
|
||||
resources.getDimensionPixelSize(resourceId)
|
||||
} else {
|
||||
0
|
||||
}
|
||||
|
||||
// Convert physical pixels to device-independent pixels for QML
|
||||
val density = resources.displayMetrics.density
|
||||
val heightDp = (heightPx / density).toInt()
|
||||
return heightDp
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun startQrCodeReader() {
|
||||
Log.v(TAG, "Start camera")
|
||||
@@ -687,20 +1017,6 @@ class AmneziaActivity : QtActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun exportLogsFile(fileName: String) {
|
||||
Log.v(TAG, "Export logs file")
|
||||
saveFile(fileName, Log.getLogs())
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun clearLogs() {
|
||||
Log.v(TAG, "Clear logs")
|
||||
mainScope.launch {
|
||||
Log.clearLogs()
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun setScreenshotsEnabled(enabled: Boolean) {
|
||||
Log.v(TAG, "Set screenshots enabled: $enabled")
|
||||
@@ -729,15 +1045,9 @@ class AmneziaActivity : QtActivity() {
|
||||
@Suppress("unused")
|
||||
fun getAppList(): String {
|
||||
Log.v(TAG, "Get app list")
|
||||
var appList = ""
|
||||
runBlocking {
|
||||
mainScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
appList = AppListProvider.getAppList(packageManager, packageName)
|
||||
}
|
||||
}.join()
|
||||
return blockingCall(Dispatchers.IO) {
|
||||
AppListProvider.getAppList(packageManager, packageName)
|
||||
}
|
||||
return appList
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
@@ -807,12 +1117,10 @@ class AmneziaActivity : QtActivity() {
|
||||
@Suppress("unused")
|
||||
fun sendTouch(x: Float, y: Float) {
|
||||
Log.v(TAG, "Send touch: $x, $y")
|
||||
blockingCall {
|
||||
findQtWindow(window.decorView)?.let {
|
||||
Log.v(TAG, "Send touch to $it")
|
||||
it.dispatchTouchEvent(createEvent(x, y, SystemClock.uptimeMillis(), MotionEvent.ACTION_DOWN))
|
||||
it.dispatchTouchEvent(createEvent(x, y, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP))
|
||||
}
|
||||
findQtWindow(window.decorView)?.let {
|
||||
Log.v(TAG, "Send touch to $it")
|
||||
it.dispatchTouchEvent(createEvent(x, y, SystemClock.uptimeMillis(), MotionEvent.ACTION_DOWN))
|
||||
it.dispatchTouchEvent(createEvent(x, y, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -908,11 +1216,48 @@ class AmneziaActivity : QtActivity() {
|
||||
return super.dispatchTrackballEvent(ev)
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun isPlay(): Boolean = BuildConfig.FLAVOR == "play"
|
||||
|
||||
@Suppress("unused")
|
||||
fun getCountryCode(): String {
|
||||
return blockingCall { billingRepository.getCountryCode() }
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun getSubscriptionPlans(): String {
|
||||
return blockingCall { billingRepository.getSubscriptionPlans() }
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun purchaseSubscription(offerToken: String): String {
|
||||
return blockingCall { billingRepository.purchaseSubscription(this@AmneziaActivity, offerToken) }
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun upgradeSubscription(offerToken: String, oldPurchaseToken: String): String {
|
||||
Log.v(TAG, "Upgrade subscription")
|
||||
return blockingCall {
|
||||
billingRepository.upgradeSubscription(this@AmneziaActivity, offerToken, oldPurchaseToken)
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun acknowledgePurchase(purchaseToken: String): String {
|
||||
Log.v(TAG, "Acknowledge purchase")
|
||||
return blockingCall { billingRepository.acknowledge(purchaseToken) }
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun queryPurchases(): String {
|
||||
return blockingCall { billingRepository.queryPurchases() }
|
||||
}
|
||||
|
||||
/**
|
||||
* Utils methods
|
||||
*/
|
||||
private fun <T> blockingCall(
|
||||
context: CoroutineContext = Dispatchers.Main.immediate,
|
||||
context: CoroutineContext = Dispatchers.Default,
|
||||
block: suspend () -> T
|
||||
) = runBlocking {
|
||||
mainScope.async(context) { block() }.await()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.amnezia.vpn
|
||||
|
||||
import android.system.Os
|
||||
import androidx.camera.camera2.Camera2Config
|
||||
import androidx.camera.core.CameraSelector
|
||||
import androidx.camera.core.CameraXConfig
|
||||
@@ -12,6 +13,9 @@ private const val TAG = "AmneziaApplication"
|
||||
class AmneziaApplication : QtApplication(), CameraXConfig.Provider {
|
||||
|
||||
override fun onCreate() {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Os.setenv("QT_ANDROID_DEBUGGER_MAIN_THREAD_SLEEP_MS", "0", true)
|
||||
}
|
||||
super.onCreate()
|
||||
Prefs.init(this)
|
||||
Log.init(this)
|
||||
|
||||
@@ -47,10 +47,8 @@ import org.amnezia.vpn.protocol.ProtocolState.DISCONNECTED
|
||||
import org.amnezia.vpn.protocol.ProtocolState.DISCONNECTING
|
||||
import org.amnezia.vpn.protocol.ProtocolState.RECONNECTING
|
||||
import org.amnezia.vpn.protocol.ProtocolState.UNKNOWN
|
||||
import org.amnezia.vpn.protocol.VpnException
|
||||
import org.amnezia.vpn.protocol.VpnStartException
|
||||
import org.amnezia.vpn.protocol.putStatus
|
||||
import org.amnezia.vpn.util.LoadLibraryException
|
||||
import org.amnezia.vpn.util.Log
|
||||
import org.amnezia.vpn.util.Prefs
|
||||
import org.amnezia.vpn.util.net.NetworkState
|
||||
@@ -72,7 +70,6 @@ const val AFTER_PERMISSION_CHECK = "AFTER_PERMISSION_CHECK"
|
||||
private const val PREFS_CONFIG_KEY = "LAST_CONF"
|
||||
private const val PREFS_SERVER_NAME = "LAST_SERVER_NAME"
|
||||
private const val PREFS_SERVER_INDEX = "LAST_SERVER_INDEX"
|
||||
// private const val STATISTICS_SENDING_TIMEOUT = 1000L
|
||||
private const val TRAFFIC_STATS_UPDATE_TIMEOUT = 1000L
|
||||
private const val DISCONNECT_TIMEOUT = 5000L
|
||||
private const val STOP_SERVICE_TIMEOUT = 5000L
|
||||
@@ -100,7 +97,6 @@ open class AmneziaVpnService : VpnService() {
|
||||
private var connectionJob: Job? = null
|
||||
private var disconnectionJob: Job? = null
|
||||
private var trafficStatsUpdateJob: Job? = null
|
||||
// private var statisticsSendingJob: Job? = null
|
||||
private lateinit var networkState: NetworkState
|
||||
private lateinit var trafficStats: TrafficStats
|
||||
private var controlReceiver: BroadcastReceiver? = null
|
||||
@@ -109,9 +105,6 @@ open class AmneziaVpnService : VpnService() {
|
||||
private var screenOffReceiver: BroadcastReceiver? = null
|
||||
private val clientMessengers = ConcurrentHashMap<Messenger, IpcMessenger>()
|
||||
|
||||
private val isActivityConnected
|
||||
get() = clientMessengers.any { it.value.name == ACTIVITY_MESSENGER_NAME }
|
||||
|
||||
private val connectionExceptionHandler = CoroutineExceptionHandler { _, e ->
|
||||
connectionJob?.cancel()
|
||||
connectionJob = null
|
||||
@@ -120,14 +113,11 @@ open class AmneziaVpnService : VpnService() {
|
||||
protocolState.value = DISCONNECTED
|
||||
when (e) {
|
||||
is IllegalArgumentException,
|
||||
is VpnStartException,
|
||||
is VpnException -> onError(e.message ?: e.toString())
|
||||
is VpnStartException -> onError(e.message ?: e.toString())
|
||||
|
||||
is JSONException,
|
||||
is BadConfigException -> onError("VPN config format error: ${e.message}")
|
||||
|
||||
is LoadLibraryException -> onError("${e.message}. Caused: ${e.cause?.message}")
|
||||
|
||||
is UnknownHostException -> onError("Unknown host")
|
||||
|
||||
else -> throw e
|
||||
@@ -145,13 +135,11 @@ open class AmneziaVpnService : VpnService() {
|
||||
val messenger = IpcMessenger(msg.replyTo, clientName)
|
||||
clientMessengers[msg.replyTo] = messenger
|
||||
Log.d(TAG, "Messenger client '$clientName' was registered")
|
||||
// if (clientName == ACTIVITY_MESSENGER_NAME && isConnected) launchSendingStatistics()
|
||||
}
|
||||
|
||||
Action.UNREGISTER_CLIENT -> {
|
||||
clientMessengers.remove(msg.replyTo)?.let {
|
||||
Log.d(TAG, "Messenger client '${it.name}' was unregistered")
|
||||
// if (it.name == ACTIVITY_MESSENGER_NAME) stopSendingStatistics()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,6 +151,10 @@ open class AmneziaVpnService : VpnService() {
|
||||
disconnect()
|
||||
}
|
||||
|
||||
Action.SWITCH_PROXY -> {
|
||||
msg.data.getString(MSG_VPN_CONFIG)?.let(::switchProxy)
|
||||
}
|
||||
|
||||
Action.REQUEST_STATUS -> {
|
||||
clientMessengers[msg.replyTo]?.let { clientMessenger ->
|
||||
clientMessenger.send {
|
||||
@@ -381,26 +373,22 @@ open class AmneziaVpnService : VpnService() {
|
||||
when (protocolState) {
|
||||
CONNECTED -> {
|
||||
networkState.bindNetworkListener()
|
||||
// if (isActivityConnected) launchSendingStatistics()
|
||||
launchTrafficStatsUpdate()
|
||||
}
|
||||
|
||||
DISCONNECTED -> {
|
||||
networkState.unbindNetworkListener()
|
||||
stopTrafficStatsUpdateJob()
|
||||
// stopSendingStatistics()
|
||||
if (!isServiceBound) stopService()
|
||||
}
|
||||
|
||||
DISCONNECTING -> {
|
||||
networkState.unbindNetworkListener()
|
||||
stopTrafficStatsUpdateJob()
|
||||
// stopSendingStatistics()
|
||||
}
|
||||
|
||||
RECONNECTING -> {
|
||||
stopTrafficStatsUpdateJob()
|
||||
// stopSendingStatistics()
|
||||
}
|
||||
|
||||
CONNECTING, UNKNOWN -> {}
|
||||
@@ -409,27 +397,6 @@ open class AmneziaVpnService : VpnService() {
|
||||
}
|
||||
}
|
||||
|
||||
/* @MainThread
|
||||
private fun launchSendingStatistics() {
|
||||
if (isServiceBound && isConnected) {
|
||||
statisticsSendingJob = mainScope.launch {
|
||||
while (true) {
|
||||
clientMessenger.send {
|
||||
ServiceEvent.STATISTICS_UPDATE.packToMessage {
|
||||
putStatistics(protocol?.statistics ?: Statistics.EMPTY_STATISTICS)
|
||||
}
|
||||
}
|
||||
delay(STATISTICS_SENDING_TIMEOUT)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@MainThread
|
||||
private fun stopSendingStatistics() {
|
||||
statisticsSendingJob?.cancel()
|
||||
} */
|
||||
|
||||
@MainThread
|
||||
private fun enableNotification() {
|
||||
registerScreenStateBroadcastReceivers()
|
||||
@@ -504,13 +471,7 @@ open class AmneziaVpnService : VpnService() {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
vpnProto = VpnProto.get(config.getString("protocol"))
|
||||
} catch (e: Exception) {
|
||||
onError("Invalid VPN config: ${e.message}")
|
||||
protocolState.value = DISCONNECTED
|
||||
return
|
||||
}
|
||||
vpnProto = VpnProto.XTUN
|
||||
|
||||
protocolState.value = CONNECTING
|
||||
|
||||
@@ -530,6 +491,21 @@ open class AmneziaVpnService : VpnService() {
|
||||
}
|
||||
}
|
||||
|
||||
@MainThread
|
||||
private fun switchProxy(vpnConfig: String) {
|
||||
if (!isConnected) return
|
||||
|
||||
Log.d(TAG, "Switch VPN proxy")
|
||||
|
||||
val config = parseConfigToJson(vpnConfig) ?: return
|
||||
Prefs.save(PREFS_CONFIG_KEY, vpnConfig)
|
||||
saveServerData(config)
|
||||
|
||||
connectionJob = connectionScope.launch {
|
||||
vpnProto?.protocol?.switchProxy(config, Builder(), ::protect)
|
||||
}
|
||||
}
|
||||
|
||||
@MainThread
|
||||
private fun disconnect() {
|
||||
if (isUnknown || isDisconnected || protocolState.value == DISCONNECTING) return
|
||||
@@ -562,10 +538,8 @@ open class AmneziaVpnService : VpnService() {
|
||||
|
||||
Log.d(TAG, "Reconnect VPN")
|
||||
|
||||
protocolState.value = RECONNECTING
|
||||
|
||||
connectionJob = connectionScope.launch {
|
||||
vpnProto?.protocol?.reconnectVpn(Builder())
|
||||
vpnProto?.protocol?.reconnectVpn(Builder(), ::protect)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,15 +38,15 @@ object AppListProvider {
|
||||
}
|
||||
}
|
||||
|
||||
private class App(pi: PackageInfo, pm: PackageManager, ai: ApplicationInfo = pi.applicationInfo) : Comparable<App> {
|
||||
private class App(pi: PackageInfo, pm: PackageManager, ai: ApplicationInfo? = pi.applicationInfo) : Comparable<App> {
|
||||
val name: String?
|
||||
val packageName: String = pi.packageName
|
||||
val icon: Boolean = ai.icon != 0
|
||||
val icon: Boolean = (ai?.icon ?: 0) != 0
|
||||
val isLaunchable: Boolean = pm.getLaunchIntentForPackage(packageName) != null
|
||||
|
||||
init {
|
||||
val name = ai.loadLabel(pm).toString()
|
||||
this.name = if (name != packageName) name else null
|
||||
val name = ai?.loadLabel(pm)?.toString()
|
||||
this.name = name?.takeIf { it != packageName }
|
||||
}
|
||||
|
||||
override fun compareTo(other: App): Int {
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
package org.amnezia.vpn
|
||||
|
||||
class AwgService : AmneziaVpnService()
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.amnezia.vpn
|
||||
|
||||
import android.app.Activity
|
||||
|
||||
interface BillingRepository {
|
||||
suspend fun getCountryCode(): String
|
||||
suspend fun getSubscriptionPlans(): String
|
||||
suspend fun purchaseSubscription(activity: Activity, offerToken: String): String
|
||||
suspend fun upgradeSubscription(activity: Activity, offerToken: String, oldPurchaseToken: String): String
|
||||
suspend fun acknowledge(purchaseToken: String): String
|
||||
suspend fun queryPurchases(): String
|
||||
}
|
||||
@@ -22,7 +22,6 @@ sealed interface IpcMessage {
|
||||
enum class ServiceEvent : IpcMessage {
|
||||
STATUS_CHANGED,
|
||||
STATUS,
|
||||
STATISTICS_UPDATE,
|
||||
ERROR
|
||||
}
|
||||
|
||||
@@ -33,7 +32,8 @@ enum class Action : IpcMessage {
|
||||
DISCONNECT,
|
||||
REQUEST_STATUS,
|
||||
NOTIFICATION_PERMISSION_GRANTED,
|
||||
SET_SAVE_LOGS
|
||||
SET_SAVE_LOGS,
|
||||
SWITCH_PROXY
|
||||
}
|
||||
|
||||
fun <T> T.packToMessage(): Message
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
package org.amnezia.vpn
|
||||
|
||||
class OpenVpnService : AmneziaVpnService()
|
||||
@@ -1,45 +1,177 @@
|
||||
package org.amnezia.vpn
|
||||
|
||||
import android.Manifest
|
||||
import android.app.AlertDialog
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Environment
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import org.amnezia.vpn.util.Log
|
||||
import java.io.File
|
||||
|
||||
private const val TAG = "TvFilePicker"
|
||||
private const val READ_STORAGE_REQUEST_CODE = 1001
|
||||
|
||||
class TvFilePicker : ComponentActivity() {
|
||||
|
||||
private val fileChooseResultLauncher = registerForActivityResult(ActivityResultContracts.GetContent()) {
|
||||
setResult(RESULT_OK, Intent().apply { data = it })
|
||||
// SAF launcher for Android 10+ where File API is blocked by scoped storage
|
||||
private val safLauncher = registerForActivityResult(object : ActivityResultContracts.OpenDocument() {
|
||||
override fun createIntent(context: Context, input: Array<String>): Intent {
|
||||
val intent = super.createIntent(context, input)
|
||||
val activities = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
context.packageManager.queryIntentActivities(intent, PackageManager.ResolveInfoFlags.of(PackageManager.MATCH_DEFAULT_ONLY.toLong()))
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
context.packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY)
|
||||
}
|
||||
if (activities.all {
|
||||
val name = it.activityInfo.packageName
|
||||
name.startsWith("com.google.android.tv.frameworkpackagestubs") || name.startsWith("com.android.tv.frameworkpackagestubs")
|
||||
}) {
|
||||
throw ActivityNotFoundException()
|
||||
}
|
||||
return intent
|
||||
}
|
||||
}) { uri ->
|
||||
setResult(RESULT_OK, Intent().apply {
|
||||
data = uri
|
||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||
})
|
||||
finish()
|
||||
}
|
||||
|
||||
private val directoryStack = ArrayDeque<File>()
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
Log.v(TAG, "onCreate")
|
||||
getFile()
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
launchSaf()
|
||||
} else {
|
||||
checkPermissionAndBrowse()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
super.onNewIntent(intent)
|
||||
Log.v(TAG, "onNewIntent")
|
||||
getFile()
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onBackPressed() {
|
||||
navigateBack()
|
||||
}
|
||||
|
||||
private fun getFile() {
|
||||
private fun launchSaf() {
|
||||
try {
|
||||
Log.v(TAG, "getFile")
|
||||
fileChooseResultLauncher.launch("*/*")
|
||||
safLauncher.launch(arrayOf("*/*"))
|
||||
} catch (_: ActivityNotFoundException) {
|
||||
Log.w(TAG, "Activity not found")
|
||||
Log.w(TAG, "No SAF activity found")
|
||||
setResult(RESULT_CANCELED, Intent().apply { putExtra("activityNotFound", true) })
|
||||
finish()
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Failed to get file: $e")
|
||||
Log.e(TAG, "SAF launch failed: $e")
|
||||
setResult(RESULT_CANCELED)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkPermissionAndBrowse() {
|
||||
if (checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||
requestPermissions(arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE), READ_STORAGE_REQUEST_CODE)
|
||||
} else {
|
||||
showRootDirectory()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
if (requestCode == READ_STORAGE_REQUEST_CODE &&
|
||||
grantResults.firstOrNull() == PackageManager.PERMISSION_GRANTED) {
|
||||
showRootDirectory()
|
||||
} else {
|
||||
setResult(RESULT_CANCELED)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
private fun showRootDirectory() {
|
||||
@Suppress("DEPRECATION")
|
||||
val primaryExternal = Environment.getExternalStorageDirectory()
|
||||
val storageDir = File("/storage")
|
||||
// Pre-seed stack with /storage so Back from primary storage goes there (USB drives etc.)
|
||||
if (storageDir.exists() && storageDir.canonicalPath != primaryExternal.canonicalPath) {
|
||||
directoryStack.addLast(storageDir)
|
||||
}
|
||||
showDirectory(primaryExternal)
|
||||
}
|
||||
|
||||
private fun navigateBack() {
|
||||
if (directoryStack.size > 1) {
|
||||
directoryStack.removeLast()
|
||||
val parent = directoryStack.removeLast()
|
||||
showDirectory(parent)
|
||||
} else {
|
||||
setResult(RESULT_CANCELED)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
private fun showDirectory(dir: File) {
|
||||
directoryStack.addLast(dir)
|
||||
Log.v(TAG, "Showing directory: ${dir.absolutePath}")
|
||||
|
||||
val entries = try {
|
||||
dir.listFiles()
|
||||
?.sortedWith(compareBy({ !it.isDirectory }, { it.name.lowercase() }))
|
||||
?: emptyList()
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Failed to list directory: $e")
|
||||
emptyList()
|
||||
}
|
||||
|
||||
val names = entries.map { if (it.isDirectory) "[${it.name}]" else it.name }.toTypedArray()
|
||||
|
||||
val builder = AlertDialog.Builder(this)
|
||||
.setTitle(dir.absolutePath)
|
||||
|
||||
if (entries.isEmpty()) {
|
||||
builder.setMessage("No files available")
|
||||
} else {
|
||||
builder.setItems(names) { dialog, which ->
|
||||
dialog.dismiss()
|
||||
val selected = entries[which]
|
||||
if (selected.isDirectory) {
|
||||
showDirectory(selected)
|
||||
} else {
|
||||
Log.v(TAG, "Selected file: ${selected.absolutePath}")
|
||||
setResult(RESULT_OK, Intent().apply {
|
||||
data = Uri.fromFile(selected)
|
||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||
})
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (directoryStack.size > 1) {
|
||||
builder.setNegativeButton("↑ Back") { dialog, _ ->
|
||||
dialog.dismiss()
|
||||
navigateBack()
|
||||
}
|
||||
} else {
|
||||
builder.setNegativeButton(android.R.string.cancel) { _, _ ->
|
||||
setResult(RESULT_CANCELED)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
builder.setOnCancelListener {
|
||||
setResult(RESULT_CANCELED)
|
||||
finish()
|
||||
}
|
||||
|
||||
builder.show()
|
||||
}
|
||||
}
|
||||
@@ -1,63 +1,20 @@
|
||||
package org.amnezia.vpn
|
||||
|
||||
import org.amnezia.vpn.protocol.Protocol
|
||||
import org.amnezia.vpn.protocol.awg.Awg
|
||||
import org.amnezia.vpn.protocol.cloak.Cloak
|
||||
import org.amnezia.vpn.protocol.openvpn.OpenVpn
|
||||
import org.amnezia.vpn.protocol.wireguard.Wireguard
|
||||
import org.amnezia.vpn.protocol.xray.Xray
|
||||
import org.amnezia.vpn.protocol.VPN_SESSION_NAME
|
||||
import org.amnezia.vpn.protocol.xtun.Xtun
|
||||
|
||||
enum class VpnProto(
|
||||
val label: String,
|
||||
val processName: String,
|
||||
val serviceClass: Class<out AmneziaVpnService>
|
||||
) {
|
||||
WIREGUARD(
|
||||
"WireGuard",
|
||||
"org.amnezia.vpn:amneziaAwgService",
|
||||
AwgService::class.java
|
||||
XTUN(
|
||||
VPN_SESSION_NAME,
|
||||
"org.amnezia.vpn:amneziaVpnService",
|
||||
XtunService::class.java
|
||||
) {
|
||||
override fun createProtocol(): Protocol = Wireguard()
|
||||
},
|
||||
|
||||
AWG(
|
||||
"AmneziaWG",
|
||||
"org.amnezia.vpn:amneziaAwgService",
|
||||
AwgService::class.java
|
||||
) {
|
||||
override fun createProtocol(): Protocol = Awg()
|
||||
},
|
||||
|
||||
OPENVPN(
|
||||
"OpenVPN",
|
||||
"org.amnezia.vpn:amneziaOpenVpnService",
|
||||
OpenVpnService::class.java
|
||||
) {
|
||||
override fun createProtocol(): Protocol = OpenVpn()
|
||||
},
|
||||
|
||||
CLOAK(
|
||||
"Cloak",
|
||||
"org.amnezia.vpn:amneziaOpenVpnService",
|
||||
OpenVpnService::class.java
|
||||
) {
|
||||
override fun createProtocol(): Protocol = Cloak()
|
||||
},
|
||||
|
||||
XRAY(
|
||||
"XRay",
|
||||
"org.amnezia.vpn:amneziaXrayService",
|
||||
XrayService::class.java
|
||||
) {
|
||||
override fun createProtocol(): Protocol = Xray.instance
|
||||
},
|
||||
|
||||
SSXRAY(
|
||||
"SSXRay",
|
||||
"org.amnezia.vpn:amneziaXrayService",
|
||||
XrayService::class.java
|
||||
) {
|
||||
override fun createProtocol(): Protocol = Xray.instance
|
||||
override fun createProtocol(): Protocol = Xtun()
|
||||
};
|
||||
|
||||
private var _protocol: Protocol? = null
|
||||
@@ -68,8 +25,4 @@ enum class VpnProto(
|
||||
}
|
||||
|
||||
protected abstract fun createProtocol(): Protocol
|
||||
|
||||
companion object {
|
||||
fun get(protocolName: String): VpnProto = VpnProto.valueOf(protocolName.uppercase())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
package org.amnezia.vpn
|
||||
|
||||
class XrayService : AmneziaVpnService()
|
||||
@@ -0,0 +1,3 @@
|
||||
package org.amnezia.vpn
|
||||
|
||||
class XtunService : AmneziaVpnService()
|
||||
@@ -19,13 +19,19 @@ object QtAndroidController {
|
||||
external fun onVpnPermissionRejected()
|
||||
external fun onNotificationStateChanged()
|
||||
external fun onVpnStateChanged(stateCode: Int)
|
||||
external fun onStatisticsUpdate(rxBytes: Long, txBytes: Long)
|
||||
|
||||
external fun onFileOpened(uri: String)
|
||||
external fun onFileSaved(success: Boolean, cancelled: Boolean)
|
||||
|
||||
external fun onConfigImported(data: String)
|
||||
|
||||
external fun onAuthResult(result: Boolean)
|
||||
|
||||
external fun decodeQrCode(data: String): Boolean
|
||||
|
||||
external fun onImeInsetsChanged(heightDp: Int)
|
||||
external fun onSystemBarsInsetsChanged(navBarHeightDp: Int, statusBarHeightDp: Int)
|
||||
|
||||
external fun onActivityPaused()
|
||||
external fun onActivityResumed()
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.amnezia.vpn.util
|
||||
|
||||
// keep synchronized with client/core/utils/errorCodes.h amnezia::ErrorCode
|
||||
object ErrorCode {
|
||||
const val NoError = 0
|
||||
|
||||
const val BillingCanceled = 1300
|
||||
const val BillingError = 1301
|
||||
const val BillingGooglePlayError = 1302
|
||||
const val BillingUnavailable = 1303
|
||||
const val SubscriptionAlreadyOwned = 1304
|
||||
const val SubscriptionUnavailable = 1305
|
||||
const val BillingNetworkError = 1306
|
||||
}
|
||||
Loaded 100 of 1210 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user