Compare commits

..
Author SHA1 Message Date
Yaroslav Gurov 44b0cf17c0 tmp: use debug version of xtun 2026-12-03 14:43:19 +01:00
vkamn c499b838db chore: bump version 2026-11-27 23:24:02 +09:00
vkamn 3fad6bebfb Merge branch 'feat/xtun' of github-amnezia:amnezia-vpn/amnezia-client into feat/xtun 2026-11-27 23:23:30 +09:00
vkamn 4701345b5f fix(android): let xtun status drive the reconnecting state 2026-11-27 22:00:24 +09:00
vkamn 274c9b6e36 fix: report an error when the service connection is lost 2026-11-27 22:00:24 +09:00
vkamn c6ef64a67c fix: re-enable service logs when the service reconnects 2026-11-27 22:00:24 +09:00
vkamn a1f1c91f48 fix: serialize log file access between threads 2026-11-27 21:52:28 +09:00
Yaroslav Gurov 4dafd33929 fix: bundle wintun and update xtun 2026-11-25 22:02:16 +01:00
Yaroslav Gurov be5f13c034 feat: upgrade xtun up to 0.0.2-rc3 2026-11-24 17:22:31 +01:00
Yaroslav Gurov 8072667f60 fix(ci): use gcc12 2026-11-24 15:35:55 +01:00
Yaroslav Gurov 76bc25d6d8 fix(signing): make codesign to ignore empty files 2026-11-24 14:08:29 +01:00
vkamn bc781477a2 feat: switch API location without disconnecting
Changing the location of a connected Premium/Free server was blocked until the user disconnected.
Now the xtun proxy is swapped on the running tunnel (desktop, Android, Apple NE), and on Apple the new config is saved to the VPN profile.
2026-11-24 21:03:08 +09:00
vkamn 1d307ad4f3 feat: bump xtun to 0.0.2
- add site split support
- add xray support
2026-11-22 13:27:57 +09:00
vkamn 9791dd190e Merge branch 'dev' of github-amnezia:amnezia-vpn/amnezia-client into HEAD 2026-11-22 12:36:05 +09:00
vkamn 4f0fa34449 chore: bump version (#3505) 2026-11-20 21:03:06 +09:00
NickVs2015 b7edabadb9 fix: update awg-apple to 3.1.5 (#3504) 2026-11-20 21:01:20 +09:00
vkamn c71e65d9cd chore: minor fixes (#3493)
* fix: keep TestFlight upload going while another build is in beta review

* chore: drop cisco, asus, logitech, dropbox and speedtest from default SNI list

* fix: keep safe area when screenshots are disallowed

* chore: bump version
2026-11-19 12:56:22 +09:00
vkamn 5aff2ce580 fix: run deploy jobs with always() and check build results in a step (#3483) 2026-11-17 02:03:55 +09:00
vkamn 41a6757042 fix: gate deploy jobs on always() with explicit build result checks (#3482) 2026-11-17 01:20:54 +09:00
vkamn f0b12257ab chore: minor fixes (#3481)
* fix: distribute TestFlight builds to the test-external group

* chore: bump version
2026-11-16 22:10:45 +09:00
vkamn 762f61cea3 fix: run deploy jobs when prebuilt baking is skipped (#3476) 2026-11-16 12:30:32 +09:00
vkamn 1efeab81b6 fix: stop exposing the XRay server address in VPN routes (#3473) 2026-11-16 00:36:23 +09:00
vkamn a9e6a2222c chore: minor fixes (#3472)
* feat: send TestFlight builds to the external test group

* fix: lock app split tunneling list during active connection

* fix: ignore tun2socks stderr after the process is reset

* fix: leave the start screen when a subscription is restored in background

* chore: pass AGW public keys as base64

* chore: bump version

* chore: configure dev gateway from the dev menu
2026-11-15 23:57:13 +09:00
vkamn 5c732f6edc feat: send TestFlight builds to the external test group (#3467) 2026-11-14 20:59:46 +09:00
vkamn 2bd60309d0 feat: ci release ios (#3465)
* feat: upload Play AABs to the Google Play beta track on version tags

* chore: bump xcode-version

* fix: pass provisioning profiles explicitly when exporting Apple archives
2026-11-14 01:56:40 +09:00
vkamn 0514a5d5b1 chore: remove double build for macos ne and ios (#3464) 2026-11-14 00:11:49 +09:00
vkamn c6af4cc266 chore: upload iOS and macOS NE builds to TestFlight on version tags (#3463) 2026-11-14 00:06:56 +09:00
vkamn 62a8a79931 feat: ci release ios (#3462)
* feat: upload iOS and macOS NE builds to TestFlight on version tags

* chore: bump version
2026-11-13 23:40:12 +09:00
vkamn f15932bf22 feat: ci release (#3461)
* fix: restore universal APK and speed up Android CI

* chore: bump version

* feat: create draft pre-release with build artifacts on version tags
2026-11-13 21:52:42 +09:00
vkamn 8165462865 feat: selfhosted improvements (#3458)
* chore: set firefox as default fingerprint for xray selfhosted

* feat: add cascade endpoint and port to WG/AWG configs

* fix: build server info tabs from available pages

* feat: pick the default Reality site and SNI at random
2026-11-13 21:20:16 +09:00
NickVs2015 864c1faab8 chore: update awg-apple to 3.1.5 (#3454) 2026-11-12 12:26:59 +09:00
yp 3a6bf7376c fix: ios stop hev before restarting xray tunnel (#3428) 2026-11-12 01:19:30 +09:00
yp ba402f898a fix: ui block hover through pinned navigation bar (#3439) 2026-11-12 01:12:15 +09:00
vkamn b7cc397fee chore: bump version 2026-11-12 00:47:36 +09:00
vkamn 7def06c561 Merge branch 'dev' of github-amnezia:amnezia-vpn/amnezia-client into HEAD 2026-11-12 00:47:18 +09:00
vkamn 7e9dd0a588 chore: remove network code left over after xtun migration 2026-11-12 00:34:13 +09:00
vkamn 31463516ac feat: move Android and iOS tunnels to xtun 2026-11-11 22:28:47 +09:00
vkamn ac175c8a81 сhore: minor fixes (#3373)
* fix: do not leave the loader running after a failed captcha flow

* fix: protocol choice without country choice for Amnezia Free

* feat: add server package update for self-hosted admins

* chore: bump version

* feat: use hellochrome_120 as the default client fingerprint

* feat: offer server reboot after package update

* chore: remove j1 from default awg installation

* feat: always offer server reboot after package update

* fix: keep sheets open when the app window loses focus

* chore: sync all languages with the code
2026-11-03 01:23:52 +09:00
vkamnandYaroslav Gurov 3f6ecacff1 fix: cover CVE-2026-98432 (#3372)
Co-authored-by: Yaroslav Gurov <ygurov@proton.me>
2026-11-02 20:56:31 +09:00
vkamn 7f9b7db482 chore: bump version (#3350) 2026-10-29 23:20:34 +09:00
vkamn 27b4feda9c feat: xtun integration 2026-10-29 22:35:18 +09:00
NickVs2015 6c0e62753d chore: update amnezia-xray-bindings to 1.5.0 (#3349) 2026-10-29 22:33:38 +09:00
NickVs2015 da8ce1809b fix: revert local proxy port rotation and logic with port processing (#3347)
* Revert "fix: rotate local proxy port on restart (#3320)"

This reverts commit a55ef420e8.

* fix: check local proxy port availability via service

* chore: update amnezia-xray-bindings
2026-10-29 22:16:26 +09:00
vkamn 9887a0a04c Merge branch 'dev' of github-amnezia:amnezia-vpn/amnezia-client into HEAD 2026-10-29 01:10:05 +09:00
vkamn 94ea5b00aa chore: update icon (#3340)
* feat: new app icon with .icns fallback for older Xcode

* docs: add AGENTS.md and CLAUDE.md
2026-10-29 01:09:51 +09:00
vkamn 688c71e385 Merge branch 'dev' of github-amnezia:amnezia-vpn/amnezia-client into HEAD 2026-10-28 12:55:06 +09:00
yp c18f7773e3 test: remove xray settings ui tests (#3338) 2026-10-27 23:22:32 +09:00
Yaroslav Gurov 6d5f10947a feat(conan): get rid of recipes folder 2026-10-27 15:00:02 +01:00
vkamn 95501dba35 fix: minor fixes (#3330)
* fix: pass deployment target to awg-apple build

Without it clang took the minimum iOS version from the SDK and generated
A12 code. Its LDAPR instructions crash A10/A11 devices with SIGILL.

* chore: add link to amnezia hub

* fix: notification insted of error after onScanServerFinished

* fix: no gap in server tabs for read-only servers

* fix: return Premium and Free features text field

* fix: build site and mirror URLs with the path before UTM tags

* fix: show split tunneling toggle on mobile

* chore: bump version
2026-10-27 19:14:17 +09:00
yp 4cacfb41ab fix: xray settings QA fixes and tests (#3333) 2026-10-27 18:57:05 +09:00
yp 8a51177a44 fix: show locked xray settings page for servers without write access (#3286)
* fix: show locked xray settings page for servers without write access

* reset file
2026-10-27 18:56:47 +09:00
makkaor 3121775a6f fix: preserve imported MTU (#3113) 2026-10-26 11:17:42 +09:00
Yakimov Grigory 3977447d4a feat: add Indonesian (id_ID) localization (#3325) 2026-10-26 00:44:16 +09:00
yp bf95867a7c fix: restore favorite locations (#3309)
* fix: restore favorite locations

* fix per subscription favorites
2026-10-26 00:33:54 +09:00
NickVs2015 a55ef420e8 fix: rotate local proxy port on restart (#3320) 2026-10-26 00:33:21 +09:00
vkamn 3b5a93889f feat: new design system (#3299)
* fix: use text button for local proxy learn more

* feat: pin page header and collapse large title on scroll

* fix: enable page scrolling only when content overflows

* refactor: drop qml focus hacks and simplify list selectors

- remove unused objectNames, dead functions and focus timers
- handle back/escape in FocusController instead of PageStart keys
- declare static menus as items instead of list<QtObject> models
- make radio/segment selection binding-driven, reuseItems opt-in
- fix full access share default server preselection

* refactor: convert config models to Q_PROPERTY and merge MtProto pages
- config models: QObject with properties instead of single-row list models
- protocol/service pages: Flickable layout, write-through edits, no save focus hack
- MtProxy/Telemt settings share PageServiceMtProtoSettingsBase
- question drawer requested via Dialogs singleton

* chore: bump version

* refactor: create rarely shown controls on demand

- focus ring and selection glow create MultiEffect only while visible
- text fields create the context menu, action buttons and attached button on demand
- setup page loads the details sheet content when it opens

* feat: macOS and iOS 26 app icon from Icon Composer

- add images/AppIcon.icon with colour and mono marks
- build the app icon from it on macOS, macOS NE and iOS, require Xcode 26
- drop app.icns and the AppIcon asset catalogs

* feat: update design system changes
- header: centered 18 semibold title in a 56 px row with 48 px buttons, no large title
- hide the back arrow on stack root pages
- subtitle as the first content block, 16 under the header and 24 to the next block
- main toggles as the first content row, desktop only
- logs: share and a more menu instead of three header icons
- countries: 48 px gear, search first under the header, chips to list 24
- sheets: 32 px from title to the first block
- tab bar: 44 px buttons centered with 18 px gaps
- connection key field: Insert while empty, clear button after paste
- error toast: default text color, accent error code link
- 24 px between the last block and sticky buttons

* chore: minor ui fixes

* fix: restore trailing buttons in country rows

* chore: bump version

* chore: build macOS and iOS on macos-26 runners for the Icon Composer app icon

* fix: load only one Go runtime in the UI process
libAmneziaVPN linked libwg-go and libovpn3 (which pulls in the Go-based
libck-ovpn-plugin) without using any of their symbols. With libagw that
made three Go runtimes in the UI process. They conflict over signal
handlers, and the app crashed at startup with SIGSEGV and no tombstone.
Stop linking awg-android and openvpn-pt-android into the app library.
Package their .so files through QT_ANDROID_EXTRA_LIBS instead; the VPN
service processes still load them from Kotlin.

* chore: sync with figma and minor ui fixes

* chore: bump version

* fix: disable Go async preemption on Apple platforms

Build libagw with -X=runtime.godebugDefault=asyncpreemptoff=1 on macOS
and iOS to work around the Go runtime crash on macOS
(golang/go#75887).
2026-10-26 00:32:49 +09:00
NickVs2015 02838a94d5 fix: add new dep to test (#3301) 2026-10-20 10:22:09 +08:00
NickVs2015 9a1200d6f3 fix: build libagw with go 1.27.1 (#3303) 2026-10-20 10:21:53 +08:00
NickVs2015andvkamn ddde43635e feat: local proxy mode (#3166)
* fix: share double-stop guard via VpnProtocol base class

* feat: add local proxy core module

* feat: local proxy settings api

* feat: wire local proxy into app controllers

* feat: local proxy settings ui

* feat: arbitrate shared xray engine ownership via ipc tokens

* fix: remove connection type

* chore: add qthttpserver to desktop ci qt modules

* fix: local proxy port fallback and active port reporting

* fix: keep text field button aligned when error is shown

* fix: hide local proxy for free servers and guard device unlink

* fix: show local proxy state per server

* fix: anchor text field button to content

* fix: adapt local proxy pages to design

* fix: copy logic and port logic

* refactor: move local proxy files to controllers and utils

* refactor: merge local proxy into LocalProxyController

* refactor: reuse gateway config request and keep local proxy state in memory

---------

Co-authored-by: vkamn <vk@amnezia.org>
2026-10-18 21:25:04 +08:00
vkamn ffba1cb2a4 chore: minor ui fixes (#3295)
* fix: sync ds component sizes with updated figma

* fix: hover only on action buttons in list rows, standalone country row
2026-10-17 23:51:22 +08:00
vkamn 30ff3451c7 fix: prepare gateway request (#3291)
* fix: prepare the gateway request once instead of a blocking callback per attempt

* chore: libagw 1.0.8, gateway and failover timeouts 6s, health check 1s
2026-10-16 00:10:29 +08:00
vkamn db951e9928 chore: minor ui fixes (#3290)
* chore: change amnezia hosting description

* fix: ios safe areas and ds component alignment

- extend window into ios safe areas, pass insets to PageController
- use dark interface style and portrait-only orientation on iphone
- drop bottom inset while keyboard is open
- align controls with figma: title-only cards, caption height,
  selectable list items, nav bar spacing, chip hover, switch rows

* fix: news settings icon unread badge

* fix: align ds effects with figma

- three-layer selection glow for switch, radio and connect ring
- connect button disk with glow in all states
- snackbar elevate shadow spread, dropdown panel shadow
- backdrop blur for loading overlay container
- pressed state layer 0.1 for icon buttons, segments, list items, cards

* refactor: remove Qt5Compat.GraphicalEffects
2026-10-15 23:50:51 +08:00
vkamn a36399a4c3 chore: minor ui fixes (#3289) 2026-10-15 12:58:24 +08:00
vkamn 8940f8e273 chore: minor ui fixes (#3288) 2026-10-15 12:13:31 +08:00
NickVs2015 705a373d51 feat: cover test gateway service config import (#3239)
* feature: cover gateway service config import

* fix: use AmneziaApplication in gateway service import test

* feature: cover gateway service update

* fix: drain gateway workers before test teardown
2026-10-14 21:52:29 +08:00
vkamn 3d4a45246a fix: fix missing includes (#3281) 2026-10-14 11:28:24 +08:00
vkamn 11355e1de0 feat: new design system (#3280)
* refactor: focus controller refactoring

* feat: update to new design system

* feat: update to new desing system

* chore: bump version
2026-10-14 11:13:36 +08:00
yp 3e8077f2ca feat: split app/tunnel logs viewer (#3262)
* feat: split app/tunnel log streams and add in-app log viewer

* fix: report real save result on android

* remove dead logging code & open qt log on start, stop ne logging on auto-off, pin log date locale

* drop dead share api and simplify logs ui components

* add ru strings for logs redesign
2026-10-13 22:10:30 +08:00
yp c52b1a50a8 fix: hint xray settings file on main import (#3276) 2026-10-13 21:26:55 +08:00
yp 2c0f169946 fix: location separation texts (#3275) 2026-10-13 21:26:20 +08:00
vkamn 693d00ded5 feat: use libagw (#3028)
* feat: use libagw

* feat: add conanfile for libagw

* chore: fix android build with agw

* refactor: gateway error code parsing

* fix: build fixes

* fix: return proxy cache

* chore: update link to libagw

* fix: libagw 1.0.6, log request trace, persist state synchronously

* chore: fetch libagw as a release archive with sha256 instead of git clone
2026-10-13 21:25:58 +08:00
Yakimov GrigoryandGrigory Yakimov f1af8efb4b feat: add Thai (th_TH) localization (#3253)
* Add Thai language

* Update amneziavpn_th_TH.ts

* Add small test for check languages

---------

Co-authored-by: Grigory Yakimov <GYakimov@alfabank.ru>
2026-10-12 11:50:24 +08:00
NickVs2015 4c2e950864 fix: restore backup from content:// uri on android (#3218) 2026-10-08 23:59:22 +08:00
yp 9017984b1d fix: rework xray settings - split client/server data, unify saving, fix tls (#3006)
* Feat: split xray client and server settings

* remove test logs

* in-place save and TLS pin

* fixed xhttp/mkcp + tls

* remove check version xray in start connect

* address review findings for the settings split

* reset namespace

* reset namespace

* remove template xray

* fix: stop xray defaults from overwriting entered settings

* revert dropdown selection refactor from the defaults fix

* move save 'updateServerConfig'

* remove comment
2026-10-08 23:58:25 +08:00
yp c5ecf6281f feat: location separation (#3181)
* Feat: location separation

* remove temp code

* remove tab filter

* fixed models

* remove settings button in native configs

* reset & fixed crash focus

* derive country list use-case set from listId

* fixed: search field: Esc on empty field -> passed on, page closes

* country list: three levels, split by full catalog

* favorites: keep unstarred row until list refresh

* favorites on configuration files screen

* split country list by visible locations

* hysteresis for region split: split above 15, merge below 13

* section counters ignore search, follow chip

* empty state: suggest switching keyboard layout

* section header: counter in parentheses on collapsed sections only

* country list: scroll-linked large title header

* current section expanded on entry without overwriting saved collapse

* country list: raise scrollbar above pinned overlays, drawer above it

* qml: collapsing header component, config files header, country list parts extracted

* country list: ignore unknown use case ids from catalog

* country list: use case names from catalog (nameLocalized), ui language in model

* country list: collapsed sections kept for the session only, as in the task

* country list: design review fixes

* favorites limit: toast from the mockup with 'show' action

* toast: geometry, typography, shadow and action button from figma
2026-10-08 23:31:05 +08:00
NickVs2015 3e9b70a5f1 feature: bump go toolchain to 1.27.1 (#3238)
* chore: bump go toolchain to 1.27.1

* chore: move go version back into recipe
2026-10-05 09:20:53 +02:00
vkamn 94b51df247 chore: bump version (#3187) 2026-09-18 20:44:38 +08:00
Mezooz de93650a90 fix: make Conan recipes parse on Python < 3.12 (#2870)
Three recipes use f-string syntax that is only valid on Python 3.12+
(PEP 701): reusing the same quote character inside an f-string
expression, and using a backslash inside one.

  recipes/amnezia-xray-bindings/conanfile.py:115
  recipes/tun2socks/conanfile.py:118
  recipes/hev-socks5-tunnel/conanfile.py:63-65

On older interpreters Conan fails to load the recipe with a SyntaxError
before resolving a single dependency, so the build cannot start:

  SyntaxError: unexpected character after line continuation character

This is not platform specific. It is invisible in CI only because
ubuntu-latest ships Python 3.12+. Debian 12 (bookworm), current stable
and the base for Raspberry Pi OS, ships Python 3.11.

Hoist the expressions out of the f-strings, and use single quotes for
the nested string literals. Behaviour is unchanged on every version.

Verified with python3 -m py_compile on Python 3.11.2 (aarch64,
Debian 12): all three fail before this change and pass after.
2026-09-18 13:59:14 +08:00
vkamn 448baad3e1 chore: bump version (#3185)
* chore: bump version

* feat: update translations
2026-09-18 13:52:33 +08:00
vkamn aca1b7dc5c feat: add format version for future config refactoring (#3184) 2026-09-18 13:31:07 +08:00
vkamn de36a81b58 chore: change android aqt host (#3182) 2026-09-17 13:43:35 +08:00
vkamn 76b81b43c1 chore: pin install-qt-action to v4.3.1 (#3180) 2026-09-16 22:24:34 +08:00
MrMirDan bea2f5f7db feat: clickable notification (#3178) 2026-09-16 22:22:51 +08:00
Yaroslav Gurov a4d38b5642 fix: windows certificate signing issues (#3175)
* fix: windows certificate signing issues

* fix: add has_ui option and phys/cloud opts
2026-09-16 22:22:19 +08:00
NickVs2015andMrMirDan b76c88bba3 feat: migrate test to main repo (#3172)
* basic tests  adaptation

* fix: ui servers model and controller test awg config

* fix: platforms test builds

* build dirs inspection

* fix: changed paths for tests and tests artifacts

* fix: 'deploy' parent dir

* windows ctest configuration and macos dependencies inspection

* windows check executable and macos copy openssl libs

* windows test executables check and macos copy openssl

* changed some path on windows

* android apk list

* fix: updated android apk path

* Verify Android test files

* fix: build tests only with AMNEZIA_BUILD_TESTS

* fix: copy openssl runtime next to test_openssl_library

* fix: awg2 test config and inverted description checks

* chore: move run_android_tests.sh to client/tests and drop personal paths

* chore: gate tests by option, scope secrets and drop global concurrency in ci

* chore: serialized vps test job, scoped secrets, backup secret guard, test data lookup

---------

Co-authored-by: MrMirDan <8mirdan8@gmail.com>
2026-09-16 17:05:43 +08:00
vkamn eab14fd957 chore: add define for app update (#3164) 2026-09-14 12:37:58 +08:00
SPTApyo 2a8242d306 feat: add French (fr_FR) localization (#3135)
* feat: add French (fr_FR) localization

* fix: align french catalogue with current telegram link
2026-09-09 21:44:51 +08:00
vkamn e60842bd9d chore: cleanup entitlements (#3149)
* chore: cleanup entitlements for macos ne

* chore: bump version
2026-09-09 21:12:03 +08:00
vkamn 327e5985df chore: bump version (#3120) 2026-09-03 21:02:31 +08:00
MrMirDan 124da5a499 feat: amnezia.host website button (#3102)
* added amnezia.host website button

* added desktop platform check

* check for IsMacOsNeBuild
2026-09-03 19:10:13 +08:00
NickVs2015 2ee02bc893 fix: log purchaseToken on successful Play purchase (#3108) 2026-09-03 14:02:49 +08:00
MrMirDan 398697c101 chore: added utm for amnezia.org website link in app (#3101) 2026-09-02 21:17:37 +08:00
MrMirDan c8810dde5f chore: changed tg.me links to telegram.me (#3111) 2026-09-02 20:02:35 +08:00
Yaroslav Gurov 9a7db3475f fix: adjust awg selfhosted defaults (#3115) 2026-09-02 20:02:02 +08:00
vkamn 628dd5b6d3 chore: bump version (#3103) 2026-08-31 22:52:55 +08:00
vkamn 71b99c799c feat: new update page (#3092) 2026-08-31 20:54:30 +08:00
NickVs2015 0643a2424b fix: fallback to default file picker instead documentsui (#3087) 2026-08-31 20:51:37 +08:00
yp dedfc08cc2 feat: add TProxy (#3034)
* server-side container stack

* core model, enums and install pipeline

* settings UI and setup wizard

* fix workers

* remove debug logs

* address review findings

* fix validate email

* update docker

* remove write port & add default port 443/80
2026-08-31 19:29:48 +08:00
yp dddc181299 feat: server country code l10n (#3069) 2026-08-28 23:10:41 +08:00
vkamn 5689706fd9 fix: various fixes (#3077)
* fix: post install cleanup

* fix: wg show output parsing

* chore: update translations

* fix: finish already expired transactions
2026-08-28 23:09:59 +08:00
5501fbd54e feat: google play iap (#2682)
* Add Google Play Billing Library

* Disable Qt debugger sleep

* Add billing module, provide a separate build for Google Play

* Add a method to detect Google Play build

* Add method to get the list of offers

* Add methods to verify and purchase subscriptions

* refactor: modify response json

* feat: add purchase to UI

* feat: add test purchase android

* fix: merge with new structure, fix payment flow

* fix: build flow for new conan structure

* fix: add build android via Win

* fix: fix multi-ABI filter

* fix: split payment to detect payment type

* fix: add artifact apk

* fix: add check purchase on restore

* fix: release keystore

* fix: copy apk to right path

* fix: separate oss/play build

* fix: simply build AAB

* fix: add custom target for Play billing

* fix: add logs billing

* fix: add support market types, add logs

* fix: revert market field, up android GP version, fix subscription plan parser

* fix: add support getSubscriptionInfo and subscriptions/restore

* fix: update api endpoint and pay logic

* fix: add logs and rename restore func

* fix: add ios logs

* fix: rename restore function, fix icon resource error

* fix: double purchase android

* fix: update Google Play Billing Library to 8.0.0

* fix: prefer free trial subscription offer on Android purchase

Bump APP version to 2137.

* fix: up kotlin version compiler

* fix: sync price for PlayMarket from GP

* fix: add logs for Google Play price merge

* fix: show App Store intro offer discount price in catalog

* feat: add trial support for multi platform, redesign PageSetupWizardApiPremiumInfo

* feat: add logs android

* fix: tighten spacing Change plan and test period tag

* fix: UI text changes

* fix: upgrade existing android subscription and add renew logic

* feat: add support upgrade CP plan without call subscription

* fix: add billing logs for plan

* fix: show upgrade success as notification

* fix: call getSubscriptionInfo/importServiceFromMarket on upgrade instead of skipping

* fix: restore ios prod var

* fix: remove noisy debug logs

* chore: up version code

* fix: getSubscriptionInfo used removed GatewayRequestData after rebase

* fix: aab in sep tasks

* fix: warn before subscription upgrade/downgrade purchase

* chore: add acknowledgePlayPurchase

* refactor: add store purchase controller

* feat: use same acknowledge method as appstore

* fix: IOS add upgrade

* fix: change QML warn message

* refactor: dedupe Play purchase validation and startup billing query

* chore: log purchaseToken through the Android purchase flow

* fix: resolve Android active plan by base plan id

* fix: remove comment

* fix: subscribe to Transaction.updates before Transaction.unfinished

* fix: update days values

* fix: genuine restore failure when another transaction was a duplicate

* fix: remove debug lines and comment

* chore: cleanup logs

---------

Co-authored-by: albexk <albexk@proton.me>
Co-authored-by: vkamn <vk@amnezia.org>
2026-08-28 11:24:38 +08:00
NickVs2015 fc4bf3eb2b chore: bump android version code to 2157 (#3074) 2026-08-28 11:23:05 +08:00
Дневник UNIX'оида c8722c619a chore: added StartupWMClass line to the Desktop Entry (#2968) 2026-08-27 23:18:31 +08:00
HugoFiermein 4c5bb29ab0 fix: fixed wgshow parsing (#3046) 2026-08-27 23:05:51 +08:00
Yaroslav Gurov 4976828914 fix: do not force warning loglevel on Android (#3070) 2026-08-27 16:41:46 +02:00
Zak 5d74b2cbcf fix: preserve app signature and scope launchd socket (#3062)
* fix(macos): preserve signed service plist resource

* fix(macos): bind service socket to loopback
2026-08-27 22:33:28 +08:00
Yaroslav Gurov 7072661244 chore: update xray (#3012)
* chore: update xray

* chore: update xray on mobiles
2026-08-24 16:19:52 +02:00
vkamn 7d4f3e0f50 fix: various fixes (#3015)
* fix: fixed ios brandings

* chore: bump version

* chore: update translations

* fix: fixed ios awg3.1 parser

* chore: bump version

* fix: remove awg 3.1 params from native config if disbaled

* chore: bump version

* chore: remove comment
2026-08-21 22:43:01 +08:00
NickVs2015andvkamn b1a37b3779 feat: add brandings (#2839)
* feat: move amnezia hardcode from sources to cmake

* feat: move amnezia hardcode from sources to cmake

* refactor: remove prem v1 migration

* chore: move more branding

* fix: use host-matching architecture for iOS simulator builds

x86_64 was hardcoded; Apple Silicon Macs run arm64 simulators and Xcode 26
has no Rosetta simulator destinations, so simulators showed as unsupported.

* fix: mark the branded media assets catalog as a bundle resource

MACOSX_PACKAGE_LOCATION was set on the upstream Media.xcassets path while
target_sources uses CLIENT_IOS_MEDIA_ASSETS_PATH, so a branded catalog was
never compiled by actool and the app got a blank icon.

* fix: parametrize the Swift app-group identifier used by Log.swift

Log.swift hardcoded Amnezia's own app-group instead of the branded one,
since Swift -D flags can't carry the string value like the ObjC++ side
does. Generate a small Swift constants file instead, same pattern as
version.h.in, wired into all four targets that compile Log.swift.

* fix: use APPLICATION_NAME instead of hardcoded Amnezia in log line format

Every log line printed "Amnezia" regardless of branding; the log file name
two lines above this already used APPLICATION_NAME correctly.

* fix: restore branding fixes dropped by rebase, rename swiftInterop to swiftBridge

* fix: move more branding variables to cmake

* feat: move macOS branding from sources to cmake

- macos/app/Info.plist.in: app group, camera usage text, UTI ids and
  descriptions now come from CLIENT_APPLICATION_NAME / BUILD_* variables,
  mirroring ios/app/Info.plist.in
- macos/networkextension/Info.plist.in: bundle names and app group ids are
  templated; the plist is configured by CMake into the binary dir because
  Xcode only expands its own $(...) settings
- new knobs: CLIENT_MACOS_MEDIA_ASSETS_PATH, CLIENT_MACOS_APP_ICNS_PATH,
  CLIENT_MACOS_PROVISIONING_PROFILE_SPECIFIER(_DEBUG),
  CLIENT_MACOS_NE_PROVISIONING_PROFILE_SPECIFIER(_DEBUG)

* fix: resolve macOS pf template paths relative to the client source dir

CMAKE_SOURCE_DIR points at the wrapper project when the client is built as a
subproject, so the pf template lookup failed there.

* chore: separate brandings defaults

---------

Co-authored-by: vkamn <vk@amnezia.org>
2026-08-18 20:41:45 +08:00
vkamn 86ae77e3d0 fix: treat the “off” toggle as a “missing” parameter (#3003) 2026-08-18 17:42:38 +08:00
vkamn 541a6e07d6 fix: return qml translations (#3002) 2026-08-18 16:48:56 +08:00
f135400d3b chore: update translations (#2999)
* chore: update translations

* feat: add Korean translation (#2971)

* update(i18n): add Korean translation

* fix: add full QML catalog for Korean

---------

Co-authored-by: ParkSnoopy <ParkSnoopy@users.noreply.github.com>

* feat: add Spanish translation (#2035)

* feat: add spanish translation

* feat: add spanish translations to client

* fix: fix grammar

---------

Co-authored-by: vkamn <vk@amnezia.org>

* chore: update es and kr translations

---------

Co-authored-by: ParkSnoopy <117149837+ParkSnoopy@users.noreply.github.com>
Co-authored-by: ParkSnoopy <ParkSnoopy@users.noreply.github.com>
Co-authored-by: Stageddat <121111148+Stageddat@users.noreply.github.com>
2026-08-18 15:17:29 +08:00
Kushida da184c0ddf fix: config import parsing and VPN route edge cases (#2820)
* fix: harden config import parsing

* fix: handle vpn route edge cases
2026-08-17 18:22:01 +08:00
vkamn 4116c5c4bc refactor: now iap and test purchase flags ships from backend (#2995) 2026-08-17 13:46:47 +08:00
yp 667d98f7d7 fix: remove dead code & save config (#2975) 2026-08-14 13:56:44 +08:00
vkamn 44c10b39e3 feat: awg3.1 support (#2984)
* feat: add awg3.1 support

* fix: add warning for big native awg qr codes

* fix: show default subnet address if not exist in server config

* fix: use range keep alive only with awg3 params

* chore: update awg go versions in conan

* chore: update awg-go version
2026-08-14 13:55:56 +08:00
vkamn e4b7e09f86 feat: add distribution filed to api calls (#2983)
* feat: add distribution filed to api calls

* chore: remove debug log
2026-08-14 13:55:40 +08:00
NickVs2015 04c2b2af33 chore: bump android version code to 2148 (#2977) 2026-08-14 13:04:10 +08:00
NickVs2015 e643fa008c fix: ipc input validation (#2852)
* fix: resolve critical IPC security vulnerabilities

- Validate IP/CIDR values from IPC before passing to Linux firewall
- Replace shell interpolation with direct execve in firewall update functions
- Block dangerous OpenVPN/WireGuard arguments in sanitizeArguments()
- Add programId bounds check in IpcServerProcess::setProgram()
- Add SO_PEERCRED peer authentication for IPC connections on Linux

* fix: extend IPC security validation to macOS firewall

* fix: suppress linux firewall errors and add missing 400.allowPIA anchor

* fix: review changes

* fix: review changes next

* fix: remove UID check from IPC server

* fix: IPC security review fixes

* fix: address IPC review fixes
2026-08-13 14:24:54 +08:00
vkamn b575df05c7 fix: fixed adding subnet to ip split tunnel (#2973) 2026-08-11 00:19:42 +08:00
vkamn 85bd102efa fix: return vcredist to windows bundle (#2949) 2026-08-11 00:18:21 +08:00
Маэстро автоматизации 717323f138 fix: restore ios condition for paste menu item to avoid clipboard permission prompt (#2955) 2026-08-10 18:46:55 +08:00
vkamn 8ed7a5a1d3 fix: android icons (#2953) 2026-08-10 18:44:49 +08:00
NickVs2015 6ece4e0ac5 chore: bump android version code to 2144 (#2961) 2026-08-10 12:10:52 +08:00
vkamn 9d45f3d7ad feat: add long country code support (#2969) 2026-08-10 12:10:16 +08:00
MrMirDan dcf53b989e chore: update ru translations (#2928)
* update translation RU

* fix: some text fixes
2026-08-07 00:14:27 +08:00
vkamn e27f74e4fc chore: add warning on home page (#2948) 2026-08-06 22:41:20 +08:00
vkamn dbe1a06e35 feat: pass uuid, appversion, osversion, app language to all gateway requests (#2944) 2026-08-06 22:08:34 +08:00
NickVs2015andvkamn d251d5f0ac chore: add Android armv7/arm64-v8a build on Qt 6.10.1 (#2892)
* chore: add Android armv7/arm64-v8a build on Qt 6.10.1

* chore: split Qt 6.10.1/6.10.3 Android AAB by min/max SDK range

* chore: bump version to 2141

* chore: drop upper SDK bound on Android 11+ AAB

* fix: stage android package source snapshot after libxray.aar is copied in

* chore: align Build-Android APK/AAB versionCode and naming to android11+

* chore: add x86/x86_64 APK builds to Qt 6.10.1 Android job

* chore: simplify android deploy workflow

* chore: add Qt 6.10.3 android9-10 APK build as fallback

---------

Co-authored-by: vkamn <vk@amnezia.org>
2026-08-06 20:34:00 +08:00
yp d702dc0b2a fix: various fixes for Telemt, XRay (VLESS), Captcha (#2903)
* fix worker & fix captha

* fixed read config (xxd) snapshot

* remove comment

* fix snapshot

* fixed xray save

* move subtitleText -> hint (Xray)

* xray config apply via reinstall

* apply server config via container reinstall

* transport compatibility and xray-core v26 config

* seed reality defaults on fresh deploy

* server scripts for xray-core v26 (keys, udp, image)

* placeholder defaults and hint tooltip control

* wire placeholders and hints into settings pages

* gate flow and security by transport in UI

* encode raw tg link in QR

* remove comment

* restore telegram-proxy transport mode and domain on server re-scan

* remove drop SessionKey, add edit

* fixed xray/mtproxy/telemt
2026-08-06 13:44:00 +08:00
vkamn 2ad6721061 feat: awg3 support selfhosted (#2908)
* chore: bump version

* feat: add awg3 support to selfhosted

* chore: remove HeaderProtectionKey from ui

* fix: fixed regexp in configure_container.sh for awg

* chore: return server protocol version to config

* fix: fixed native wg obfuscation

* fix: fixed range validator for awg text field

* feat: add warning for awg 1/2

* fix: remove warning from other protocols
2026-08-06 10:54:26 +08:00
vkamnandAlexei 0d116bfc67 fix: use native NSStatusItem for the macOS tray menu (#2759) (#2941)
* fix: use native NSStatusItem for the macOS tray menu (#2759)

On macOS 14+ the status-item menu is tracked out of process, so Qt's
QCocoaSystemTrayIcon menu-tracking observer (installed by setContextMenu)
fires asynchronously and calls emitActivated(), which reads
-[NSEvent clickCount] when NSApp.currentEvent is no longer a mouse event.
clickCount then raises NSInternalInconsistencyException, crashing the app
the first time the tray menu is opened.

Stop using QSystemTrayIcon on macOS and own the NSStatusItem ourselves
(MacOSStatusIcon), attaching the menu's backing native NSMenu via
QMenu::toNSMenu(). AppKit shows the menu natively - with menu-bar highlight
and correct anchoring - without registering the crashing observer, and Qt
keeps the NSMenu in sync with the QActions so the existing menu logic
(enable/disable, translations) is reused. The icon stays colored per state
and notifications go through UNUserNotificationCenter. Windows and Linux
keep QSystemTrayIcon unchanged.

This also wires up the previously-unused MacOSStatusIcon and removes the
orphaned neNotificationHandler.h.

* chore: return error messages

---------

Co-authored-by: Alexei <alexei.selivanov@gmail.com>
2026-08-06 00:13:05 +08:00
romanio427andromanio427 25a18bdf97 fix: avoid reentrant DNS flush while resolving site routes (#2930)
Rebase onto dev after #2811 (multi-IP site routes). Keep multi-IP
resolution and addVpnSite(QStringList), but stop calling
waitForFinished() from QHostInfo callbacks: that nested event loop
re-entered the same callback path until stack overflow (0xc00000fd).

Track outstanding lookups and flush DNS once asynchronously via
QRemoteObjectPendingCallWatcher when any new routes were installed.
Capture gw/ip by value for the async routeAddList call.

Co-authored-by: romanio427 <romanio427@users.noreply.github.com>
2026-08-06 00:02:29 +08:00
aiamnezia f73697d3f4 fix: enhance split tunneling IP handling (#2811)
- Refactored `VpnConnection` and `IpSplitTunnelingController` to support multiple IPs per site, improving the handling of split tunneling configurations.
- Adjusted methods to utilize `QStringList` for IP addresses, ensuring better management of site IPs.
- Enhanced the `SecureAppSettingsRepository` to normalize and manage IP lists effectively.
- Updated UI models to reflect changes in data structure for sites with multiple IPs.
2026-08-05 21:20:36 +08:00
cd-amn 53121f20a3 fix: OpenVPN binary crashes on connection (#2861)
* fix: set proper rpath's for openvpn on linux

* feat: run compilation on linux in max number of threads using deploy script

* feat: replace runpath for prebuilt openvpn

* fix: avoid double-installing of Qt libraries on linux

* fix: set proper rpath's for openvpn on macos

* fix: no DNS routes on Windows in blacklist split-tunnelling with OpenVPN
2026-08-05 21:18:53 +08:00
NickVs2015 d6cb9b930f chore: bump android version to 2141 (#2922) 2026-08-05 12:30:53 +08:00
vkamn c4b3ccacc9 refactor: ios qt6.9 support (#2916)
* chore: remove configs from ios logs

* fix: fix scrolling on user list

* fix: fixed container installation after adding a new server

* refactor: qt6.9.3 support for ios
2026-08-05 12:30:02 +08:00
yp e38a233904 fix: fix link RemoteObjects for linux (#2884) 2026-07-31 14:27:50 +08:00
Yaroslav Gurov 9b0495f5e1 fix: proper linking of openssl and other libraries on linux (#2910) 2026-07-31 10:18:20 +08:00
NickVs2015andYaroslav Gurov 30ec46a567 fix: openvpn runtime futex error (#2894)
* fix: pin go/1.23.12 for openvpn-pt-android to avoid android/arm crash

* chore: add fixme annotation

---------

Co-authored-by: Yaroslav Gurov <ygurov@proton.me>
2026-07-29 21:21:15 +08:00
NickVs2015 4055e1b05e fix: amnezia-libxray apply patch to all release (#2885)
* fix: amnezia-libxray apply patch to all releases

* chore: bump version to 2138
2026-07-29 21:20:42 +08:00
vkamn 4d28f81965 fix: set timeout for MarketplaceUpdateController 2026-07-26 15:20:53 +08:00
vkamn 5c035bb6cf chore: bump version 2026-07-25 23:38:25 +08:00
NickVs2015 26c22327af fix: netlink message lookup and buffer size 2026-07-25 19:31:37 +08:00
vkamn 5e9def4184 feat: add awg3 support 2026-07-25 19:29:54 +08:00
yp a98c60d967 feat: add update dialog on mobile platforms (#2867)
* add force update

* add native UI & remove func force update
2026-07-25 19:29:24 +08:00
vkamn 0faf3e6d2f fix: pass keepalive from config to uapi 2026-07-25 00:34:38 +08:00
NickVs2015 a32a26bb67 fix: add 16kb page size support to amnezia-libxray android build (#2865) 2026-07-23 20:02:52 +08:00
vkamn 431ece7fff chore: update links in readme (#2860) 2026-07-23 19:24:15 +08:00
vkamn 5e82c6a558 fix: set macos keychain path (#2858) 2026-07-22 20:46:52 +08:00
vkamn 84a2d13b68 fix: various fixes (#2856)
* fix: fixed endless preparing

* fix: remove update drawer when open news
2026-07-22 00:25:37 +08:00
vkamn 324b09cca3 fix: various fixes (#2850)
* fix: return macos ne icon

* fix: return default sni to googletagmanager

* fix: context menu did not appear on ios
2026-07-21 21:37:13 +08:00
vkamn e70563a071 chore: update links in readme (#2855) 2026-07-21 19:12:38 +08:00
Yaroslav Gurov bc2a0ca649 fix: copy PF files to debug directory (#2849) 2026-07-20 16:37:59 +08:00
Yaroslav Gurov 3c6ac431b4 chore: update awg (#2845)
* chore: update awg

* chore: update xray

* chore: update awg-apple checksum

* chore: update awg-windows checksum
2026-07-20 15:38:02 +08:00
Yaroslav Gurov e96a2b171c fix: get rid of empty i1-i5 params (#2846) 2026-07-20 10:44:07 +08:00
vkamn 06d219b92b chore: update xcode version in deploy.yml (#2838) 2026-07-16 23:22:22 +08:00
yp 28c77e570b fix: captcha keyboard overlap (#2827) 2026-07-15 14:11:44 +08:00
yp 6691d2e21c feat: add captha to update service (#2817)
* Feat: add Captha update service

* fixed fill captchaInfo from response
2026-07-15 14:11:27 +08:00
vkamn c7b5ee1867 chore: minor fixes (#2833)
* fix: always reinstall xray after settings changes

* chore: bump version

* fix: return blocking clear profile
2026-07-15 14:09:35 +08:00
vkamn e4127f47f3 chore: merge with upstream (#2826)
* feat: add cryptoUtils

* feat: move protocol selection to home page

* feat: add connection warmup
2026-07-13 14:26:00 +08:00
NickVs2015 4b4563818e fix: app icon IOS not appearing after installation (#2822) 2026-07-13 12:59:32 +08:00
communism420 dbb43272e6 chore: fix typo in traffic obfuscation protocols list (#2823) 2026-07-13 12:46:07 +08:00
yyy-amneziaandYaroslav Gurov 5e70eb20c9 feat: build macOS prebuilts for arm64 and x86_64 (#2601)
* Build macOS prebuilts for arm64 and x86_64

* chore: remove parallel thingy from CI/CD

* feat: rework amnezia-xray-bindings for multiarch

* Fix macOS universal recipe builds

* Sign macOS OpenVPN helper script

* Address macOS build review comments

* Isolate awg-go universal builds

* Disable Xcode signing for non-NE macOS

* Address remaining macOS recipe review comments

* feat(conan): rework go-based recipes to support Apple's multiarch

* fix(conan): amnezia-xray-bindings naming conventions

* chore(ci/cd): specify macos versions explicitly

* fix(conan): use escaped path for make in windows

* fix(ci/cd): checkout prior using of provisioning profiles

---------

Co-authored-by: Yaroslav Gurov <ygurov@proton.me>
2026-07-09 13:37:46 +08:00
NickVs2015 15176cd3ae chore: up GP version code (#2819) 2026-07-09 13:33:52 +08:00
NickVs2015 25df36ad73 fix: filepicker atv dev (#2763)
* fix: support filepicker android 9

* fix: double call filepicker

* fix: remove double connectionUiControllerProtected
2026-07-08 17:34:45 +08:00
MrMirDan ea8e3fda56 chore: base client test dependency (#2790) 2026-07-08 13:58:57 +08:00
ypandvkamn 31ae949ba0 fix: UI Telemt|MTProxy QA fixed (#2734)
* fixed UI 'Transport mode' 'Share QR Code'

* fix FakeTLS domain input & port space & workers

* fix Public host|Port|Promoted tag|FakeTLS domain|Internal/External IP

* fixed diagnostic mtproxy/telemt

* fixed SshSession parent

* fixed timeout & add message & fix disabled telemt|mtproxy

* fixed telemt=mtproxy algoritm

* fixed add/delete additional secret

* fix Additional secret

* remove comment

* fixed mtproxy update secret

* checking the parallelism of lines

* remove old code & & ref code

* chore: minor codestyle fixes

* chore: minor codestyle fixes

---------

Co-authored-by: vkamn <vk@amnezia.org>
2026-07-08 13:50:13 +08:00
NickVs2015 a17847a90b fix: add connectionUiControllerProtected accessor for tests (#2809) 2026-07-07 20:14:45 +08:00
cd-amn 2ca497cd06 fix: openvpn and openssl conan install (#2799) 2026-07-07 17:01:07 +08:00
vkamn bd003b149d chore: updates from proxy-storage-cache branch (#2773)
* chore: updates from proxy-storage-cache branch

* fix: fixed tap controller paths
2026-07-06 14:47:32 +08:00
NickVs2015 35c1014a44 chore: up version code and compatibility with checks (#2806)
* chore: up version code

* fix: add compatibility with checks
2026-07-06 14:42:02 +08:00
NickVs2015 27857cde8a fix: error 3rdparty and compile (#2789)
* fix: add binary dir to add_subdirectory calls in 3rdparty.cmake

* fix: use list(APPEND LIBS) instead of target_link_libraries for gamepad on Android

* fix: add core skippltgormController
2026-07-06 13:25:06 +08:00
ULTRAVIOLENC3 b39f583097 fix: create DNS WFP sublayer for app split tunneling (#2768) 2026-07-02 20:15:30 +08:00
ULTRAVIOLENC3 6c7b65cac6 fix windows app split tunnel path conversion (#2691) 2026-07-02 20:12:52 +08:00
vkamn 0f6847219b chore: bump version (#2772) 2026-06-26 13:04:36 +08:00
yp 5d16645b84 fix: android icons (#2725)
* update icons android

* remove comment
2026-06-24 00:08:21 +08:00
Yaroslav Gurov 203a092dc9 fix: blobs for macos-ne and codesigning of qt blobs (#2754) 2026-06-24 00:07:42 +08:00
yp d8b8590bc4 fix: XRay validation audit (#2749)
* flow default and config fixes

* host/SNI/path validation backend + flow-default flag

* input validation, numeric limits and live Save on settings pages

* MinMaxRowType clamping + DropDownType fit-content drawer
2026-06-24 00:07:26 +08:00
ypandvkamn 9b8bfaa6f8 fix: regression testing vs 4.8.15.4 (#2730)
* fixed revoke

* fixed async update xray/mtproxy/telemt

* fixed connect premium config

* fixed autostart app hide

* fixed clear profile

* (6) fixed xtls-rprx-vision→empty

* (7) fixed appendClient abort & fix restore admin

* (8) fixed async|clientsUpdated

* fixed increment name server N

* remove comment & reset file

* chore: add tr to nextAvailableServerName

---------

Co-authored-by: vkamn <vk@amnezia.org>
2026-06-23 23:05:58 +08:00
Yaroslav Gurov 890103a16a fix: update amneziawg (#2743)
* chore(conan): update amneziawg

* fix(conan): use cmake 4.2+ to support MSVC26

* fix(ci/cd): use the latest cmake generator available on windows
2026-06-17 19:56:53 +07:00
yp 56ab82f87f fix: Use shared OpenSSL on Android (#2736) 2026-06-16 10:57:32 +07:00
lunardunno 3984acbb44 feat: updating install_docker.sh script (#2661)
* Updating install_docker.sh script

Implementing a Docker service status check.
The Docker reinstall step has been removed due to the implementation of Docker service checking.
Implementing locale checking and assignment.
Implementation of execution of some actions through commands with sudo, to reduce delays caused by differences in the values ​​of the PATH variable for the root user and the user included in the sudo group.
Implementation of a verification step for the install containerization app to avoid installing unsupported podman-docker applications.

* adding message handling to install controller

Adding handling for "Containerization app is not supported" and "Service status not active" messages to the controller.

* Error Codes added

Error Codes added for ServerContainerizationNotSupported & DockerServiceNotActive

* Adding extended descriptions of new errors

* fix last line in errorCodes.h

* fix last line in errorStrings.cpp

* Changing the names of errors

* various changes in the script

The messages output for processing by the server controller have been changed: "Container runtime is not supported" and "Container runtime service is not running."
The redundant check and output of the "Packet manager not found" message, as well as the interruption of script execution, have been eliminated, as this situation is handled by the server controller at an earlier stage (check_server_is_busy.sh) and only there.
Added installation of the whish package if it is missing from the OS, for subsequent re-execution of the install_docker.sh and check_server_is_busy.sh scripts.
Implemented an alternative method for detecting the package manager if the whish package is initially missing from the OS.
The algorithm for setting the $pm variable (package manager) has been changed.

* processed phrases have been changed

The phrases processed by the server controller have been changed.

* Attempting to use "command -v"

Switching to using "command -v" instead of "which".

* "which" as main, "command" as backup.

* "which" as main, "command" as backup for check user

* which  LOCK_CMD with sudo

Run the "which" with sudo to check the $LOCK_CMD variable in case the user's PATH variable has incorrect values ​​if the user is not root and is only a member of the sudo group.

* suppressing sudo password prompt

* suppressing sudo password prompt

* suppressing sudo password prompt install_docker.sh

* Changing the phrase for check stdout

"sudo:" with "not found" instead of "command not found"

* Changing phrases for check stdout check_user_in_sudo.sh‎

* sudo|docker and not found, in one line

* check only sudoers
2026-06-15 22:28:38 +07:00
yp cc404378f9 fix: remove only amnezia- prefixed docker volumes (#2728) 2026-06-15 13:12:19 +07:00
ypandvkamn 594635e5cf fix: script remove docker volume (#2686)
* move sudo docker volume rm -f

* fix: remove unnecessary function

---------

Co-authored-by: vkamn <vk@amnezia.org>
2026-06-04 22:58:39 +08:00
vkamn f9b106cf5b fix: various fixes (#2693)
* fix: fixed country model update

* fix: fixed context menu crush on ios

* fix: fixed passphrase dialog freeze

* fix: fixed country switch

* fix: fixed start minimized

* fix: fixed black screen after remove container

* refactor: return cloak and ss only for view

* fix: fixed default server change after improt while connected

* fix: divider visibility

* fix: fixed revoke admin user

* fix: fixed language restore after backup

* fix: link hover for tor settings page

* fix: fixed openvpn connecntion status

* fix: fixed free color status

* fix: fixed client config update

* chore: bump version
2026-06-04 22:45:53 +08:00
yp a9861d18b7 fix: wrong index on xray pages (#2669)
* test crash xray

* fixed save config xray

* reset file

* fixed text port & reset file

* fixed textFieldWithHeaderType.textField
2026-06-01 12:22:54 +08:00
lunardunno c14138f031 fix: deleting volumes when cleaning the server (#2673)
* Deleting volumes when cleaning the server

* force the remove volumes
2026-06-01 11:54:34 +08:00
yyy-amneziaandYaroslav Gurov 60686fde24 fix: link OpenVPNAdapter statically (#2645)
* fix(ios): link OpenVPNAdapter statically

* chore(conan): simplify openvpnadapter merge process and make everything via XCrun

---------

Co-authored-by: Yaroslav Gurov <ygurov@proton.me>
2026-05-30 13:59:35 +08:00
Yaroslav Gurov bd0747296e fix: networkextension proper framework linking (#2668) 2026-05-28 23:09:49 +08:00
Yaroslav Gurov ba61019a50 fix: enable bundled openssl for every platform except NE-based ones (#2660)
* fix: enable bundled openssl for every platform except NE-based ones

* fix(conan): trigger CI/CD on crutial cmake changes

* fix: install dylibs/dlls from conan and use proper RPATH

* fix: adjust windows runtime deps
2026-05-28 19:17:27 +08:00
vkamn 113f967006 fix: various fixes (#2664)
* fix: fixed nextAvailableServerName

* fix: fixed password request for ssh key
2026-05-28 15:14:04 +08:00
ypandvkamn bcee58b08b feat: add captcha (#2508)
* test capcha

* add test AMNEZIA_GATEWAY_PLAINTEXT_MOCK

* ref

* remove first QNetworkReply::NoError

* fixed macros

* fixed http code

* add test server

* fix cmake

* add CAPTCHA refreshed

* fixed captcha

* update QML Captha

* fixed crash app & up vercion & fix qml captha

* ver 4.9.0.1

* remove m_gatewayCaptchaStickyBase & outEffectiveRequestBase

* reset code PR

* remove mock & temp var AMNEZIA_LOCAL_GATEWAY

* ref code & remove AMNEZIA_LOCAL_GATEWAY

* remove check httpStatusCode & error

* add 408 status code

* fix update captca

* remove fallback на transport

* chore: add loader after captcha solved

* chore: remove logs from api utils

* chore: minor fixes

---------

Co-authored-by: vkamn <vk@amnezia.org>
2026-05-28 13:51:26 +08:00
MrMirDanandvkamn 52de1acebf refactoring: move tests to separate repo (#2550)
* fix: AUTOMOC and AUTOUIC added

* update: native exports test

* update: export test

* update: vless serialization/deserialization test added

* update: language model and controller test

* update: sites UiController and Model test

* update: sites test

* update: app ui model and controller test

* update: allowed dns ui model and controller test

* update: env vars and removed some lines

* update: news ui model and controller test (incomplete)

* update: api services ui model and controller test (incompleted)

* update: job for tests (Linux)

* update: job for tests (Windows)

* update: proper artifact names

* update: added envs

* update: added 'get sources' and changed steps order

* update: tests jobs remake

* update: 'get sources' step and windows shell

* update: using ctest

* search for exe files

* changed path to run tests

* update: 'Build' step

* update: changed path to deploy qt dependencies

* update: dependencies only for tests executables

* update: ctest dir

* update: include ctest

* update: set dir for tests exe

* update: qt path

* update: serialization test

* update: removed api tests from cmake

* update: changed tests dir

* added ctest to client cmake

* update: installing msvc and additional checks

* removed mcvs install

* update: path to ssh.dll

* fixed issue with ssh path

* update: removed unneccessary step and line

* update: linux job step 'Run tests'

* update: linux 'Install dependencies'

* update: modified qtest include

* update: changed QVERIFY to QVERIFY2

* update: some qverify2 messages

* update: linux additional dependencies

* update: offscreen for linux tests

* update: MacOS tests job

* update: Android tests job

* update: rewrited env's, qtest include and clear clients in some tests

* update: added local vars file for tests

* proper path for some vars

* some fixes due merge

* update: windows tests deploy

* python and conan installation to tests jobs

* chore: minor fixes after merge with dev

* chore: move selfhosted admin tests to separate folder

* refactor: some rename

* chore: fixes after merge

* refactor: moved tests to separate repo

* refactor: remove tests from core controller

* chore: add more protected getters to core controller

* chore: add more protected getters

* chore: remove ctest

* chore: return xray model default values

---------

Co-authored-by: vkamn <vk@amnezia.org>
2026-05-28 12:31:27 +08:00
ypandvkamn 027a12a1df fix: extended VLESS configuration (#2643)
* fixed vless

* fixed default var

* fixed save button

* remove comment

* fix: fixed header link in xray settings page

---------

Co-authored-by: vkamn <vk@amnezia.org>
2026-05-28 12:21:46 +08:00
ypandvkamn 0a659a2d74 fix: various fixes for MTProxy & Telemt (#2653)
* fix color & fix enabled

* fixed remove base secret

* fix mtproxy/telemt 'base secret'

* fixed button back

* fixed loader

* fixed reload loader

* fixed dd secret

* fixed qml

* fix: fixed header link in mtproxy/telemt page

---------

Co-authored-by: vkamn <vk@amnezia.org>
2026-05-28 11:46:26 +08:00
vkamn 6f119cd083 fix: various fixes (#2662)
* fix: fixed dns processing

* fix: fixed proceesed index/id selection

* refactor: stop using the server index as state

* fix: fixed autostart and start minimized

* fix: fixed typo

* fix: add socks5 extractConfigFromContainer

* fix: remove unused currentContainerUpdated

* fix: fixed clear cached profile order
2026-05-28 10:57:08 +08:00
Yaroslav Gurov 1753aed3fc fix: use shared openssl on Android (#2657)
* feat(conan): clone openssl and patch it for Android

* fix(conan): build shared libssl for Android
2026-05-26 21:59:47 +08:00
Yaroslav Gurov c714d98bd1 chore: extend prebuilts support for MacOS NE by clang 21+ (#2633)
* chore: extend prebuilts support for MacOS NE by clang 21+

* chore: trigger prebuilts on workflow file changes
2026-05-25 22:05:56 +08:00
vkamn 4787f3915b chore: defines for update controller (#2634) 2026-05-21 20:40:04 +08:00
Yaroslav Gurov 7a383116b2 fix: force os.sdk to empty on Darwin (#2632) 2026-05-21 18:56:53 +08:00
Yaroslav Gurov d3de5f0f48 fix(conan): openvpn support in MSVC+Ninja setup (#2616) 2026-05-21 18:09:52 +08:00
vkamn 8749d683e3 chore: minor fixes (#2630) 2026-05-21 11:38:41 +08:00
vkamn 9de9d082bc chore: bump version (#2629) 2026-05-21 10:41:25 +08:00
Yaroslav Gurov a4233fef41 fix: add ssh init and finalize for statically-linked libssh (#2627) 2026-05-21 10:19:08 +08:00
Yaroslav Gurov 4890dd1d74 chore: compare changes against base branch of the PR (#2626) 2026-05-20 21:26:41 +08:00
Yaroslav Gurov 564630827e сhore: apple ci cd macos versions (#2625)
* chore(ci/cd): use macos-26 for xcode>26.4

* chore(ci/cd): bump conan version

* chore(conan): remove redundant VirtualBuildEnv
2026-05-20 21:19:56 +08:00
Yaroslav Gurov fbe15d965b chore: bump apple hev-socks5-tunnel dep (#2624)
* chore(conan): bump hev-socks5-tunnel

* chore(conan): bump xcode-versions

* chore(conan): upload prebuilts only in case of pushing to dev
2026-05-20 20:31:35 +08:00
vkamn b29515c380 chore: rename artifacts (#2622) 2026-05-20 19:07:30 +08:00
vkamn 0658a8f565 revert: regional country codes UI (#2567) (#2621) 2026-05-20 13:55:28 +08:00
vkamn 482ec04b4a chore: bump version (#2620)
* chore: bump version

* chore: bump android qt version
2026-05-20 12:37:38 +08:00
vkamn d40d24fcf9 fix: fixed validateAndPrepareConfig for non admin configs (#2617)
* fix: fixed validateAndPrepareConfig for non admin configs

* fix: fix fetchGatewayUrl lambda context
2026-05-20 12:37:22 +08:00
ypandvkamn fb5666057b feat: add extended vless configuration (#2566)
* update UI XRay, add new page PageProtocolXrayTransportSettings.qml PageProtocolXrayXmuxSettings.qml PageProtocolXrayXPaddingSettings.qml

* add UI PageProtocolXrayConfigsSettings, PageProtocolXrayFlowSettings, PageProtocolXraySecuritySettings

* add Xray-specific keys

* add vars xray model

* add new qml padding, update model

* update model and export

* rename file & update name class & update list xray

* fixed ui

* add save file in temp

* remove debug macros

* fixed build windows

* fix path Windows

* remove save config

* fixed changes

* fixed conf

* fixed UI

* fixed size & button save

* fixed build iOS

* fix: fixed headers base control

---------

Co-authored-by: vkamn <vk@amnezia.org>
2026-05-18 22:35:01 +08:00
ypandvkamn a49892c7e7 feat: add telemt container (#2435)
* Feat: Add MtProxy (Telegram)

* add path files

* Feat: Add Telemt (MtProxy)

* fixed secret & enum

* remove old path

* refactor: move logic from ui to core

---------

Co-authored-by: vkamn <vk@amnezia.org>
2026-05-18 20:01:09 +08:00
ypandvkamn 277b295fd8 feat: add mtproxy(#2370)
* Feat: Add MtProxy (Telegram)

* add path files

* refactor: move logic from ui to core

---------

Co-authored-by: vkamn <vk@amnezia.org>
2026-05-18 19:52:58 +08:00
lunardunno 8c33779fc3 chore: Install recommends for apt (#2596) 2026-05-18 13:56:57 +08:00
lunardunno f0299ca9fe chore: authentication prompt in Ubuntu 26.04 (#2603)
Handling the password prompt in Ubuntu 26.04
2026-05-18 11:55:07 +08:00
MrMirDanandMitternacht822 c7b1c2809f fix: app buttons clicked instead of buttons in context menu (#2200)
* fix: app buttons clicked instead of buttons in context menu

* update: using MouseArea instead of changing popupType

* fix(cursor): fixed cursor type at opened context menu

---------

Co-authored-by: Mitternacht822 <sb@amnezia.org>
2026-05-15 21:02:09 +08:00
MrMirDan c9ed0baf3b fix: app freezes when revoke awg/wg client during active connection (#2211)
* block configs revoke during connection

* update: check that current config is active

* update: notification text
2026-05-15 21:01:39 +08:00
ypandvkamn 2a3e3126ac feat: regional country codes (#2567)
Co-authored-by: vkamn <vk@amnezia.org>
2026-05-15 15:44:58 +08:00
MrMirDan 98771027b7 fix: vless switch between dividers (#2600) 2026-05-15 14:58:23 +08:00
MrMirDan 0433e03bdc fix: amnezia free card button hovers when card enabled (#2602) 2026-05-15 14:58:11 +08:00
ypandvkamn cb48667b91 fix: bug when saving after canceling the save action (#2568)
Co-authored-by: vkamn <vk@amnezia.org>
2026-05-15 14:57:44 +08:00
ypandvkamn d0a1af0381 refactor: deactivate api config before remove (#2569)
Co-authored-by: vkamn <vk@amnezia.org>
2026-05-15 14:56:09 +08:00
Yaroslav Gurov fd0c773918 fix: change artifact names (#2589) 2026-05-15 12:36:38 +08:00
vkamn 06372c8fd7 refactor: remove serverConfig struct (#2595)
* refactor: remove serverConfig struct

* refactor: add warnings for api v1 configs

* refactor: moved the server type definition to a separate namespace

* refactor: simplified gateway stacks

* fix: fixed server description

* fix: fixed postAsync reply usage

* fix: fixed validateConfig call

* fix: fixed server name in notifications

* fix: fixed initPrepareConfigHandler for lagacy configs
2026-05-15 12:33:36 +08:00
Yaroslav GurovandNickVs2015 009ca981d5 feat: initial conan support and build process refactoring (#2260)
* feat: initial conan support

* feat: add awg-go and awg-apple recipes

* feat: macos full feature conan build, except ss and cloak

* feat: conan android initial support

* fix: android libssh fixes

* conan: android additional recipes and fixes

* feat: openvpn add support android

* fix: awg android connection establish

* conan: apple full-featured support

* chore: bump min macos version

* chore: get rid of manual deploy recursive copying

* conan: beautify makefile-based recipes

* conan: add geosite.dat and geoip.dat

* conan: use lib linking instead of QT_EXTRA_LIBS for OVPN

* conan: address lack of SONAME of libck-ovpn-plugin.so correctly

* conan: windows initial support

* conan: make awg-windows and wintun be interpret as exes

* conan: fix version for v2ray-rules-dat

* feat: conan and platform bootstrap rework in cmake

* feat: 16kb support for Android

* chore(conan): recipes cleanup

* feat: support of drivers for windows

* feat: support full-featured cmake install

* chore: exclude qtkeychain from the target build

* fix: install for apple systems

* fix: provide flags for cloak plugin for openvpn-pt-android

* chore: bump android deps for 16kb support

* feat(conan): patch cloak to properly provide env for golang

* chore: remove redundant hint from conan find

* feat: linux <-> conan features

* feat: linux initial packaging support

* feat: linux cpack support

* feat: cpack windows full-featured build

* feat: productbuild cpack support

* feat: rework CI/CD for macos

* feat: rework CI/CD for Linux

* fix: libncap automake args

* fix: CI/CD correct QT paths

* fix: windows rework CI/CD

* fix: windows artifact upload

* chore: remove MacOS-old from build targets

* feat: add conan to all mobile and NE builds

* feat: support default amnezia conan remote

* fix: use Release instead of release on Android

* feat: get rid of 3rd-prebuilt

* feat: conan CI/CD upload

* fix: CI/CD change windows toolset versions

* fix: remove MSVC version from CI/CD

* feat: conan CI/CD add Release and Debug build types

* feat: add multiple xcode versions for conan CI/CD

* fix: correct conan CI/CD clang versions

* feat: separate prebuilt baking, and add some for NE

* feat: rework keychain on ios/macos even more

* fix: add desktop Qt for iOS

* feat: add QT_HOST_PATH to build.sh

* fix: add deploy definition to cmake

* fix: android adjustments for toolchains and CI/CD

* fix: add needs for Android CI/CD

* fix: Android CI/CD use android-28

* fix: modernize translations, and CI/CD fixes

* fix: gradle min sdk compilation error

* fix: CI/CD add installers to all jobs

* fix: parse android platform more precisely

* fix: adjust aab path in CI/CD

* feat: CI/CD do not execute artifact build if there is nothing changed

* fix: CI/CD use common jobs even if previous were failed

* fix: Apple CI/CD use set-key-partition-list for keychains

* fix: Apple CI/CD do not specify any keychain (use default)

* fix: build aab as a different step in build script

* chore: beautify build.sh script

* feat: CI/CD build separate APKs per ABI

* fix: Android CI/CD upload artifact in separate steps

* chore: recipes cleanup

* feat: add hints for conan on MacOS

* fix: add main.cpp and tests back to CMakeLists.txt

* chore: xrayProtocol codestyle changes

* fix: openssl set proper X509 request version

* fix: make openvpn protocol rely only on client while configuring

* chore: get rid of old scripts

* chore: readme update describing build process more precisely

* feat: windows build script add multiprocessing capabilities

* chore: bump Qt version in README

* feat: add generator option and use Ninja by default in CI/CD for linux/macos

---------

Co-authored-by: NickVs2015 <nv@amnezia.org>
2026-05-04 22:59:24 +08:00
cd-amn c0cae0ff01 fix: outbound freedom for xray (#2479)
* fix: outbound freedom for xray on linux

* fix: outbound freedom for xray on macOS

* build: auto-generate pf rules based on the build type
2026-05-04 19:39:07 +08:00
c28452a5da feat: desktop updater (#825)
* added changelog drawer

* Created a scaffold for Linux installation

* implement Linux updating

* Add debug logs about installer in service

* Add client side of installation logic for Windows and MacOS

* Add service side of installation logic for Windows

* ru readme

* Update README_RU.md

* Add files via upload

* chore: added clang-format config files (#1293)

* Update README_RU.md

* Update README.md

* feature: added subscription expiration date for premium v2 (#1261)

* feature: added subscription expiration date for premium v2

* feature: added a check for the presence of the “services” field in the response body of the getServicesList() function

* feature: added prohibition to change location when connection is active

* bugfix: renamed public_key->end_date to public_key->expires_at according to the changes on the backend

* feature/xray user management (#972)

* feature: implement client management functionality for Xray

---------

Co-authored-by: aiamnezia <ai@amnezia.org>
Co-authored-by: vladimir.kuznetsov <nethiuswork@gmail.com>

* Fix formatting

* Add some logs

* Add logs from installattion shell on Windows

* Fix installation for Windows and MacOS

* Optimized code

* Move installer running to client side for Ubuntu

* Move installer launch logic to client side for Windows

* Clean service code

* Add linux_install script to resources

* Add logs for UpdateController

* Add draft for MacOS installation

* Disable updates checking for Android and iOS

* chore: fixed macos update script

* chore: remove duplicate lines

* chore: post merge fixes

* chore: add missing ifdef

* decrease version for testing

* chore: added changelog text processing depend on OS

* add .vscode to .gitignore

* Change updater downloading method to retrieving link from the gateway

* add Release date file creation to s3 deploy script

* Add release date downloading from endpoint

* update check refactoring

* feat: switch macOS auto-update from DMG to ZIP+PKG installer

- Update macOS artifact URL from .dmg to .zip
- Rewrite mac_installer.sh to extract ZIP and install PKG via osascript
- Increase download timeout to 30s for larger ZIP files

* fix: fix Android build

* feat: Change get request for updater link to post

* refactor: preparing NewsModel for update notifications

- Changed `updateModel` to `setNewsList` for better semantic meaning.
- Delegate model container updating to private method updateModel
- Updated the logic for marking news as read to use item IDs instead of a boolean flag.

* feat: Move update notification in news list

- Updated `UpdateController` to handle empty release dates in header text.
- Added `getVersion` method to `UpdateController` for version retrieval.
- Enhanced `NewsModel` to support update notifications with new methods for marking updates as skipped and setting update notifications.
- Updated QML pages to display update information and provide actions for updates and skipping them.
- Introduced `isUpdate` property in `NewsItem` to differentiate between regular news and updates.

* feat: Implement rate limit workaround for gateway requests

- Added a delay before contacting the gateway in both `UpdateController` and `ApiNewsController` to prevent rate limit issues caused by simultaneous requests.

* refactor: Convert synchronous network requests to asynchronous in UpdateController

- Updated `UpdateController` to use asynchronous network requests for fetching gateway URL, version info, changelog, and release date.
- Introduced `doGetAsync` method to handle asynchronous GET requests with error handling.
- Removed synchronous methods to improve responsiveness and prevent blocking the UI during network operations.
- Added a mechanism to prevent multiple concurrent update checks.

* chore: Decrease AmneziaVPN version to 4.8.10.0 in CMakeLists.txt for testing

* refactor: Improve update check handling to avoid rate limit issues

- Updated `CoreController` to initiate update checks after news fetching is complete.
- Removed synchronous waiting in `ApiNewsController` to streamline the fetching process.

* fix: fixed typo in IsReadRole

* fix: fix updater filenames

* chore: move updateController to core

* refactor: update to mvvm

* chore: tiny fix

---------

Co-authored-by: aiamnezia <ai@amnezia.org>
Co-authored-by: aiamnezia <ai@amnezia.com>
Co-authored-by: Pokamest Nikak <pokamest@gmail.com>
Co-authored-by: KsZnak <ksu@amnezia.org>
Co-authored-by: Cyril Anisimov <cyan84@gmail.com>
Co-authored-by: vkamn <vk@amnezia.org>
2026-05-04 12:37:19 +08:00
vkamn 396ce23228 fix: fixed xray config parsing in xrayprotocol (#2557) 2026-05-02 12:25:07 +08:00
vkamn b05ee0a654 chore: return missing code after merge with mmvm (#2553) 2026-05-01 20:50:24 +08:00
vkamn fd5051262d fix: fixed typo (#2542) 2026-04-30 15:46:15 +08:00
vkamn 847bb6923b refactor: refactor the application to the mvvm architecture (#2009)
* refactor: move business logic from servers model

* refactor: move containersModel initialization

* refactor: added protocol ui controller and removed settings class from protocols model

* refactor: moved cli management to separate controller

* refactor: moved app split to separate controller

* refactor: moved site split to separate controller

* refactor: moved allowed dns to separate controller

* refactor: moved language logic to separate ui controller

* refactor: removed Settings from devices model

* refactor: moved configs and services api logit to separate core controller

* refactor: added a layer with a repository between the storage and controllers

* refactor: use child parent system instead of smart pointers for controllers and models initialization

* refactor: moved install functions from server controller to install controller

* refactor: install controller refactoring

* chore: renamed exportController to exportUiController

* refactor: separate export controller

* refactor: removed VpnConfigurationsController

* chore: renamed ServerController to SshSession

* refactor: replaced ServerController to SshSession

* chore: moved qml controllers to separate folder

* chore: include fixes

* chore: moved utils from core root to core/utils

* chore: include fixes

* chore: rename core/utils files to camelCase foramt

* chore: include fixes

* chore: moved some utils to api and selfhosted folders

* chore: include fixes

* chore: remove unused file

* chore: moved serialization folder to core/utils

* chore: include fixes

* chore: moved some files from client root to core/utils

* chore: include fixes

* chore: moved ui utils to ui/utils folder

* chore: include fixes

* chore: move utils from root to ui/utils

* chore: include fixes

* chore: moved configurators to core/configurators

* chore: include fixes

* refactor: moved iap logic from ui controller to core

* refactor: moved remaining core logic from ApiConfigsController to SubscriptionController

* chore: rename apiNewsController to apiNewsUiController

* refactor: moved core logic from news ui controller to core

* chore: renamed apiConfigsController to subscriptionUiController

* chore: include fixes

* refactor: merge ApiSettingsController with SubscriptionUiController

* chore: moved ui selfhosted controllers to separate folder

* chore: include fixes

* chore: rename connectionController to connectiomUiController

* refactor: moved core logic from connectionUiController

* chore: rename settingsController to settingsUiController

* refactor: move core logic from settingsUiController

* refactor: moved core controller signal/slot connections to separate class

* fix: newsController fixes after refactoring

* chore: rename model to camelCase

* chore: include fixes

* chore: remove unused code

* chore: move selfhosted core to separate folder

* chore: include fixes

* chore: rename importController to importUiController

* refactor: move core logic from importUiController

* chore: minor fixes

* chore: remove prem v1 migration

* refactor: remove openvpn over cloak and openvpn over shadowsocks

* refactor: removed protocolsForContainer function

* refactor: add core models

* refactor: replace json with c++ structs for server config

* refactor: move getDnsPair to ServerConfigUtils

* feat: add admin selfhosted config export test

* feat: add multi import test

* refactor: use coreController for tests

* feat: add few simple tests

* chore: qrepos in all core controllers

* feat: add test for settings

* refactor: remove repo dependency from configurators

* chore: moved protocols to core folder

* chore: include fixes

* refactor: moved containersDefs, defs, apiDefs, protocolsDefs to different places

* chore: include fixes

* chore: build fixes

* chore: build fixes

* refactor: remove q repo and interface repo

* feat: add test for ui servers model and controller

* chore: renamed to camelCase

* chore: include fixes

* refactor: moved core logic from sites ui controller

* fix: fixed api config processing

* fix: fixed processed server index processing

* refactor: protocol models now use c++ structs instead of json configs

* refactor: servers model now use c++ struct instead of json config

* fix: fixed default server index processing

* fix: fix logs init

* fix: fix secure settings load keys

* chore: build fixes

* fix: fixed clear settings

* fix: fixed restore backup

* fix: sshSession usage

* fix: fixed export functions signatures

* fix: return missing part from buildContainerWorker

* fix: fixed server description on page home

* refactor: add container config helpers functions

* refactor: c++ structs instead of json

* chore: add dns protocol config struct

* refactor: move config utils functions to config structs

* feat: add test for selfhosted server setup

* refactor: separate resources.qrc

* fix: fixed server rename

* chore: return nameOverriddenByUser

* fix: build fixes

* fix: fixed models init

* refactor: cleanup models usage

* fix: fixed models init

* chore: cleanup connections and functions signatures

* chore: cleanup updateModel calls

* feat: added cache to servers repo

* chore: cleanup unused functions

* chore: ssxray processing

* chore: remove transportProtoWithDefault and portWithDefault functions

* chore: removed proto types any and l2tp

* refactor: moved some constants

* fix: fixed native configs export

* refactor: remove json from processConfigWith functions

* fix: fixed processed server index usage

* fix: qml warning fixes

* chore: merge fixes

* chore: update tests

* fix: fixed xray config processing

* fix: fixed split tunneling processing

* chore: rename sites controllers and model

* chore: rename fixes

* chore: minor fixes

* chore: remove ability to load backup from "file with connection settings" button

* fix: fixed api device revoke

* fix: remove full model update when renaming a user

* fix: fixed premium/free server rename

* fix: fixed selfhosted new server install

* fix: fixed updateContainer function

* fix: fixed revoke for external premium configs

* feat: add native configs qr processing

* chore: codestyle fixes

* fix: fixed admin config create

* chore: again remove ability to load backup from "file with connection settings" button

* chore: minor fixes

* fix: fixed variables initialization

* fix: fixed qml imports

* fix: minor fixes

* fix: fix vpnConnection function calls

* feat: add buckup error handling

* fix: fixed admin config revok

* fix: fixed selfhosted awg installation

* fix: ad visability

* feat: add empty check for primary dns

* chore: minor fixes
2026-04-30 14:53:03 +08:00
vkamn 2edd7de413 chore: minor fixes (#2524)
* fix: fixed i5 empty check

* fix: add check config format in extractConfigFromQr
2026-04-27 13:18:50 +08:00
vkamn f0da2b003f feat: add fallback proxy endpoint (#2518) 2026-04-23 21:30:18 +08:00
vkamn 650c1c6ebb chore: bump version (#2502) 2026-04-20 20:32:59 +08:00
vkamn 8dbded1624 chore: remove ip from tunnel name for ios (#2489) 2026-04-17 15:02:54 +08:00
vkamn cebfcc846e feat: add renewal for external-premium (#2485)
* feat: add renewal for external-premium

* chore: bump version

* chore: send subscription status for renewal link request
2026-04-17 15:01:24 +08:00
vkamn 4c18ceaa50 chore: minor fixes (#2477) 2026-04-14 16:27:46 +08:00
NickVs2015 ebe3a5dac6 fix: add linux reconnection (#2415)
* fix: add linux reconnection

* fix: Dbus error, fix race conditional

* fix: improve reeconnection

* fix: add dns load/unload

* feat:  catch  state changed via  check gateway

* revert: restore linuxfirewall.cpp

* fix: restore reconnect time

* fix: add   NM_STATE_DISABLED and  check getGatewayAndIface more carefully

* fix: reconnect

* fix: revert wireguardutilslinux

* fix: revert
2026-04-14 11:10:41 +08:00
ypandYaumenau Pavel 92deee5f67 fix: tun2socks auth settings (#2456)
* add parser auth/pass & fix port

* fix generateRandomHex

* remove hardcore port ios

* add generated random port

* fix sin6_port

* fixed inbound

* add error message

* add std::runtime_error & fixed random generator

* remove loop

---------

Co-authored-by: Yaumenau Pavel <yaumenau.pavel@planetvpn.dev>
2026-04-13 20:06:08 +08:00
lunardunno a75bd0cf5e fix: set a fixed 3proxy ver 0.9.5 (#2468) 2026-04-13 12:27:45 +08:00
vkamn 46f5b3894b chore: minor fixes (#2459)
* fix: fixed links on page with service description

* fix: fixed subscription text color

* chore: update ru translations

* chore: add save button

* fix: ru translation fixes
2026-04-10 22:24:00 +08:00
Mitternacht822 493ee22883 chore: block vless toggle while active connection (#2318)
* fix: prevent disabled SwitcherType from toggling via keyboard

* fix: disabled vless option toggle while connection is active
2026-04-08 12:45:51 +08:00
yyy-amneziaandvkamn ad14847eb5 fix: ios ovpn fix (#2360)
* feat: enhance OpenVPN support and configuration handling for iOS and macOS platforms

* Deps updated

* Deps updated

* feat: add OpenVPN configuration validation and regeneration logic to VpnConfigurationsController

* revert: restore pre-fix OpenVPN NE flow

* chore: add OpenVPN NE payload diagnostics

* Revert "revert: restore pre-fix OpenVPN NE flow"

This reverts commit ae99cc77e9.

* chore: remove openvpn config processing

---------

Co-authored-by: vkamn <vk@amnezia.org>
2026-04-08 12:37:52 +08:00
lunardunno cd50e0b8a5 fix: full server cleanup (#2446)
* Fix: full server cleanup

* Cleaning by REPOSITORY:TAG
2026-04-08 12:27:06 +08:00
vkamnandspectrum 78f504e35c feat: new services description (#2412)
* feat: iap for apple now use storekit2

* fix: fixed error 101 on connection event

* feat: enhance StoreKit2Helper to handle entitlements and improve restore service from App Store functionality

* chore: add isInAppPurchase and isTestPurchase in primary config

* refactor: use end_date from primary config for renew ui

* fix: hide renew button for free

* fix: hide renew button for appstore purchases

* feat: add new premium info page

* feat: add new free info page

* chore: minor fixes

* refactor: move plan and benefits into separate models

* fix: fixed expired status when configs without an end date

* feat: add trial api support

* chore: add api message parsing for 422 error

* feat: move privacy policy and term of use to gateway

* feat: add iap support for new premium info page

* chore: minor fixes

* chore: minor fix

* chore: minor fixes

* feat: additional parsing for storekit subscription plans

* chore: minor codestyle fixes

* chore: simplify benefits

* chore: hide extend buttons on external premium

* feat: add trial error processing

* fix: remove wrong check from tiral handler

* chore: cleanup

---------

Co-authored-by: spectrum <yyy@amnezia.org>
2026-04-08 12:21:12 +08:00
NickVs2015 bf3d11e5c4 feat: renewal new status logic (#2409)
* fix: renewal add status logic

* fix: wakeup activity resumed android
2026-03-25 19:48:32 +08:00
NickVs2015 9a0222aee3 fix: ui fixes for renewal subscription (#2406) 2026-03-25 12:34:42 +08:00
NickVs2015 f0f0f7c5be feat: add subscription renewal (#2389)
* feat: add renewal subsribe

* fix: after review
2026-03-24 22:45:02 +08:00
NickVs2015 36b1a863bf fix: black screen resume / pause (#2400) 2026-03-24 22:13:31 +08:00
yyy-amnezia 4103c5bbcf refactor: extract and simplify OpenVPN reachability and network change handling logic (#2402) 2026-03-24 22:12:59 +08:00
vkamn fa69da6d56 chore: send app version in services request (#2403) 2026-03-24 20:25:04 +08:00
yyy-amnezia aaf2c9ddeb feat: add Xray split tunnel support for iOS PacketTunnelProvider (#2332) 2026-03-24 16:07:36 +08:00
Mitternacht822 dbbc7119ec feat: add warning info for ssh keys (#2252)
* fix: fixed da typo

* feat: added warning about available ssh keys info
2026-03-24 16:06:40 +08:00
vkamn c57162c4cc feat: add base amnezia trial support (#2366)
* feat: add base amnezia trial support

* feat: add external-trial
2026-03-24 10:29:51 +08:00
NickVs2015 40e39895c9 fix openfile deadlock (#2373) 2026-03-21 11:46:46 +08:00
vkamn ec3ab2a03c chore: update licnese file (#2376) 2026-03-20 21:04:13 +08:00
yyy-amnezia ddecfcad26 fix: apple platform network switch fix (#2359)
* Apple platform network switch fix

* macos_ne exclusion fixed
2026-03-20 20:51:36 +08:00
NickVs2015 67bd880cdf fix: swap buffers error (#2347) 2026-03-16 13:03:20 +08:00
vkamn 477afb9d85 chore: bump version (#2336) 2026-03-10 22:22:37 +08:00
NickVs2015 f969fcdbb8 fix: restore dpad functionality ATV (#2335) 2026-03-10 22:19:55 +08:00
vkamn b0ca16d861 chore: bump version (#2331) 2026-03-09 18:29:56 +08:00
NickVs2015 9963359948 fix: disable gamepad for GP (#2321) 2026-03-09 17:39:50 +08:00
vkamn ca639d293d chore: bump version (#2319) 2026-03-06 23:11:03 +08:00
NickVs2015 83d045af64 fix: GP requrements (#2312) 2026-03-06 17:05:16 +08:00
NickVs2015 aea8ff4961 fix: add handle handleContextCreationFailure (#2309) 2026-03-03 22:04:45 +08:00
vkamn 1892db4375 fix: remove nested qeventloop from isConfigValid (also rename to validateConfig) (#2305)
* fix: remove nested qeventloop from isConfigValid (also rename to validateConfig)

* chore: bump version
2026-03-03 20:58:32 +08:00
NickVs2015 c86a641e05 fix: add suppord android 9 gamepad and remote control (#2302) 2026-03-03 15:14:51 +08:00
vkamn befb2bf19a chore: bump version (#2295) 2026-02-27 23:33:37 +08:00
vkamn 7ad6bc340c chore: add translations for ru (#2285)
* chore: add translations for ru

* chore: text fixes
2026-02-27 20:00:31 +08:00
vkamnandNickVs2015 9164e38c34 fix: restore backup android (#2291)
* fix: fixed restore backup on android

* chore: add resume helper for android

* chore: add ResumeHelper.runWhenActive call after all native android dialogs

* fix: add permission for tv file picker

* fix: add file picker handler in kotlin

---------

Co-authored-by: NickVs2015 <nv@amnezia.org>
2026-02-27 18:43:36 +08:00
vkamn 8f7559f01b chore: revert PR #2222 (#2290) 2026-02-27 14:29:25 +08:00
vkamn af56200735 fix: fixed adding s3 s4 when updating the server conf for awg lagacy (#2289) 2026-02-27 14:11:40 +08:00
vkamn 3874050fae fix: again fixed s3, s4 ranges (#2288) 2026-02-27 13:37:49 +08:00
vkamn 3087163e34 fix: fixed s3, s4 ranges (#2283) 2026-02-26 22:31:41 +08:00
Mitternacht822 1fa152845c fix: generate native awg config as qr series (#2221) 2026-02-26 22:31:18 +08:00
vkamn 50e23ef233 fix: awg config update (#2281)
* fix: fixed client config update for awg container

* chore: bump version
2026-02-26 22:12:58 +08:00
Yaroslav Gurov ea648466de chore: remove redundant VpnConnection usage from SitesController (#2278) 2026-02-26 17:55:08 +08:00
Yaroslav Gurov b782775016 fix: change event looping to mutexes for settings and secureqsettings (#2270) 2026-02-26 11:41:08 +08:00
NickVs2015 89a7fe1081 fix: fixed remote control for ATV (#2277) 2026-02-26 11:40:16 +08:00
Yaroslav Gurov e8bb096025 fix: ios wrong awg blob (#2272) 2026-02-24 17:56:17 +07:00
Mitternacht822 fd5c7c8322 fix: copy LICENSE to build as LICENSE.txt for WiX CPack (#2265)
* fix(installer): copy LICENSE to build as LICENSE.txt for WiX CPack

* fix: fixed a typo

* fix: fixed a typo
2026-02-24 14:07:48 +08:00
Yaroslav Gurov e798d0f503 feat: update amneziawg-android dependencies (#2269) 2026-02-24 00:54:55 +08:00
Yaroslav Gurov bbb0abb596 feat: update xray (#2267) 2026-02-24 00:27:29 +08:00
vkamn 0925aec86a chore: bump version (#2264) 2026-02-23 18:01:59 +08:00
Yaroslav Gurov b084c4c284 fix: ios connection status stuck (#2263) 2026-02-23 18:00:13 +08:00
vkamn 87288ebccd chore: bump version (#2262) 2026-02-23 17:16:24 +08:00
vkamn fcd7eadf4c chore: bump version (#2261) 2026-02-23 15:38:27 +08:00
Mitternacht822 0373338fb7 fix: randomized baseUrls traversal order in GatewayController::getProxyUrls (#2247) 2026-02-23 15:33:35 +08:00
Yaroslav Gurov 42f070fe9d fix: handle Android disconnected status properly (#2255) 2026-02-23 15:31:15 +08:00
1211 changed files with 160489 additions and 89129 deletions

No files matched your search

+1 -1
View File
@@ -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"
@@ -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"
+23
View File
@@ -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}
+1482 -365
View File
File diff suppressed because it is too large. Load diff
+5 -4
View File
@@ -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 }}
+3
View File
@@ -10,6 +10,8 @@ deploy/build_64/*
winbuild*.bat
.cache/
.vscode/
.venv/
.cursor*
# Qt-es
@@ -143,3 +145,4 @@ macos-with-sign-build.sh
DeveloperIdApplicationCertificate.p12
DeveloperIdInstallerCertificate.p12
gwenv.sh
+4 -10
View File
@@ -4,17 +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
+219
View File
@@ -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.
+6
View File
@@ -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
+28 -77
View File
@@ -1,104 +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.13.1)
include(cmake/conan_bootstrap.cmake)
set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES ${CMAKE_SOURCE_DIR}/cmake/conan_provider.cmake)
if(APPLE)
get_property(generator_is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if (generator_is_multi_config)
set(CONAN_INSTALL_BUILD_CONFIGURATIONS Release Debug MinSizeRel RelWithDebInfo)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
set(CMAKE_OSX_DEPLOYMENT_TARGET "14.0" CACHE STRING "" FORCE)
set(CMAKE_OSX_ARCHITECTURES "arm64" CACHE STRING "" FORCE)
elseif(MACOS_NE)
set(CONAN_INSTALL_ARGS "--build=missing;-o=&:macos_ne=True" CACHE STRING "" FORCE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "13.0" CACHE STRING "" FORCE)
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
else()
set(CMAKE_OSX_DEPLOYMENT_TARGET "13.0" CACHE STRING "" FORCE)
set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "" FORCE)
endif()
if(NOT AMNEZIAVPN_VERSION)
set(AMNEZIAVPN_VERSION 5.2.0.1 CACHE STRING "Client app version")
endif()
if(ANDROID)
set(CONAN_INSTALL_ARGS
"--build=missing"
"-o=*:page_16k=True"
"-e=*:LDFLAGS=-Wl,-z,max-page-size=16384"
CACHE STRING "" FORCE)
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 2107)
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)
add_subdirectory(client)
if(NOT IOS AND NOT ANDROID AND NOT MACOS_NE)
add_subdirectory(service)
include(${CMAKE_SOURCE_DIR}/deploy/installer/config.cmake)
endif()
set(AMNEZIA_STAGE_DIR "${CMAKE_BINARY_DIR}/stage")
if(WIN32 AND NOT IOS AND NOT ANDROID AND NOT MACOS_NE)
file(TO_CMAKE_PATH "${AMNEZIA_STAGE_DIR}" AMNEZIA_STAGE_DIR_CMAKE)
set(CPACK_GENERATOR "WIX")
set(CPACK_WIX_VERSION 4)
set(CPACK_PACKAGE_NAME "AmneziaVPN")
set(CPACK_PACKAGE_VENDOR "AmneziaVPN")
set(CPACK_PACKAGE_VERSION ${AMNEZIAVPN_VERSION})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "AmneziaVPN client")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "AmneziaVPN")
set(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}")
set(CPACK_PACKAGE_EXECUTABLES "AmneziaVPN" "AmneziaVPN")
set(CPACK_WIX_UPGRADE_GUID "{2D55AC62-96D6-4692-8C05-0D85BBF95485}")
set(CPACK_WIX_PRODUCT_ICON "${CMAKE_SOURCE_DIR}/client/images/app.ico")
# WiX patches
set(_AMNEZIA_WIX_PATCH_SERVICE "${CMAKE_SOURCE_DIR}/deploy/installer/wix/service_install_patch.xml")
set(_AMNEZIA_WIX_PATCH_CLOSE_APP "${CMAKE_SOURCE_DIR}/deploy/installer/wix/close_client_patch.xml")
file(TO_CMAKE_PATH "${_AMNEZIA_WIX_PATCH_SERVICE}" _AMNEZIA_WIX_PATCH_SERVICE_CMAKE)
file(TO_CMAKE_PATH "${_AMNEZIA_WIX_PATCH_CLOSE_APP}" _AMNEZIA_WIX_PATCH_CLOSE_APP_CMAKE)
set(CPACK_WIX_PATCH_FILE "${_AMNEZIA_WIX_PATCH_SERVICE_CMAKE};${_AMNEZIA_WIX_PATCH_CLOSE_APP_CMAKE}")
# WiX v4 Util extension for CloseApplication + namespace for util
set(CPACK_WIX_EXTENSIONS "${CPACK_WIX_EXTENSIONS};WixToolset.Util.wixext")
set(CPACK_WIX_CUSTOM_XMLNS "util=http://wixtoolset.org/schemas/v4/wxs/util")
set(CPACK_INSTALLED_DIRECTORIES "${AMNEZIA_STAGE_DIR_CMAKE};/")
include(CPack)
if ((LINUX AND NOT ANDROID) OR (APPLE AND NOT IOS AND NOT MACOS_NE) OR (WIN32))
include(${CMAKE_SOURCE_DIR}/cmake/CPack.cmake)
endif()
+86 -97
View File
@@ -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
View File
@@ -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)
## Лицензия
+149
View File
@@ -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
+151 -85
View File
@@ -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,80 +25,95 @@ 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()
# 16KB page size support for Android 15+ / Google Play
# Must be set before any targets are defined so it applies to all compiled-from-source libraries
if(ANDROID)
add_link_options("-Wl,-z,max-page-size=16384")
endif()
qt_add_executable(${PROJECT} MANUAL_FINALIZATION)
target_include_directories(${PROJECT} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)
target_compile_definitions(${PROJECT} PRIVATE
CLIENT_KEYCHAIN_NAME_STR=\"${CLIENT_KEYCHAIN_NAME}\"
)
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)
qt_add_repc_replicas(${PROJECT} ${CMAKE_CURRENT_LIST_DIR}/../ipc/ipc_process_interface.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
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}
)
file(GLOB_RECURSE AMNEZIAVPN_TS_SOURCES *.qrc *.cpp *.h *.ui)
# -- 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()
qt_create_translation(AMNEZIAVPN_QM_FILES ${AMNEZIAVPN_TS_SOURCES} ${AMNEZIAVPN_TS_FILES})
file(GLOB_RECURSE AMNEZIAVPN_QML_FILES ${CMAKE_CURRENT_LIST_DIR}/ui/qml/*.qml)
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})
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)
qt6_add_translations(${PROJECT}
TS_FILES ${AMNEZIAVPN_TS_FILES}
SOURCES ${AMNEZIAVPN_QML_FILES}
RESOURCE_PREFIX "/translations"
)
# -- i18n end
set(IS_CI ${CI})
@@ -111,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")
@@ -127,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(
@@ -159,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))
@@ -190,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)
@@ -200,31 +232,9 @@ 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
)
endif()
target_sources(${PROJECT} PRIVATE ${SOURCES} ${HEADERS} ${RESOURCES} ${QRC} ${I18NQRC})
@@ -237,3 +247,59 @@ if(COMMAND qt_finalize_executable)
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>
@@ -15,17 +15,27 @@
#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
bool AmneziaApplication::m_forceQuit = false;
@@ -54,7 +64,7 @@ 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);
}
@@ -98,7 +108,7 @@ 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) {
@@ -109,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);
@@ -122,13 +153,23 @@ 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);
@@ -143,15 +184,9 @@ void AmneziaApplication::init()
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(m_optAutostart))
@@ -197,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());
@@ -217,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()
@@ -252,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);
@@ -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()))
@@ -51,7 +53,7 @@ public slots:
private:
static bool m_forceQuit;
QQmlApplicationEngine *m_engine {};
std::shared_ptr<Settings> m_settings;
SecureQSettings* m_settings;
QScopedPointer<CoreController> m_coreController;
+2 -28
View File
@@ -153,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"
-18
View File
@@ -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"))
}
-21
View File
@@ -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
+96 -23
View File
@@ -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)
-18
View File
@@ -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
}
}
+5 -1
View File
@@ -1,6 +1,7 @@
[versions]
agp = "8.6.1"
kotlin = "1.9.24"
kotlin = "2.1.0"
android-billing = "8.0.0"
androidx-core = "1.13.1"
androidx-activity = "1.9.1"
androidx-annotation = "1.8.2"
@@ -12,8 +13,10 @@ 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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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;
}
}
@@ -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, protect: (Int) -> Boolean) {
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()
}
}
}
@@ -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)
} */
}
@@ -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,33 +38,12 @@ 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, protect: (Int) -> Boolean)
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)
}
}
protected fun ProtocolConfig.Builder.configAppSplitTunneling(config: JSONObject) {
val splitTunnelType = config.optInt("appSplitTunnelType")
if (splitTunnelType == SPLIT_TUNNEL_DISABLE) return
@@ -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

+16
View File
@@ -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>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#0E0E11</color>
</resources>
+1 -1
View File
@@ -1,6 +1,6 @@
<?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>
+4 -16
View File
@@ -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 }
}
}
@@ -37,12 +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
@@ -55,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
@@ -75,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() {
@@ -87,13 +90,17 @@ 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()) {
@@ -115,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")
@@ -180,7 +181,6 @@ class AmneziaActivity : QtActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Log.d(TAG, "Create Amnezia activity")
loadLibs()
// Configure window for edge-to-edge display
configureWindowForEdgeToEdge()
@@ -196,17 +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"
).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() {
@@ -267,6 +267,7 @@ class AmneziaActivity : QtActivity() {
hasWindowFocus = false
// Cancel all pending operations when activity stops
resumeHandler.removeCallbacksAndMessages(null)
openFileDeliveryScheduled = false
Log.d(TAG, "Stop Amnezia activity")
doUnbindService()
mainScope.launch {
@@ -280,43 +281,55 @@ class AmneziaActivity : QtActivity() {
super.onWindowFocusChanged(hasFocus)
hasWindowFocus = hasFocus
Log.d(TAG, "Window focus changed: hasFocus=$hasFocus")
// Cancel pending operations if window loses focus
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 deviceId = event.deviceId
val keyCode = event.keyCode
val pressed = event.action == KeyEvent.ACTION_DOWN
val source = event.source
if (deviceId < 0 && pressed) {
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,
KeyEvent.KEYCODE_DPAD_CENTER -> {
nativeGamepadKeyEvent(0, keyCode, true)
nativeGamepadKeyEvent(0, keyCode, false)
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
}
}
}
// Real gamepad events (deviceId >= 0)
if (deviceId >= 0) {
val isGamepad = (source and InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD
val isJoystick = (source and InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK
val isDpad = (source and InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD
if (isGamepad || isJoystick || isDpad) {
nativeGamepadKeyEvent(deviceId, 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)
}
}
@@ -326,10 +339,18 @@ class AmneziaActivity : QtActivity() {
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")
}
@@ -337,6 +358,24 @@ class AmneziaActivity : QtActivity() {
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 {
@@ -348,13 +387,13 @@ class AmneziaActivity : QtActivity() {
sendTouch(1f, 1f)
}
}, 100)
resumeHandler.postDelayed({
if (isActivityResumed && hasWindowFocus && !isFinishing && !isDestroyed) {
sendTouch(2f, 2f)
}
}, 200)
resumeHandler.postDelayed({
if (isActivityResumed && hasWindowFocus && !isFinishing && !isDestroyed) {
requestLayout()
@@ -400,25 +439,25 @@ class AmneziaActivity : QtActivity() {
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
}
@@ -594,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
}
@@ -626,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")
@@ -653,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")
@@ -680,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()
}
@@ -713,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()
@@ -739,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()
@@ -785,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")
@@ -887,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")
@@ -929,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")
@@ -1007,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))
}
}
@@ -1108,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,8 +538,6 @@ open class AmneziaVpnService : VpnService() {
Log.d(TAG, "Reconnect VPN")
protocolState.value = RECONNECTING
connectionJob = connectionScope.launch {
vpnProto?.protocol?.reconnectVpn(Builder(), ::protect)
}
@@ -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,30 +1,36 @@
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(object : ActivityResultContracts.OpenDocument() {
// 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 activitiesToResolveIntent = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
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 (activitiesToResolveIntent.all {
if (activities.all {
val name = it.activityInfo.packageName
name.startsWith("com.google.android.tv.frameworkpackagestubs") || name.startsWith("com.android.tv.frameworkpackagestubs")
}) {
@@ -32,35 +38,140 @@ class TvFilePicker : ComponentActivity() {
}
return intent
}
}) {
setResult(RESULT_OK, Intent().apply { data = it })
}) { 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(arrayOf("*/*"))
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()
}
}
+8 -55
View File
@@ -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,9 +19,9 @@ 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)
@@ -31,4 +31,7 @@ object QtAndroidController {
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
}
@@ -1,9 +1,6 @@
package org.amnezia.vpn.util
import org.json.JSONArray
import org.json.JSONObject
inline fun <reified T> JSONArray.asSequence(): Sequence<T> =
(0..<length()).asSequence().map { get(it) as T }
fun JSONObject.optStringOrNull(name: String) = optString(name).ifEmpty { null }
@@ -1,66 +0,0 @@
package org.amnezia.vpn.util
import android.annotation.SuppressLint
import android.content.Context
import android.os.Build
import java.io.File
import java.io.FileOutputStream
import java.util.zip.ZipFile
private const val TAG = "LibraryLoader"
object LibraryLoader {
private fun extractLibrary(context: Context, libraryName: String, destination: File): Boolean {
Log.d(TAG, "Extracting library: $libraryName")
val apks = hashSetOf<String>()
context.applicationInfo.run {
sourceDir?.let { apks += it }
splitSourceDirs?.let { apks += it }
}
for (abi in Build.SUPPORTED_ABIS) {
for (apk in apks) {
ZipFile(File(apk), ZipFile.OPEN_READ).use { zipFile ->
val mappedName = System.mapLibraryName(libraryName)
val libraryZipPath = listOf("lib", abi, mappedName).joinToString(File.separator)
val zipEntry = zipFile.getEntry(libraryZipPath)
zipEntry?.let {
Log.d(TAG, "Extracting apk:/$libraryZipPath to ${destination.absolutePath}")
FileOutputStream(destination).use { outStream ->
zipFile.getInputStream(zipEntry).use { inStream ->
inStream.copyTo(outStream, 32 * 1024)
outStream.fd.sync()
}
}
}
return true
}
}
}
return false
}
@SuppressLint("UnsafeDynamicallyLoadedCode")
fun loadSharedLibrary(context: Context, libraryName: String) {
Log.d(TAG, "Loading library: $libraryName")
try {
System.loadLibrary(libraryName)
return
} catch (_: UnsatisfiedLinkError) {
Log.w(TAG, "Failed to load library, try to extract it from apk")
}
var tempFile: File? = null
try {
tempFile = File.createTempFile("lib", ".so", context.codeCacheDir)
if (extractLibrary(context, libraryName, tempFile)) {
System.load(tempFile.absolutePath)
return
}
} catch (e: Exception) {
throw LoadLibraryException("Failed to load library apk: $libraryName", e)
} finally {
tempFile?.delete()
}
}
}
class LoadLibraryException(message: String? = null, cause: Throwable? = null) : Exception(message, cause)
+138 -48
View File
@@ -1,5 +1,6 @@
package org.amnezia.vpn.util
import android.app.Application
import android.content.Context
import android.os.Build
import android.os.Process
@@ -22,9 +23,18 @@ import org.amnezia.vpn.util.Log.Priority.W
import android.util.Log as NativeLog
private const val TAG = "Log"
private const val LOG_FILE_NAME = "amneziaVPN.log"
private const val ROTATE_LOG_FILE_NAME = "amneziaVPN.rotate.log"
private const val APP_LOG_FILE_NAME = "app.log"
private const val APP_ROTATE_LOG_FILE_NAME = "app.rotate.log"
private const val TUNNEL_LOG_FILE_NAME = "tunnel.log"
private const val TUNNEL_ROTATE_LOG_FILE_NAME = "tunnel.rotate.log"
private const val LEGACY_LOG_FILE_NAME = "amneziaVPN.log"
private const val LEGACY_ROTATE_LOG_FILE_NAME = "amneziaVPN.rotate.log"
private const val LOCK_FILE_NAME = ".lock"
private const val TILE_SERVICE_PROCESS_SUFFIX = ":amneziaTileService"
private const val AWG_SERVICE_PROCESS_SUFFIX = ":amneziaAwgService"
private const val AWG_LOGCAT_TAG_PREFIX = " AmneziaWG/"
private const val STREAM_APP = 0
private const val STREAM_TUNNEL = 1
private const val DATE_TIME_PATTERN = "MM-dd HH:mm:ss.SSS"
private const val PREFS_SAVE_LOGS_KEY = "SAVE_LOGS"
private const val LOG_MAX_FILE_SIZE = 1024 * 1024
@@ -42,12 +52,16 @@ object Log {
private val dateTimeFormat: DateTimeFormatter = DateTimeFormatter.ofPattern(DATE_TIME_PATTERN)
private lateinit var logDir: File
private val logFile: File by lazy { File(logDir, LOG_FILE_NAME) }
private val rotateLogFile: File by lazy { File(logDir, ROTATE_LOG_FILE_NAME) }
private lateinit var logFile: File
private lateinit var rotateLogFile: File
private val fileLock: FileChannel by lazy { RandomAccessFile(File(logDir, LOCK_FILE_NAME).path, "rw").channel }
private val threadLock: ReentrantLock by lazy { ReentrantLock() }
private var isAwgProcess: Boolean = false
private val awgLogcatLock = Any()
private var awgLogcatReader: AwgLogcatReader? = null
@Volatile
private var _saveLogs: Boolean = false
var saveLogs: Boolean
@@ -60,6 +74,9 @@ object Log {
}
_saveLogs = value
Prefs.save(PREFS_SAVE_LOGS_KEY, value)
if (isAwgProcess) {
if (value) startAwgLogcatReader() else stopAwgLogcatReader()
}
}
}
@@ -96,21 +113,60 @@ object Log {
fun init(context: Context) {
v(TAG, "Init Log")
logDir = File(context.cacheDir, "logs")
val processName = Application.getProcessName()
val stream = if (':' in processName && !processName.endsWith(TILE_SERVICE_PROCESS_SUFFIX)) {
STREAM_TUNNEL
} else {
STREAM_APP
}
val (rotate, current) = streamFiles(stream)
rotateLogFile = rotate
logFile = current
isAwgProcess = processName.endsWith(AWG_SERVICE_PROCESS_SUFFIX)
saveLogs = Prefs.load(PREFS_SAVE_LOGS_KEY)
}
fun getLogs(): String =
"${deviceInfo()}\n${readLogs()}\nLOGCAT:\n${getLogcat()}"
@JvmStatic
fun getLogFiles(stream: Int): String {
val files = streamFiles(stream).toMutableList()
if (stream == STREAM_APP) files.addAll(0, legacyFiles().filter { it.exists() })
return files.joinToString("\n") { it.absolutePath }
}
fun clearLogs() {
@JvmStatic
fun getDeviceInfo(): String {
val sb = StringBuilder()
sb.append("Model: ").appendLine(Build.MODEL)
sb.append("Brand: ").appendLine(Build.BRAND)
sb.append("Product: ").appendLine(Build.PRODUCT)
sb.append("Device: ").appendLine(Build.DEVICE)
sb.append("Codename: ").appendLine(Build.VERSION.CODENAME)
sb.append("Release: ").appendLine(Build.VERSION.RELEASE)
sb.append("SDK: ").appendLine(Build.VERSION.SDK_INT)
sb.append("ABI: ").appendLine(Build.SUPPORTED_ABIS.joinToString())
return sb.toString()
}
@JvmStatic
fun clearStream(stream: Int) {
if (logDir.exists()) {
withLock {
logFile.delete()
rotateLogFile.delete()
streamFiles(stream).forEach { it.delete() }
if (stream == STREAM_APP) legacyFiles().forEach { it.delete() }
}
}
}
private fun streamFiles(stream: Int): List<File> =
if (stream == STREAM_TUNNEL) {
listOf(File(logDir, TUNNEL_ROTATE_LOG_FILE_NAME), File(logDir, TUNNEL_LOG_FILE_NAME))
} else {
listOf(File(logDir, APP_ROTATE_LOG_FILE_NAME), File(logDir, APP_LOG_FILE_NAME))
}
private fun legacyFiles(): List<File> =
listOf(File(logDir, LEGACY_ROTATE_LOG_FILE_NAME), File(logDir, LEGACY_LOG_FILE_NAME))
private fun log(tag: String, msg: String, priority: Priority) {
if (saveLogs && priority != V) saveLogMsg(formatLogMsg(tag, msg, priority))
@@ -136,51 +192,85 @@ object Log {
}
}
private fun startAwgLogcatReader() {
synchronized(awgLogcatLock) {
if (awgLogcatReader == null) {
awgLogcatReader = AwgLogcatReader().also { it.start() }
}
}
}
private fun stopAwgLogcatReader() {
synchronized(awgLogcatLock) {
awgLogcatReader?.shutdown()
awgLogcatReader = null
}
}
private class AwgLogcatReader : Thread("AwgLogcatReader") {
private val lock = Any()
private var process: java.lang.Process? = null
@Volatile
private var stopped = false
init {
isDaemon = true
}
override fun run() {
try {
follow()
} finally {
synchronized(awgLogcatLock) {
if (awgLogcatReader === this) awgLogcatReader = null
}
}
}
private fun follow() {
val logcat = try {
ProcessBuilder(
"logcat", "-v", "threadtime", "-v", "UTC", "--pid=${Process.myPid()}", "-T", "1"
).redirectErrorStream(true).start()
} catch (e: IOException) {
NativeLog.e(TAG, "Failed to start logcat: $e")
return
}
synchronized(lock) {
if (stopped) {
logcat.destroy()
return
}
process = logcat
}
try {
logcat.inputStream.bufferedReader().useLines { lines ->
lines.filter { it.contains(AWG_LOGCAT_TAG_PREFIX) }.forEach {
if (!stopped) saveLogMsg("$it\n")
}
}
if (!stopped) NativeLog.w(TAG, "Logcat exited unexpectedly")
} catch (e: IOException) {
if (!stopped) NativeLog.e(TAG, "Failed to read logcat: $e")
} finally {
logcat.destroy()
}
}
fun shutdown() {
synchronized(lock) {
stopped = true
process?.destroy()
}
}
}
private fun formatLogMsg(tag: String, msg: String, priority: Priority): String {
val utcDate = ZonedDateTime.now(ZoneOffset.UTC).format(dateTimeFormat)
return "${utcDate}Z ${Process.myPid()} ${Process.myTid()} $priority [${Thread.currentThread().name}] " +
"$tag: $msg\n"
}
private fun deviceInfo(): String {
val sb = StringBuilder()
sb.append("Model: ").appendLine(Build.MODEL)
sb.append("Brand: ").appendLine(Build.BRAND)
sb.append("Product: ").appendLine(Build.PRODUCT)
sb.append("Device: ").appendLine(Build.DEVICE)
sb.append("Codename: ").appendLine(Build.VERSION.CODENAME)
sb.append("Release: ").appendLine(Build.VERSION.RELEASE)
sb.append("SDK: ").appendLine(Build.VERSION.SDK_INT)
sb.append("ABI: ").appendLine(Build.SUPPORTED_ABIS.joinToString())
return sb.toString()
}
private fun readLogs(): String {
var logText = ""
withLock {
try {
if (rotateLogFile.exists()) logText = rotateLogFile.readText()
if (logFile.exists()) logText += logFile.readText()
} catch (e: IOException) {
val errorMsg = "Failed to read log: $e"
NativeLog.e(TAG, errorMsg)
logText += errorMsg
}
}
return logText
}
private fun getLogcat(): String {
try {
val process = ProcessBuilder("logcat", "-d").redirectErrorStream(true).start()
return process.inputStream.reader().readText()
} catch (e: IOException) {
val errorMsg = "Failed to get logcat log: $e"
NativeLog.e(TAG, errorMsg)
return errorMsg
}
}
private fun withLock(block: () -> Unit) {
threadLock.lock()
try {
Loaded 100 of 1211 files, more files were not shown because too many files have changed in this diff. Show more