-
Notifications
You must be signed in to change notification settings - Fork 31
add client-side proxy detection #525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -701,4 +701,35 @@ - (NSString *)kDeviceId { | |||||||
| } | ||||||||
| } | ||||||||
|
|
||||||||
| - (BOOL)isUsingProxy { | ||||||||
| CFDictionaryRef proxyRef = CFNetworkCopySystemProxySettings(); | ||||||||
|
||||||||
| if (proxyRef) { | ||||||||
| NSDictionary *proxy = CFBridgingRelease(proxyRef); | ||||||||
|
|
||||||||
| NSNumber *httpOn = proxy[@"HTTPEnable"]; | ||||||||
| NSNumber *httpsOn = proxy[@"HTTPSEnable"]; | ||||||||
| NSNumber *socksOn = proxy[@"SOCKSEnable"]; | ||||||||
|
|
||||||||
| if (httpOn.boolValue || httpsOn.boolValue || socksOn.boolValue) { | ||||||||
| return YES; | ||||||||
| } | ||||||||
| } | ||||||||
|
|
||||||||
| struct ifaddrs *ifaddr = NULL; | ||||||||
| if (getifaddrs(&ifaddr) == 0 && ifaddr) { | ||||||||
| for (struct ifaddrs *cur = ifaddr; cur != NULL; cur = cur->ifa_next) { | ||||||||
| if (!cur->ifa_name) continue; | ||||||||
| NSString *name = [NSString stringWithUTF8String:cur->ifa_name]; | ||||||||
| if ([name hasPrefix:@"utun"] || | ||||||||
| [name hasPrefix:@"ipsec"] || | ||||||||
| [name hasPrefix:@"ppp"]) { | ||||||||
|
||||||||
| [name hasPrefix:@"ppp"]) { | |
| [name hasPrefix:@"ppp"]) { | |
| freeifaddrs(ifaddr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing documentation: This new method lacks a comment or documentation explaining what it does, what scenarios it detects (system proxy settings, VPN interfaces like utun/ipsec/ppp), and what the return value represents. Consider adding a brief comment above the method explaining its purpose and behavior.