Commit Graph

29 Commits

Author SHA1 Message Date
Davide De Rosa 6ede6f052a
Allow editing of OpenVPN endpoints (#335)
Hosts only:

- Add new
- Edit/delete existing
- Reorder

Closes #206
2023-07-23 12:45:47 +02:00
Davide De Rosa 98e5e4cdde
Share common protocols across localized strings (#324) 2023-07-05 17:18:33 +02:00
Davide De Rosa e960943302
Revert "Move VPNProtocolType serialization to Data layer" (#319)
Reverts passepartoutvpn/passepartout-apple#318

`Codable` compliance at the domain layer (`Profile` etc.) makes this
change in serialization destructive.
2023-07-03 11:18:12 +02:00
Davide De Rosa ddf3dc313f
Move VPNProtocolType serialization to Data layer (#318)
It's crucial that the data layer has full control over how entities are
(de)serialized.

Do not leave this choice up to the domain layer by defining an enum as a
raw value type, because any change in the enum raw value would literally
be a disaster, i.e. _any_ serialized data would break instantly.
2023-07-02 13:27:46 +02:00
Davide De Rosa 278efaf347
Refactor domain errors (#310) 2023-07-02 12:51:50 +02:00
Davide De Rosa fb47def4ed
Avoid inline format for non-descriptive strings (#302) 2023-05-28 11:57:35 +02:00
Davide De Rosa 3a59ac7684
Invoke VPNManager methods with a Profile object (#309)
The VPNConfiguration parameter is opaque and tightly coupled to
TunnelKit. Connecting to a Profile makes infinitely more sense, beyond
simplifying the VPNManager class. Configuration building is fully
delegated to the strategy (as it has to be).

- VPNManager takes Profile and produces VPNConfigurationParameters
- VPNManagerStrategy takes VPNConfigurationParameters (abstract)
- TunnelKitVPNManagerStrategy takes VPNConfigurationParameters and
produces TunnelKitVPNConfiguration internally
2023-05-28 09:56:51 +02:00
Davide De Rosa a78a7b18b5
Encapsulate *Persistence responsibilities (#305)
Do not leave the choice of a repository context up to the library
consumer. Instead, provide a specific factory (*Persistence) for each
module.
2023-05-27 12:32:53 +02:00
Davide De Rosa efcda495bc
Address logging issues (#304)
* Make specific message levels a default extension

* Define Loggable protocol

* Keep track of message originator metadata

* Fix tracing of Core Data logs

* Log query on entity not found
2023-05-27 12:14:04 +02:00
Davide De Rosa 7ccb10febc
Rethink library architecture (#301) 2023-05-24 18:19:47 +02:00
Davide De Rosa b4ad8dea0d Do some code clean up
- Use guard in validators

- Rename URL.openURL() to URL.open()

- Sort imports (SwiftLint)

- Drop unused VPNProtocolType.allTypes

- Drop unused imports
2023-05-21 11:48:03 +02:00
Davide De Rosa 513b38584d
Upgrade SwiftLint to CI version (#266) 2023-03-19 16:10:40 +01:00
Davide De Rosa 17ae9793df
Randomize provider server (#263)
* Pick random server within location

* Add toggle to provider section in profile
2023-03-19 08:19:32 +01:00
Davide De Rosa c85f3d894e
Restore DNS "Domain" setting (#260) 2023-03-17 22:16:04 +01:00
Davide De Rosa f06f097f27
Add SwiftLint phase (#262) 2023-03-17 21:55:47 +01:00
Davide De Rosa 37354d1b87 Update copyright 2023-03-17 16:56:19 +01:00
Davide De Rosa e17224e61e Refactor stale library entities
- Move VPNConfiguration* to VPN implementation

- Drop old model protocols
2023-03-17 16:53:13 +01:00
Davide De Rosa 2e10aab039
Extend authentication methods (#259)
* Add profile authentication method

- Persistent (default, fallback)

- Interactive (may expire through reconnections)

- TOTP (seed-based) - currently disabled

* Disable on-demand if login is interactive

* Present interactive prompt on VPN toggle
2023-03-17 16:49:35 +01:00
Davide De Rosa 44ccd21536
Fetch full profiles from Core Data (#258)
* Fetch full profiles

* Manage full profiles in organizer
2023-03-16 16:49:09 +01:00
Davide De Rosa 092d4f5de2 Drop return in one-line functions 2022-09-04 20:30:55 +02:00
Davide De Rosa 4c4b3ee0c9 Revert to concrete-only managers
Abstraction was overcomplicated. Strategy pattern is enough.
2022-09-03 12:47:40 +02:00
Davide De Rosa 92ffc382cb Reconnect VPN without disabling it
Retain on-demand flag to avoid leaks during reconnection.
2022-08-05 07:40:43 +02:00
Davide De Rosa 9458c4f3a3 Fix server description and sorting
- Name (countries, area)
- Index
- Tags

Also use short description in menu (without country prefix).
2022-07-16 17:39:42 +02:00
Davide De Rosa 3f4b55a003 Implement Mac bundle with system menu
Use bundle as a means to provide Mac APIs to Catalyst app.

In order to cross the @objc wall set by the Mac Bundle mechanism,
Swift structures cannot be used directly and must be bridged
through ObjC facades.

Create NSMenu in MVVM style and install it on app launch. Make
sure to do it in AppDelegate.applicationDidFinishLaunching(),
because doing it as early as in PassepartoutApp.init() would
crash Mac code.

Use .representedObject to own view models.

With menu in place, app can be sent to background when main window
is closed. Requires multiple documents support for app not to die
instantly.
2022-07-16 17:39:42 +02:00
Davide De Rosa 7d5f3e63c8 Add 'didUpdate' subjects in managers
objectWillChange may not work outside SwiftUI.

- ProfileManager.didUpdateProfiles

- ProviderManager.didUpdateProviders
2022-07-15 08:59:29 +02:00
Davide De Rosa 7771b50b56 Add ProfileManager methods to return full profiles 2022-07-14 17:07:30 +02:00
Davide De Rosa 9d9dc2b2f6 Rename activeProfileId publisher for consistency 2022-07-14 17:07:30 +02:00
Davide De Rosa 0a2d1e9d37 Mitigate fatalError() in properties, fail gracefully
Do not trigger fatalError() on properties too much because
SwiftUI may read them at any unpredictable time.
2022-07-08 20:01:53 +02:00
Davide De Rosa 9a8477225e Refactor library into domain + impl 2022-06-23 23:31:01 +02:00