Skip to content

Commit

Permalink
Add support for bypass_domain and match_domain platform HTTP prox…
Browse files Browse the repository at this point in the history
…y options
  • Loading branch information
nekohasekai committed May 3, 2024
1 parent 17eec08 commit f6f8955
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion Library/Network/ExtensionPlatformInterface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,28 @@ public class ExtensionPlatformInterface: NSObject, LibboxPlatformInterfaceProtoc
proxySettings.httpEnabled = true
proxySettings.httpsEnabled = true
}
var bypassDomains: [String] = []
let bypassDomainIterator = options.getHTTPProxyBypassDomain()!
while bypassDomainIterator.hasNext() {
bypassDomains.append(bypassDomainIterator.next())
}
if excludeAPNs {
proxySettings.exceptionList = ["push.apple.com"]
if !bypassDomains.contains(where: { it in
it == "push.apple.com"
}) {
bypassDomains.append("push.apple.com")
}
}
if !bypassDomains.isEmpty {
proxySettings.exceptionList = bypassDomains
}
var matchDomains: [String] = []
let matchDomainIterator = options.getHTTPProxyMatchDomain()!
while matchDomainIterator.hasNext() {
matchDomains.append(matchDomainIterator.next())
}
if !matchDomains.isEmpty {
proxySettings.matchDomains = matchDomains
}
settings.proxySettings = proxySettings
}
Expand Down

0 comments on commit f6f8955

Please sign in to comment.