- Notifications
You must be signed in to change notification settings - Fork3
chore: pass session token to network extension#34
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--selfrequired log,info,error,debug,critical,fault | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. From thedocs:
| ||
--exclude **.pb.swift | ||
--condassignment always |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,61 @@ | ||
import NetworkExtension | ||
import os | ||
public func convertDnsSettings(_ req: Vpn_NetworkSettingsRequest.DNSSettings) -> NEDNSSettings { | ||
let dnsSettings = NEDNSSettings(servers: req.servers) | ||
dnsSettings.searchDomains = req.searchDomains | ||
dnsSettings.domainName = req.domainName | ||
dnsSettings.matchDomains = req.matchDomains | ||
dnsSettings.matchDomainsNoSearch = req.matchDomainsNoSearch | ||
return dnsSettings | ||
} | ||
public func convertIPv4Settings(_ req: Vpn_NetworkSettingsRequest.IPv4Settings) -> NEIPv4Settings { | ||
let ipv4Settings = NEIPv4Settings(addresses: req.addrs, subnetMasks: req.subnetMasks) | ||
if !req.router.isEmpty { | ||
ipv4Settings.router = req.router | ||
} | ||
ipv4Settings.includedRoutes = req.includedRoutes.map { | ||
let route = NEIPv4Route(destinationAddress: $0.destination, subnetMask: $0.mask) | ||
if !$0.router.isEmpty { | ||
route.gatewayAddress = $0.router | ||
} | ||
return route | ||
} | ||
ipv4Settings.excludedRoutes = req.excludedRoutes.map { | ||
let route = NEIPv4Route(destinationAddress: $0.destination, subnetMask: $0.mask) | ||
if !$0.router.isEmpty { | ||
route.gatewayAddress = $0.router | ||
} | ||
return route | ||
} | ||
return ipv4Settings | ||
} | ||
public func convertIPv6Settings(_ req: Vpn_NetworkSettingsRequest.IPv6Settings) -> NEIPv6Settings { | ||
let ipv6Settings = NEIPv6Settings( | ||
addresses: req.addrs, | ||
networkPrefixLengths: req.prefixLengths.map { NSNumber(value: $0) } | ||
) | ||
ipv6Settings.includedRoutes = req.includedRoutes.map { | ||
let route = NEIPv6Route( | ||
destinationAddress: $0.destination, | ||
networkPrefixLength: NSNumber(value: $0.prefixLength) | ||
) | ||
if !$0.router.isEmpty { | ||
route.gatewayAddress = $0.router | ||
} | ||
return route | ||
} | ||
ipv6Settings.excludedRoutes = req.excludedRoutes.map { | ||
let route = NEIPv6Route( | ||
destinationAddress: $0.destination, | ||
networkPrefixLength: NSNumber(value: $0.prefixLength) | ||
) | ||
if !$0.router.isEmpty { | ||
route.gatewayAddress = $0.router | ||
} | ||
return route | ||
} | ||
returnipv6Settings | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -6,7 +6,6 @@ import SwiftProtobuf | ||
actor Receiver<RecvMsg: Message> { | ||
private let dispatch: DispatchIO | ||
private let queue: DispatchQueue | ||
private let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "proto") | ||
/// Creates an instance using the given `DispatchIO` channel and queue. | ||
@@ -58,11 +57,7 @@ actor Receiver<RecvMsg: Message> { | ||
/// Starts reading protocol messages from the `DispatchIO` channel and returns them as an `AsyncStream` of messages. | ||
/// On read or decoding error, it logs and closes the stream. | ||
func messages() throws(ReceiveError) -> AsyncStream<RecvMsg> { | ||
MemberAuthor
| ||
AsyncStream( | ||
unfolding: { | ||
do { | ||
let length = try await self.readLen() | ||
@@ -83,7 +78,6 @@ actor Receiver<RecvMsg: Message> { | ||
enum ReceiveError: Error { | ||
case readError(String) | ||
case invalidLength | ||
} | ||
func deserializeLen(_ data: Data) throws -> UInt32 { | ||
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.