|
4 | 4 |
|
5 | 5 | #import <NetworkExtension/NetworkExtension.h> |
6 | 6 |
|
7 | | -#import "bypasstcpflow.h" |
8 | | -#import "bypassudpflow.h" |
9 | 7 | #import "interfaceconfig.h" |
10 | 8 | #import "wireguardtunnel.h" |
11 | 9 |
|
@@ -316,58 +314,15 @@ - (BOOL)handleNewFlow:(NEAppProxyFlow*) flow { |
316 | 314 | } |
317 | 315 |
|
318 | 316 | // Perform flow bypassing. |
| 317 | + flow.networkInterface = self.wireguard.virtualInterface; |
319 | 318 | if ([flow isKindOfClass:[NEAppProxyTCPFlow class]]) { |
320 | | - NEAppProxyTCPFlow* tcpFlow = (NEAppProxyTCPFlow*)flow; |
321 | | - nw_endpoint_t dest = nil; |
322 | | - if (@available(macOS 15, *)) { |
323 | | - dest = tcpFlow.remoteFlowEndpoint; |
324 | | - } else { |
325 | | - dest = [VPNSplitTunnelProvider convertEndpoint:tcpFlow.remoteEndpoint]; |
326 | | - } |
327 | | - |
328 | | - BypassTcpFlow* handler = [BypassTcpFlow createBypass:tcpFlow |
329 | | - toEndpoint:dest |
330 | | - withInterface:self.wireguard.virtualInterface]; |
331 | | - if (!handler) { |
332 | | - return NO; |
333 | | - } |
334 | | - |
335 | | - [handler startBypass:^(NSError* error){ |
336 | | - if (error) { |
337 | | - NSLog(@"flow closed with error: %@", error); |
338 | | - } |
339 | | - }]; |
340 | | - |
341 | 319 | std::atomic_fetch_add(&m_handledTcpFlows, 1); |
342 | | - return YES; |
343 | 320 | } else if ([flow isKindOfClass:[NEAppProxyUDPFlow class]]) { |
344 | | - NEAppProxyUDPFlow* udpFlow = (NEAppProxyUDPFlow*)flow; |
345 | | - nw_endpoint_t source; |
346 | | - if (@available(macOS 15, *)) { |
347 | | - source = udpFlow.localFlowEndpoint; |
348 | | - } else { |
349 | | - source = [VPNSplitTunnelProvider convertEndpoint:udpFlow.localEndpoint]; |
350 | | - } |
351 | | - |
352 | | - BypassUdpFlow* handler = [BypassUdpFlow createBypass:udpFlow |
353 | | - localEndpoint:source |
354 | | - withInterface:self.wireguard.virtualInterface]; |
355 | | - if (!handler) { |
356 | | - return NO; |
357 | | - } |
358 | | - |
359 | | - [handler startBypass:^(NSError* error){ |
360 | | - if (error) { |
361 | | - NSLog(@"flow closed with error: %@", error); |
362 | | - } |
363 | | - }]; |
364 | | - |
365 | 321 | std::atomic_fetch_add(&m_handledUdpFlows, 1); |
366 | | - return YES; |
367 | 322 | } else { |
368 | 323 | std::atomic_fetch_add(&m_handledUnknown, 1); |
369 | 324 | } |
370 | | - return NO; |
| 325 | + return YES; |
371 | 326 | } |
372 | 327 |
|
373 | 328 | - (void)cancelProxyWithError:(NSError *)error { |
|
0 commit comments