Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion Common/ACConnectionManager.m
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,7 @@
#import "ACNEService.h"
#import "ACNEServicesManager.h"
#import "ACPreferences.h"
#import "CoreWLAN/CoreWLAN.h"

@interface ACConnectionManager ()

Expand DownExpand Up@@ -224,7 +225,25 @@ -(void)connectAllAutoConnectedServices
{
if([alwaysConnectedServicesIdentifiers containsObject:[neService.configuration.identifier UUIDString]])
{
[neService connect];
BOOL shouldConnect = YES;
// Assuming we have any Wi-Fi interfaces available...
if([[CWWiFiClient interfaceNames] count] > 0)
{
CWInterface *wifi = [[CWWiFiClient sharedWiFiClient] interface];
NSArray<NSString *>* ignoredSSIDs = [[ACPreferences sharedPreferences] ignoredSSIDs];

// ...if the current SSID exists, and it's in the list of ignored SSIDs...
if(wifi.ssid != nil && [ignoredSSIDs containsObject:wifi.ssid])
{
// ...do not connect.
shouldConnect = NO;
}
}

if(shouldConnect)
{
[neService connect];
}
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions Common/ACPreferences.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,6 +23,11 @@
*/
-(NSArray<NSString *>*)alwaysConnectedServicesIdentifiers;

/**
Return the list of ignored SSIDs for the current service identifier
*/
-(NSArray<NSString *>*)ignoredSSIDs;


/**
Enable or disable auto connect for the VPN service
Expand Down
16 changes: 16 additions & 0 deletions Common/ACPreferences.m
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@
NSString * const kServicesPrefKey = @"Services";
NSString * const kServiceIdentifierKey = @"Identifier";
NSString * const kServiceAlwaysConnectedKey = @"AlwaysConnected";
NSString * const kServiceIgnoredSSIDsKey = @"IgnoredSSIDs";

NSString * const kAlwaysConnectedRetryDelayPrefKey = @"AlwaysConnectedRetryDelay";

Expand DownExpand Up@@ -88,6 +89,21 @@ -(void)setAlwaysConnected:(BOOL)inAlwaysConnected forServicesIdentifier:(NSStrin
[[NSUserDefaults standardUserDefaults] setObject:services forKey:kServicesPrefKey];
}

/**
Gets the list of SSIDs that should be ignored for the
purposes of automatic connection. Note that this is input
using:

defaults write org.timac.VPNStatus IgnoredSSIDs "FirstSSD,Second,Third"

Also note that the SSID is ignored irrespective of the VPN service.
*/
-(NSArray<NSString *> *)ignoredSSIDs
{
NSString *ignoredSSIDsString = [[NSUserDefaults standardUserDefaults] stringForKey:kServiceIgnoredSSIDsKey];
return [ignoredSSIDsString componentsSeparatedByString:@","];
}

-(NSInteger)alwaysConnectedRetryDelay
{
NSInteger retryDelay = [[NSUserDefaults standardUserDefaults] integerForKey:kAlwaysConnectedRetryDelayPrefKey];
Expand Down
22 changes: 20 additions & 2 deletions README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,12 +14,30 @@ VPNStatus, an application that replicates some functionalities of macOS built-in

# Retry Delay


VPNStatus tries to reconnect to the VPN every 120s by default. You can change this value using a secret preference. To change the retry delay to 30s:

- Quit VPNStatus
- Run this command line in a Terminal window:
- Run this command in a Terminal window:

```
defaults write org.timac.VPNStatus AlwaysConnectedRetryDelay -int 30
```

# Ignored SSIDs

VPNStatus can optionally ignore one or more SSIDs, such that services are **not** autoconnected when the current Wi-Fi SSID is on the ignored list.

To set the list of ignored SSIDs:

- Quit VPNStatus
- Run this command in a Terminal window:

```
defaults write org.timac.VPNStatus IgnoredSSIDs "OneSSID,SecondSSID,Third SSID"
```

With the above example, if the current Wi-Fi network SSID is `OneSSID`, `SecondSSID`, or `Third SSID`, then the VPN will **not** autoconnect.

If the Wi-Fi network SSID is, say, `FourthSSID`, the VPN service **will** autoconnect, becuase it is not on the list.

Note that SSIDs **are** case-sensitive.
8 changes: 7 additions & 1 deletion VPN.xcodeproj/project.pbxproj
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 52;
objects = {

/* Begin PBXBuildFile section */
Expand DownExpand Up@@ -36,6 +36,8 @@
65DE11B02600FF3E003E05A8 /* ACNEServicesManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 02799F7E20F0081F00675162 /* ACNEServicesManager.m */; };
65DE11B12600FF3E003E05A8 /* ACPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 02619DFD20F7F7BE00099652 /* ACPreferences.m */; };
65DE11B22600FF3E003E05A8 /* ACConnectionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0231297A20F9F8CE003F7540 /* ACConnectionManager.m */; };
C9CBC4E627B5CDCA00D25554 /* CoreWLAN.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9CBC4E527B5CDCA00D25554 /* CoreWLAN.framework */; platformFilter = maccatalyst; };
C9CBC4E727B5CDE000D25554 /* CoreWLAN.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9CBC4E527B5CDCA00D25554 /* CoreWLAN.framework */; platformFilter = maccatalyst; };
FA53906D20EF5F7F00BA9AF7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = FA53906C20EF5F7F00BA9AF7 /* AppDelegate.m */; };
FA53906F20EF5F8000BA9AF7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FA53906E20EF5F8000BA9AF7 /* Assets.xcassets */; };
FA53907220EF5F8000BA9AF7 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = FA53907020EF5F8000BA9AF7 /* MainMenu.xib */; };
Expand DownExpand Up@@ -79,6 +81,7 @@
02799F7D20F0081F00675162 /* ACNEServicesManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ACNEServicesManager.h; sourceTree = "<group>"; };
02799F7E20F0081F00675162 /* ACNEServicesManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ACNEServicesManager.m; sourceTree = "<group>"; };
65DE11952600FE38003E05A8 /* libVPNUtil.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libVPNUtil.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
C9CBC4E527B5CDCA00D25554 /* CoreWLAN.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreWLAN.framework; path = System/Library/Frameworks/CoreWLAN.framework; sourceTree = SDKROOT; };
FA53906820EF5F7F00BA9AF7 /* VPNApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = VPNApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
FA53906B20EF5F7F00BA9AF7 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
FA53906C20EF5F7F00BA9AF7 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
Expand DownExpand Up@@ -106,6 +109,7 @@
buildActionMask = 2147483647;
files = (
02619DFA20F7E25C00099652 /* AppKit.framework in Frameworks */,
C9CBC4E727B5CDE000D25554 /* CoreWLAN.framework in Frameworks */,
02619DF920F7E25700099652 /* SystemConfiguration.framework in Frameworks */,
02619DF820F7E24C00099652 /* NetworkExtension.framework in Frameworks */,
);
Expand All@@ -123,6 +127,7 @@
buildActionMask = 2147483647;
files = (
FA89042920EF805A008AA0BC /* NetworkExtension.framework in Frameworks */,
C9CBC4E627B5CDCA00D25554 /* CoreWLAN.framework in Frameworks */,
FA53908420EF603B00BA9AF7 /* SystemConfiguration.framework in Frameworks */,
FA53908220EF603700BA9AF7 /* AppKit.framework in Frameworks */,
);
Expand DownExpand Up@@ -210,6 +215,7 @@
FA53907D20EF5FD500BA9AF7 /* Frameworks */ = {
isa = PBXGroup;
children = (
C9CBC4E527B5CDCA00D25554 /* CoreWLAN.framework */,
FA89042820EF8059008AA0BC /* NetworkExtension.framework */,
FA53908320EF603B00BA9AF7 /* SystemConfiguration.framework */,
FA53908120EF603700BA9AF7 /* AppKit.framework */,
Expand Down