ios - NEPacketTunnelProvider 为什么我从这个 IP 17.130.21.5:443 获取数据包
问题描述
为了创建 NEPacketTunnelNetworkSettings 设置,我使用了下面的代码。
在这段代码中,我只添加"8.8.8.8", "1.1.1.1"
了 IPV4 包含的路由和"2001:4860:4860::8888"
IPV6 包含的路由。excludeRoutes 是默认的。
但是我从17.130.21.5:443
这个 IP 收到了一些数据包。
- (NEPacketTunnelNetworkSettings *)createTunnelSettings {
NEPacketTunnelNetworkSettings *settings = [[NEPacketTunnelNetworkSettings alloc] initWithTunnelRemoteAddress:@"127.1.1.1"];
NEIPv4Settings *ipv4 = [[NEIPv4Settings alloc]
initWithAddresses:@[@"172.16.209.2"]
subnetMasks:@[@"255.255.255.252"]];
NEIPv6Settings *ipv6 = [[NEIPv6Settings alloc]
initWithAddresses:@[@"fd12:1:1:1::2"]
networkPrefixLengths:@[ @(64)]];
NEDNSSettings * dns = [[NEDNSSettings alloc] initWithServers: [@"8.8.8.8", @"1.1.1.1",@"2001:4860:4860::8888"]];
NSMutableArray* ipv4IncludedRoutes = [NSMutableArray new];
[ipv4IncludedRoutes addObject:[[NEIPv4Route alloc] initWithDestinationAddress:@"8.8.8.8"
subnetMask:@"255.255.255.255"]];
[ipv4IncludedRoutes addObject:[[NEIPv4Route alloc] initWithDestinationAddress:@"1.1.1.1"
subnetMask:@"255.255.255.255"]];
NSMutableArray* ipv6IncludedRoutes = [NSMutableArray new];
[ipv6IncludedRoutes addObject:[[NEIPv6Route alloc] initWithDestinationAddress:@"2001:4860:4860::8888"
networkPrefixLength: @(128)]];
ipv4.includedRoutes = ipv4IncludedRoutes;
ipv6.includedRoutes = ipv6IncludedRoutes;
ipv4.excludedRoutes = @[[NEIPv4Route defaultRoute]];
ipv6.excludedRoutes = @[[NEIPv6Route defaultRoute]];
dns.matchDomains = @[ @"" ];
settings.DNSSettings = dns;
if(ipv4Available) {
settings.IPv4Settings = ipv4;
}
if(ipv6Available) {
settings.IPv6Settings = ipv6;
}
}
return settings;
}
解决方案
推荐阅读
- clickhouse - 如何在 ClickHouse 中使用 lambda max(a,b) 函数?
- javascript - 无法识别 Javascript 数组中的重复值
- java - 无法解析“:app@debugAndroidTest/compileClasspath”的依赖关系
- ios - Fastlane 测试尝试启动另一台设备
- java - 流中的断言
- laravel - 我的 laravel 分页有问题
- css - 平滑的css反弹效果
- python - 如何在 QMainwindow 上添加滚动条
- curl - 电报机器人 API setChatPhoto()
- xml - 使用适用于 wso2 esb 的任何脚本更改 wso2 esb 中 xml 的内部标记值或节点值