{"id":480659,"date":"2026-05-22T12:13:53","date_gmt":"2026-05-22T12:13:53","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=480659"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=480659","title":{"rendered":"\u041a\u0430\u043a \u044f \u0434\u0435\u043b\u0430\u043b ping \u0438 traceroute \u043d\u0430 iOS \u0431\u0435\u0437 entitlements \u2014 \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0449\u0435, \u0447\u0435\u043c UMP-\u043a\u043e\u043d\u0441\u0435\u043d\u0442 \u0434\u043b\u044f AdMob"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u042f \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 iOS-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u2014 NetDiag+. \u042d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0443\u0442\u0438\u043b\u0438\u0442: ping, traceroute, DNS lookup, whois, LAN-\u0441\u043a\u0430\u043d\u0435\u0440, port scanner, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 SSL-\u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432, BGP\/ASN lookup, Wi-Fi info \u0438 \u0444\u043e\u043d\u043e\u0432\u044b\u0439 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0445\u043e\u0441\u0442\u043e\u0432 \u0441 \u043f\u0443\u0448\u0430\u043c\u0438 \u043f\u0440\u0438 \u043f\u0430\u0434\u0435\u043d\u0438\u0438. \u042f \u043d\u0430\u0447\u0438\u043d\u0430\u043b \u0435\u0433\u043e \u043a\u0430\u043a \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043b\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043d\u0443\u0436\u0434, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430 iOS \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0434\u043b\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438, \u0438 \u0432 \u0442\u0440\u0451\u0445 \u0438\u0437 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u0431\u044b\u043b\u0430 \u0440\u0435\u043a\u043b\u0430\u043c\u0430.<\/p>\n<p>\u0425\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0442\u0435\u043c, \u0447\u0442\u043e \u043c\u043d\u0435 \u0441\u0430\u043c\u043e\u043c\u0443 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u2014 \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0435\u0449\u0438 \u043d\u0430 iOS \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0435 \u0442\u0430\u043a, \u043a\u0430\u043a \u043e\u0436\u0438\u0434\u0430\u0435\u0448\u044c \u043e\u0442 Unix-\u0444\u043e\u043d\u0430, \u0438 \u0433\u0434\u0435 \u0433\u0440\u0430\u0431\u043b\u0438 \u043b\u0435\u0436\u0430\u0442 \u043d\u0435 \u0442\u0430\u043c, \u0433\u0434\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f.<\/p>\n<p>\u0421\u0440\u0430\u0437\u0443 \u0441\u043f\u043e\u0439\u043b\u0435\u0440 \u043f\u043e \u0432\u044b\u0432\u043e\u0434\u0430\u043c: \u0441\u0430\u043c\u044b\u043c \u0431\u043e\u043b\u0435\u0437\u043d\u0435\u043d\u043d\u044b\u043c \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043d\u0435 \u0441\u0435\u0442\u0435\u0432\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0430 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f UMP-\u043a\u043e\u043d\u0441\u0435\u043d\u0442\u0430 \u0434\u043b\u044f AdMob.<\/p>\n<h4>\u0421\u0442\u0435\u043a<\/h4>\n<p>SwiftUI, iOS 16+, \u0447\u0438\u0441\u0442\u044b\u0439 Swift Concurrency (async\/await, AsyncStream, TaskGroup), Darwin C-API \u0442\u0430\u043c \u0433\u0434\u0435 \u0434\u0435\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u043a\u0443\u0434\u0430. \u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u2014 \u0432\u0441\u0451 \u043d\u0430 \u0433\u043e\u043b\u044b\u0445 BSD-\u0441\u043e\u043a\u0435\u0442\u0430\u0445 \u0447\u0435\u0440\u0435\u0437 C-\u0438\u043d\u0442\u0435\u0440\u043e\u043f.<\/p>\n<hr\/>\n<h4>ICMP ping \u0431\u0435\u0437 entitlement<\/h4>\n<p>\u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u0443\u0434\u0438\u0432\u0438\u043b\u043e: \u043d\u0430 iOS \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c ICMP-\u0441\u043e\u043a\u0435\u0442 <strong>\u0431\u0435\u0437 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 entitlements \u0438 \u0431\u0435\u0437 \u0440\u0443\u0442\u0430<\/strong>, \u0447\u0435\u0433\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u043c Linux \u0431\u0435\u0437 <code>CAP_NET_RAW<\/code> \u0438\u043b\u0438 setuid. Apple \u0441\u0434\u0435\u043b\u0430\u043b\u0430 \u044d\u0442\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u0434\u043b\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 <code>SOCK_DGRAM<\/code> (\u0430 \u043d\u0435 <code>SOCK_RAW<\/code>):<\/p>\n<pre><code class=\"swift\">final class ICMPSocket {    private let fd: Int32    init() throws {        fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP)        guard fd &gt;= 0 else {            throw SocketError.creationFailed(errno)        }    }    deinit {        close(fd)    }    \/\/ ...}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:87px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u042d\u0442\u043e \u0442\u0430 \u0436\u0435 \u043c\u043e\u0434\u0435\u043b\u044c, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 macOS-\u043e\u0432\u0441\u043a\u0438\u0439 <code>ping(8)<\/code> \u0431\u0435\u0437 setuid \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0438\u0437 \u0441\u0442\u0430\u0440\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 macOS. \u042f\u0434\u0440\u043e \u0441\u0430\u043c\u043e \u043f\u0438\u0448\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 ICMP-header \u0437\u0430 \u0442\u0435\u0431\u044f (\u0442\u0438\u043f\/\u043a\u043e\u0434\/checksum \u0434\u043b\u044f echo request), \u0430 identifier \u043f\u043e\u0434\u043c\u0435\u043d\u044f\u0435\u0442 \u043d\u0430 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u2014 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 recv \u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0448\u044c \u043d\u0435 \u0442\u043e\u0442 ID, \u0447\u0442\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u043b, \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 matching \u043f\u043e identifier \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u042d\u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0433\u0440\u0430\u0431\u043b\u044f.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 matching \u043f\u043e <strong>sequence number \u0438 payload<\/strong>. \u042f \u043a\u043b\u0430\u0434\u0443 \u0441\u0432\u043e\u0439 \u043c\u0430\u0440\u043a\u0435\u0440 \u0432 payload \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e \u0435\u0433\u043e \u043d\u0430 \u043f\u0440\u0438\u0451\u043c\u0435:<\/p>\n<pre><code class=\"swift\">\/\/ Sendvar header = ICMPHeader()header.type = ICMPType.echoRequest.rawValueheader.code = 0header.identifier = 0   \/\/ \u044f\u0434\u0440\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u0442header.sequence = currentSequence.bigEndianlet payload = makePayload(sequence: currentSequence)let packet = header.bytes + payloadtry socket.send(data: packet, to: address)\/\/ Receivelet (data, fromIP) = try socket.receive()guard let received = ICMPHeader.parse(data),      received.type == ICMPType.echoReply.rawValue,      received.sequence == currentSequence.bigEndianelse { continue }<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u0433\u0440\u0430\u0431\u043b\u044f \u2014 \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u044b. <code>recvfrom<\/code> \u0431\u0435\u0437 <code>SO_RCVTIMEO<\/code> \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u0432\u0441\u0435\u0433\u0434\u0430, \u0447\u0442\u043e \u0432 Swift Concurrency \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0448\u0438\u0439 Task, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0442\u043e\u043c \u043d\u0435\u043b\u044c\u0437\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c. \u042f \u0441\u0442\u0430\u0432\u043b\u044e \u0442\u0430\u0439\u043c\u0430\u0443\u0442 \u043d\u0430 \u0441\u043e\u043a\u0435\u0442:<\/p>\n<pre><code class=\"swift\">func setTimeout(seconds: Double) {    var tv = timeval(        tv_sec: Int(seconds),        tv_usec: Int32((seconds.truncatingRemainder(dividingBy: 1)) * 1_000_000)    )    setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &amp;tv, socklen_t(MemoryLayout&lt;timeval&gt;.size))}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0418 \u043d\u0430 <code>EAGAIN\/EWOULDBLOCK<\/code> \u0431\u0440\u043e\u0441\u0430\u044e \u0441\u0432\u043e\u0439 <code>SocketError.timeout<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0448\u0435 \u043f\u043e \u0441\u0442\u0435\u043a\u0443 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0438\u043d\u0433\u043e\u0432\u044b\u0439 \u201ctimeout\u201d hop.<\/p>\n<p>Apple \u043a\u043e\u0433\u0434\u0430-\u0442\u043e \u0432\u044b\u043b\u043e\u0436\u0438\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u0440 <code>SimplePing<\/code> \u2014 \u044d\u0442\u043e OG-\u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0441 \u043d\u0430 Objective-C, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043d\u043e\u0433\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043d\u043e \u043e\u043d \u043f\u043b\u043e\u0445\u043e \u043b\u043e\u0436\u0438\u0442\u0441\u044f \u0432 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 Swift Concurrency \u0438 \u043d\u0435\u0443\u0434\u043e\u0431\u0435\u043d \u0434\u043b\u044f multi-host \u043f\u0438\u043d\u0433\u043e\u0432. \u042f \u0432 \u0438\u0442\u043e\u0433\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u0432\u043e\u044e \u0442\u043e\u043d\u043a\u0443\u044e \u043e\u0431\u0451\u0440\u0442\u043a\u0443 \u0438 \u043d\u0435 \u0436\u0430\u043b\u0435\u044e.<\/p>\n<hr\/>\n<h4>Traceroute, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/h4>\n<p>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 Unix-traceroute \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u0440\u0435\u043c\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438: ICMP echo (\u043a\u0430\u043a Windows <code>tracert<\/code>), UDP \u043a \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u043c \u043f\u043e\u0440\u0442\u0430\u043c (\u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 BSD-\u0432\u0430\u0440\u0438\u0430\u043d\u0442) \u0438\u043b\u0438 TCP SYN (paris\/traceroute-tcp).<\/p>\n<p>\u041d\u0430 iOS \u044f \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b ICMP-\u0432\u0430\u0440\u0438\u043d\u0442 \u043f\u0435\u0440\u0432\u044b\u043c. \u0418\u0434\u0435\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f: \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0448\u044c ICMP echo \u0441 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u043c TTL, \u0436\u0434\u0451\u0448\u044c <code>ICMP Time Exceeded<\/code> \u043e\u0442 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0445\u043e\u043f\u0430, \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0448\u044c TTL. \u041d\u0430 \u0431\u0443\u043c\u0430\u0433\u0435 \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e. \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u0438 \u0434\u0432\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b:<\/p>\n<ol>\n<li>\n<p><strong>Setsockopt(IP_TTL) \u043d\u0430 SOCK_DGRAM ICMP-\u0441\u043e\u043a\u0435\u0442\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043f\u0440\u0438\u0437\u043d\u043e<\/strong> \u2014 \u0443 \u043c\u0435\u043d\u044f \u043d\u0435 \u0432\u0441\u0435 \u0445\u043e\u043f\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u0438 Time Exceeded, \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u044b\u043c \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0441\u0435\u0442\u044f\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>Matching \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432<\/strong> \u2014 \u043d\u0430 receive \u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0448\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u043e ICMP Time Exceeded, \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043b\u0435\u0436\u0438\u0442 \u0442\u0432\u043e\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442. \u0427\u0442\u043e\u0431\u044b \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 TTL-\u0448\u0430\u0433\u0443, \u043d\u0443\u0436\u043d\u043e \u043f\u0430\u0440\u0441\u0438\u0442\u044c inner-payload, \u0447\u0442\u043e \u043c\u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0445\u0440\u0443\u043f\u043a\u043e.<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u043b\u0441\u044f \u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 BSD-\u043f\u043e\u0434\u0445\u043e\u0434: UDP-\u043f\u0430\u043a\u0435\u0442\u044b \u043d\u0430 \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0435 \u043f\u043e\u0440\u0442\u044b \u0441 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u043c\u0441\u044f TTL, \u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0441\u043b\u0443\u0448\u0430\u0435\u043c ICMP-\u0441\u043e\u043a\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 Time Exceeded:<\/p>\n<pre><code class=\"swift\">let icmpSock = try ICMPSocket()  \/\/ \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u0451\u043c\u0430icmpSock.setTimeout(seconds: timeout)for ttl in 1...maxHops {    let udpSock = try UDPSocket()    udpSock.setTTL(ttl)    var dest = address    dest.sin_port = (port + UInt16(ttl - 1)).bigEndian  \/\/ 33434, 33435, ...    let probe = Data(repeating: 0x40, count: 32)    let sendTime = CFAbsoluteTimeGetCurrent()    try udpSock.send(data: probe, to: dest)    let (data, fromIP) = try icmpSock.receive()    let rtt = CFAbsoluteTimeGetCurrent() - sendTime    \/\/ ...}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u043e\u0440\u0442\u044b 33434+ttl \u2014 \u044d\u0442\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0432\u044b\u0431\u043e\u0440 <code>traceroute(8)<\/code> \u0435\u0449\u0451 \u0441 80-\u0445: \u043c\u0430\u043b\u043e\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043e\u043d\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u044b \u043d\u0430 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0445\u043e\u0441\u0442\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u044b \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0448\u044c \u043b\u0438\u0431\u043e <code>ICMP Time Exceeded<\/code> \u043e\u0442 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0445\u043e\u043f\u0430, \u043b\u0438\u0431\u043e <code>ICMP Port Unreachable<\/code> \u043e\u0442 destination \u2014 \u043e\u0431\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0435\u0434\u0438\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e.<\/p>\n<p>\u0427\u0442\u043e \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c: <strong>\u043d\u0430 iOS UDP_TTL \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 <\/strong><code><strong>setsockopt(IP_TTL)<\/strong><\/code>, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 ICMP-\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430. \u0418 ICMP-\u0441\u043e\u043a\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u043a \u043f\u0430\u0441\u0441\u0438\u0432\u043d\u044b\u0439 \u043f\u0440\u0438\u0451\u043c\u043d\u0438\u043a \u2014 \u043c\u044b \u0438\u0437 \u043d\u0435\u0433\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0448\u043b\u0451\u043c, \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0442\u0430\u0435\u043c \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 Time Exceeded.<\/p>\n<p>\u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0445\u043e\u043f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e \u043f\u043e \u0434\u0432\u0443\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c:<\/p>\n<pre><code class=\"swift\">let isFinal = fromIP == destIP    || header.type == ICMPType.destinationUnreachable.rawValue<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c \u043b\u0438\u0431\u043e \u043e\u0442\u0432\u0435\u0442 \u043f\u0440\u0438\u0448\u0451\u043b \u043e\u0442 \u0446\u0435\u043b\u0435\u0432\u043e\u0433\u043e IP (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0435\u0441\u043b\u0438 \u0441\u0430\u043c destination \u043f\u0440\u0438\u0441\u043b\u0430\u043b ICMP Port Unreachable), \u043b\u0438\u0431\u043e \u0442\u0438\u043f ICMP \u2014 Destination Unreachable.<\/p>\n<hr\/>\n<h4>LAN-\u0441\u043a\u0430\u043d\u0435\u0440: ARP \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d<\/h4>\n<p>\u0417\u0434\u0435\u0441\u044c iOS \u0440\u0435\u0436\u0435\u0442 \u0436\u0451\u0441\u0442\u0447\u0435. \u0422\u0435\u0431\u0435 <strong>\u043d\u0435 \u043e\u0442\u0434\u0430\u044e\u0442 ARP-\u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/strong> \u0432 userspace. \u041d\u0435\u0442 API \u0442\u0438\u043f\u0430 <code>getarp()<\/code>, \u043d\u0435\u0442 \/proc\/net\/arp \u043a\u0430\u043a \u043d\u0430 Linux. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043f\u0440\u043e \u0438\u0434\u0435\u044e \u201c\u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c ARP-\u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0442\u043e \u0432 \u043b\u043e\u043a\u0430\u043b\u043a\u0435\u201d.<\/p>\n<p>\u0427\u0442\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e:<\/p>\n<ol>\n<li>\n<p><strong>Concurrent TCP connect<\/strong> \u043d\u0430 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u043f\u043e\u0440\u0442\u044b (80, 443, 22, 8080 \u0438 \u0442.\u0434.) \u2014 \u0435\u0441\u043b\u0438 \u0445\u043e\u0441\u0442 \u043e\u0442\u0432\u0435\u0442\u0438\u043b, \u043e\u043d \u0436\u0438\u0432\u043e\u0439. Raw SYN \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0438\u0437 userspace, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 TCP handshake.<\/p>\n<\/li>\n<li>\n<p><strong>mDNS \/ Bonjour discovery<\/strong> \u0447\u0435\u0440\u0435\u0437 <code>NetServiceBrowser<\/code> \u0438\u043b\u0438 <code>NWBrowser<\/code> \u2014 \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u043f\u043e\u043b\u043d\u0430\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u0430, \u0432\u0438\u0434\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0430\u043c\u0438 \u0430\u043d\u043e\u043d\u0441\u0438\u0440\u0443\u044e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u044b.<\/p>\n<\/li>\n<li>\n<p><strong>NSLocalNetworkUsageDescription<\/strong> \u0432 Info.plist \u2014 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0438\u043d\u0430\u0447\u0435 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u0430 \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 IP iOS \u043e\u0442\u043a\u0440\u043e\u0435\u0442 alert \u201cAllow Local Network Access\u201d, \u0438 \u0434\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<\/li>\n<\/ol>\n<p>\u042f \u043f\u043e\u0448\u0451\u043b \u043f\u043e \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u043f\u0443\u0442\u0438 \u2014 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 TCP connect \u0447\u0435\u0440\u0435\u0437 <code>withThrowingTaskGroup<\/code>:<\/p>\n<pre><code class=\"swift\">private static let maxConcurrentProbes = 20func discoverHosts(localIP: String, subnetMask: String) -&gt; AsyncThrowingStream&lt;LANDevice, Error&gt; {    AsyncThrowingStream { continuation in        Task.detached {            let range = Self.calculateSubnetRange(ip: localIP, mask: subnetMask)            try await withThrowingTaskGroup(of: LANDevice?.self) { group in                var activeCount = 0                for ip in range {                    if activeCount &gt;= Self.maxConcurrentProbes {                        if let device = try? await group.next() {                            if let d = device { continuation.yield(d) }                        }                        activeCount -= 1                    }                    group.addTask {                        try await Self.probeHost(ip: ip)                    }                    activeCount += 1                }                for try await device in group {                    if let d = device { continuation.yield(d) }                }            }            continuation.finish()        }    }}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041e\u0434\u0438\u043d <code>connect()<\/code> \u043d\u0430 \u043f\u043e\u0440\u0442 80 \u0441 \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u043e\u043c 500\u043c\u0441 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 IP \u0432 \/24 \u2014 \u0445\u043e\u0441\u0442 \u043b\u0438\u0431\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u0442 SYN+ACK (\u0436\u0438\u0432\u043e\u0439), \u043b\u0438\u0431\u043e RST (\u0436\u0438\u0432\u043e\u0439, \u043d\u043e \u043f\u043e\u0440\u0442 \u0437\u0430\u043a\u0440\u044b\u0442 \u2014 \u0442\u043e\u0436\u0435 \u0441\u0447\u0438\u0442\u0430\u044e \u0436\u0438\u0432\u044b\u043c), \u043b\u0438\u0431\u043e \u0442\u0430\u0439\u043c\u0430\u0443\u0442 (\u043c\u0451\u0440\u0442\u0432\u044b\u0439 \u0438\u043b\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u0442). \u0417\u0430 \u0441\u0447\u0451\u0442 <code>maxConcurrentProbes = 20<\/code> \u0432\u0435\u0441\u044c \/24 \u043f\u0440\u043e\u0431\u0435\u0433\u0430\u0435\u0442\u0441\u044f \u0437\u0430 \u043f\u0430\u0440\u0443 \u0441\u0435\u043a\u0443\u043d\u0434.<\/p>\n<p>\u0427\u0442\u043e \u044f <strong>\u043d\u0435 \u0434\u0435\u043b\u0430\u044e<\/strong>, \u043d\u043e \u043c\u043e\u0433 \u0431\u044b:<\/p>\n<ul>\n<li>\n<p>\u041d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e mDNS \u0434\u043b\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 (\u0435\u0441\u0442\u044c \u0432 TODO)<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435 \u0434\u0435\u043b\u0430\u044e port scanning \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u2014 \u044d\u0442\u043e \u0443\u0436\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438<\/p>\n<\/li>\n<\/ul>\n<p>\u0413\u0440\u0430\u0431\u043b\u044f, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u043b: \u043d\u0430 iOS 17 alert \u201cLocal Network Access\u201d \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437. \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043e\u0442\u043a\u0430\u0437\u0430\u043b \u2014 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u043e\u043f\u044b\u0442\u043a\u0430 <code>connect()<\/code> \u043c\u043e\u043b\u0447\u0430 \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u0438\u0442\u0441\u044f, \u0431\u0435\u0437 \u044f\u0432\u043d\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438. \u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0434\u0435\u043b\u0430\u0442\u044c UI-\u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0443 \u043f\u0440\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438.<\/p>\n<hr\/>\n<h4>Host Monitor: BGTaskScheduler \u043a\u0430\u043a \u043e\u043d \u0435\u0441\u0442\u044c<\/h4>\n<p>\u0421\u0430\u043c\u0430\u044f \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043d\u043e \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0445\u043e\u0447\u0435\u0442: \u201c\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u0445\u043e\u0441\u0442, \u0438 \u0435\u0441\u043b\u0438 \u043e\u043d \u0443\u043f\u0430\u0434\u0451\u0442 \u2014 \u043c\u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043f\u0443\u0448, \u043a\u0430\u043a \u0443 UptimeRobot\u201d. \u041d\u0430 iOS \u044d\u0442\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u201c\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u201d, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e:<\/p>\n<ol>\n<li>\n<p>\u041d\u0435\u0442 background-thread, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0438\u0441\u0438\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u2014 iOS \u0443\u0431\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 ~30 \u0441\u0435\u043a\u0443\u043d\u0434 \u043f\u043e\u0441\u043b\u0435 \u0443\u0445\u043e\u0434\u0430 \u0432 background.<\/p>\n<\/li>\n<li>\n<p>Silent push \u043a\u0430\u043a \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c wake \u2014 \u0435\u0441\u0442\u044c, \u043d\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u0430 \u0443 \u043c\u0435\u043d\u044f \u0432\u0441\u0451 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0435.<\/p>\n<\/li>\n<li>\n<p><code>BGTaskScheduler<\/code> \u2014 \u0434\u0430\u0451\u0442 ~30 \u0441\u0435\u043a\u0443\u043d\u0434 CPU <strong>\u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c<\/strong> \u0440\u0430\u0437 \u0432 15+ \u043c\u0438\u043d\u0443\u0442. iOS \u0441\u0430\u043c \u0440\u0435\u0448\u0430\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u0442\u0435\u0431\u044f \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ol>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u043d\u0430 iOS \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u043e \u0445\u0443\u0436\u0435, \u0447\u0435\u043c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435. \u042d\u0442\u043e \u043d\u0430\u0434\u043e \u0447\u0435\u0441\u0442\u043d\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u0442\u044c \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0438\u0437\u0430\u0439\u043d \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u044d\u0442\u043e\u0433\u043e.<\/p>\n<p>\u0427\u0442\u043e \u044f \u0434\u0435\u043b\u0430\u044e:<\/p>\n<pre><code class=\"swift\">BGTaskScheduler.shared.register(forTaskWithIdentifier: \"com.netdiag.hostmonitor\", using: nil) { task in    Task {        await HostMonitorService.shared.runMonitoringPass()        task.setTaskCompleted(success: true)    }    submitNext()  \/\/ \u043f\u0435\u0440\u0435\u043f\u043e\u0434\u0430\u0451\u043c \u0437\u0430\u0434\u0430\u0447\u0443 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435}let request = BGAppRefreshTaskRequest(identifier: \"com.netdiag.hostmonitor\")request.earliestBeginDate = Date(timeIntervalSinceNow: 15 * 60)  \/\/ \u043d\u0435 \u0440\u0430\u043d\u044c\u0448\u0435 \u0447\u0435\u043c \u0447\u0435\u0440\u0435\u0437 15 \u043c\u0438\u043dtry BGTaskScheduler.shared.submit(request)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0418 \u0432\u043d\u0443\u0442\u0440\u0438 <code>runMonitoringPass()<\/code>:<\/p>\n<ol>\n<li>\n<p>\u0411\u0435\u0440\u0443 \u0432\u0441\u0435 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0445\u043e\u0441\u0442\u044b<\/p>\n<\/li>\n<li>\n<p>\u041f\u0438\u043d\u0433\u0443\u044e \u0438\u0445 <strong>\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e<\/strong> (<code>withTaskGroup<\/code>) \u2014 \u0443\u0441\u043f\u0435\u0442\u044c \u0432 30-\u0441\u0435\u043a\u0443\u043d\u0434\u043d\u044b\u0439 \u0431\u044e\u0434\u0436\u0435\u0442<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e: \u0435\u0441\u043b\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c (up\u2192down \u0438\u043b\u0438 down\u2192up), \u0448\u043b\u044e local notification<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c \u2014 \u043c\u043e\u043b\u0447\u0443, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0441\u043f\u0430\u043c\u0438\u0442\u044c<\/p>\n<\/li>\n<\/ol>\n<p>\u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0443\u0448\u0435\u0439 \u201c\u0445\u043e\u0441\u0442 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 up \u043a\u0430\u0436\u0434\u044b\u0435 5 \u043c\u0438\u043d\u0443\u0442\u201d, \u0442\u043e\u043b\u044c\u043a\u043e state transitions. \u042d\u0442\u043e \u0438 \u0431\u0438\u0442\u0432\u0443 \u0441 iOS background-\u043b\u0438\u043c\u0438\u0442\u0430\u043c\u0438 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0432\u044b\u0438\u0433\u0440\u0430\u0442\u044c, \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043d\u0435 \u043d\u0430\u0434\u043e\u0435\u0434\u0430\u0435\u0442.<\/p>\n<p>\u0413\u0440\u0430\u0431\u043b\u044f: BGTaskScheduler <strong>\u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435<\/strong>. \u0422\u043e\u0447\u043d\u0435\u0435, \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0442\u044b \u0440\u0443\u043a\u0430\u043c\u0438 \u0434\u0451\u0440\u043d\u0435\u0448\u044c \u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 debugger:<\/p>\n<pre><code>e -l objc -- (void)[[BGTaskScheduler sharedScheduler] _simulateLaunchForTaskWithIdentifier:@\"com.netdiag.hostmonitor\"]<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u042f \u043d\u0430\u0448\u0451\u043b \u044d\u0442\u043e \u0432 \u043a\u0430\u043a\u043e\u043c-\u0442\u043e DTS-thread, \u0438 \u0431\u0435\u0437 \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0442\u044c background-\u043b\u043e\u0433\u0438\u043a\u0443 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. \u041d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0442\u0430\u0441\u043a\u0438, \u043d\u043e \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e.<\/p>\n<hr\/>\n<h4>AdMob \u0438 UMP \u2014 \u0442\u043e, \u0447\u0442\u043e \u0431\u0435\u0441\u0438\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e<\/h4>\n<p>\u0421\u0435\u0442\u0435\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u0438\u0441\u0430\u043b\u0430\u0441\u044c \u0441 \u0443\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0438\u0435\u043c. \u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f AdMob \u2014 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f.<\/p>\n<p>\u0421\u0430\u043c AdMob \u0447\u0435\u0440\u0435\u0437 <code>GoogleMobileAds<\/code> Swift Package \u0437\u0430\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0431\u0435\u0437 \u0431\u043e\u043b\u0438. <code>MobileAds.shared.start()<\/code> \u2014 \u0438 \u0431\u0430\u043d\u043d\u0435\u0440\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0447\u0435\u0440\u0435\u0437 <code>BannerView<\/code> \u0432 <code>UIViewRepresentable<\/code>. \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e.<\/p>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u0441 <strong>GDPR \/ CCPA \u043a\u043e\u043d\u0441\u0435\u043d\u0442\u0430<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 Google \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 \u0441\u0432\u043e\u0439 UMP SDK (<code>GoogleUserMessagingPlatform<\/code>). \u0423 \u044d\u0442\u043e\u0433\u043e SDK \u0434\u0432\u0435 \u0431\u0435\u0434\u044b:<\/p>\n<ol>\n<li>\n<p><strong>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0434\u043b\u044f SwiftUI<\/strong> \u2014 \u043d\u0438\u043a\u0430\u043a\u043e\u0439. \u0412\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043d\u0430 Objective-C \u0438\u043b\u0438 \u0441\u0442\u0430\u0440\u043e\u043c UIKit. \u0427\u0442\u043e \u043a\u0443\u0434\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0432 SwiftUI-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u2014 \u0434\u043e\u0434\u0443\u043c\u044b\u0432\u0430\u043b \u0441\u0430\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>AdMob \u043d\u0435 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442 privacy message, \u043f\u043e\u043a\u0430 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043d\u0435\u0442 \u201crevocation link\u201d<\/strong> \u2014 \u0442\u043e \u0435\u0441\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0438 \u0432 Settings, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0444\u043e\u0440\u043c\u0443 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u0441\u043e\u0433\u043b\u0430\u0441\u0438\u044f. \u041b\u043e\u0433\u0438\u043a\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0442\u0430\u043a\u0430\u044f: \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0442\u044b \u0432 \u043a\u043e\u0434\u0435 \u0434\u0435\u043b\u0430\u0435\u0448\u044c revocation link, <strong>\u0432\u044b\u043a\u0430\u0442\u044b\u0432\u0430\u0435\u0448\u044c \u0441\u0431\u043e\u0440\u043a\u0443<\/strong>, \u043f\u043e\u0442\u043e\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0448\u044c\u0441\u044f \u0432 AdMob \u0438 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0448\u044c \u201c\u0434\u0430, \u0443 \u043c\u0435\u043d\u044f revocation link \u0435\u0441\u0442\u044c, \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0439\u0442\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u201d. \u041e\u0431 \u044d\u0442\u043e\u043c \u043d\u0438\u0433\u0434\u0435 \u044f\u0432\u043d\u043e \u043d\u0435 \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u2014 \u044f \u043d\u0435\u0434\u0435\u043b\u044e \u0441\u0438\u0434\u0435\u043b \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c, \u043d\u043e \u043d\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c consent message, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u043e\u043d\u044f\u043b.<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u043a\u043e\u0434\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"swift\">@MainActorfinal class ConsentManager: ObservableObject {    static let shared = ConsentManager()    @Published private(set) var adsStarted = false    @Published private(set) var privacyOptionsRequired = false    func requestConsentAndStartAds() {        let parameters = RequestParameters()        ConsentInformation.shared.requestConsentInfoUpdate(with: parameters) { [weak self] error in            ConsentForm.loadAndPresentIfRequired(from: Self.topViewController()) { [weak self] formError in                self?.updatePrivacyOptionsAvailability()                self?.startAdsIfNeeded()            }        }    }    func presentPrivacyOptionsForm() {        guard let root = Self.topViewController() else { return }        ConsentForm.presentPrivacyOptionsForm(from: root) { [weak self] error in            self?.updatePrivacyOptionsAvailability()        }    }    private func startAdsIfNeeded() {        guard ConsentInformation.shared.canRequestAds else { return }        MobileAds.shared.start { [weak self] _ in            self?.adsStarted = true        }    }    \/\/ ...}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u2014 <code>MobileAds.shared.start()<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <strong>\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435<\/strong> \u0442\u043e\u0433\u043e, \u043a\u0430\u043a UMP-flow \u0432\u0435\u0440\u043d\u0443\u043b <code>canRequestAds == true<\/code>. \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432 EEA \u043e\u0442\u043a\u0430\u0437\u0430\u043b \u2014 <code>canRequestAds<\/code> \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e true, \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0435\u043a\u043b\u0430\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f. \u041e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 flow \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0438 GDPR (EEA\/UK), \u0438 US state privacy (CCPA \u0434\u043b\u044f \u041a\u0430\u043b\u0438\u0444\u043e\u0440\u043d\u0438\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u0435\u0433\u0443\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u0448\u0442\u0430\u0442\u043e\u0432), \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e UMP \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043d\u0430 geo \u0438 \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 privacy message.<\/p>\n<p>\u0415\u0449\u0451 \u043e\u0434\u043d\u0430 \u0433\u0440\u0430\u0431\u043b\u044f \u2014 <code>ATTrackingManager.requestTrackingAuthorization<\/code> (ATT prompt) <strong>\u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043e<\/strong> UMP-flow, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e UMP \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043d\u0430 ATT-\u0441\u0442\u0430\u0442\u0443\u0441 \u043f\u0440\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<pre><code class=\"swift\">ATTManager.requestTrackingIfNeeded {    ConsentManager.shared.requestConsentAndStartAds()}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u2014 UMP \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u0442\u0440\u0435\u043a\u0438\u043d\u0433 \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043d, \u0430 \u043f\u043e\u0442\u043e\u043c ATT \u043e\u0442\u043a\u0430\u0436\u0435\u0442, \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 AdMob \u043f\u043e\u0442\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0444\u043b\u0430\u0436\u0438\u0442\u044c.<\/p>\n<p>\u0414\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0432 Debug \u044f \u0444\u043e\u0440\u0441\u0438\u0440\u0443\u044e geography:<\/p>\n<pre><code class=\"swift\">#if DEBUGlet debugSettings = DebugSettings()debugSettings.geography = .EEA  \/\/ \u0438\u043b\u0438 .regulatedUSStateparameters.debugSettings = debugSettings#endif<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0411\u0435\u0437 \u044d\u0442\u043e\u0433\u043e \u043d\u0430 \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u043e\u043c IP UMP-\u0444\u043e\u0440\u043c\u0430 \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c flow \u0431\u044b\u043b\u043e \u043d\u0435\u043b\u044c\u0437\u044f.<\/p>\n<hr\/>\n<h4>\u041b\u043e\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h4>\n<p>12 \u044f\u0437\u044b\u043a\u043e\u0432 (en, ru, de, es, pt-BR, fr, it, pl, ja \u0438 \u0435\u0449\u0451 \u0442\u0440\u0438) \u0441\u0434\u0435\u043b\u0430\u043b \u0447\u0435\u0440\u0435\u0437 \u043d\u043e\u0432\u044b\u0435 <strong>Xcode String Catalogs<\/strong> (<code>.xcstrings<\/code>). \u041f\u043e\u0441\u043b\u0435 \u0441\u0442\u0430\u0440\u044b\u0445 <code>Localizable.strings<\/code> \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0447\u0430\u0441\u0442\u044c\u0435 \u2014 JSON-\u0444\u043e\u0440\u043c\u0430\u0442, \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439 diff \u0432 git, GUI \u0432 Xcode \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 pluralization. \u0415\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0435\u0449\u0451 \u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0437\u0430 \u0441\u0442\u0430\u0440\u044b\u0435 <code>.strings<\/code> \u2014 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043c\u0438\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0442\u0435\u0440\u044f\u0435\u0442\u0435.<\/p>\n<hr\/>\n<h4>\u0427\u0438\u0441\u043b\u0430 \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f<\/h4>\n<p>App Store \u043e\u0434\u043e\u0431\u0440\u0438\u043b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0430\u043f\u0440\u0435\u043b\u0435 2026. \u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u2014 \u043e\u043a\u043e\u043b\u043e 30 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u043a (\u0442.\u0435. \u043f\u043e\u0447\u0442\u0438 \u043d\u043e\u043b\u044c \u043c\u0430\u0440\u043a\u0435\u0442\u0438\u043d\u0433\u0430). \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u2014 \u0447\u0430\u0441\u0442\u044c \u043c\u0430\u0440\u043a\u0435\u0442\u0438\u043d\u0433\u043e\u0432\u043e\u0433\u043e \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430: \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 deep-dive \u043d\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0443\u044e \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u044e \u043f\u0440\u043e\u0442\u0438\u0432 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u043a\u0443\u043f\u0438\u0442\u044c ASO.<\/p>\n<p>AdMob \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0432\u043e\u0439 \u043d\u0435\u0434\u0435\u043b\u0438 \u043f\u043e\u0441\u043b\u0435 approval: eCPM $1.19, match rate 85% \u2014 \u0434\u043b\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0433\u043e\u0432\u043e\u0440\u044f\u0442, \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0441\u0442\u0430\u0440\u0442\u0430.<\/p>\n<hr\/>\n<h4>\u0427\u0442\u043e \u044f \u0431\u044b \u0441\u0434\u0435\u043b\u0430\u043b \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443<\/h4>\n<ol>\n<li>\n<p><strong>\u041d\u0435 \u043b\u0435\u043d\u0438\u0442\u044c\u0441\u044f \u0441 \u0442\u0435\u0441\u0442\u0430\u043c\u0438<\/strong> \u043d\u0430 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0435 ICMP-\u0445\u0435\u0434\u0435\u0440\u043e\u0432. \u0423 \u043c\u0435\u043d\u044f \u0441\u0435\u0439\u0447\u0430\u0441 \u0442\u0435\u0441\u0442\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 DNS resolver \u0438 whois parser, \u0430 ICMP \u044f \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u043b \u043d\u0430 \u0436\u0438\u0432\u044b\u0445 \u0441\u0435\u0442\u044f\u0445. Stress test \u043e\u0442 30 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u043d\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u044f \u043f\u043e\u0447\u0438\u043d\u0438\u043b \u0431\u0430\u0433 \u0441 big-endian sequence \u0447\u0435\u0440\u0435\u0437 \u0434\u0432\u0430 \u0434\u043d\u044f \u043f\u043e\u0441\u043b\u0435 \u0440\u0435\u043b\u0438\u0437\u0430, \u0438 \u044d\u0442\u043e \u0441\u0442\u044b\u0434\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0440\u0430\u0437\u0443 \u0434\u0435\u043b\u0430\u0442\u044c UMP<\/strong> \u0434\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0437\u0430\u043a\u0438\u0434\u044b\u0432\u0430\u0442\u044c \u0431\u0438\u043b\u0434 \u0432 TestFlight. \u0415\u0441\u043b\u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c UMP \u043f\u043e\u0441\u043b\u0435, \u0432\u0441\u0451 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u2014 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 AdMob \u0434\u0440\u0443\u0433\u043e\u0439, ATT-prompt \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0438 \u0442.\u0434.<\/p>\n<\/li>\n<li>\n<p><strong>\u041d\u0435 \u0434\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0443<\/strong> \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u0447\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f background tasks, mDNS, push notifications. \u0423 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0439, \u043a\u043e\u0433\u0434\u0430 \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u0437\u0435\u043b\u0451\u043d\u044b\u0439 \u0441\u0432\u0435\u0442, \u0430 \u043d\u0430 \u0436\u0435\u043b\u0435\u0437\u0435 \u2014 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e.<\/p>\n<\/li>\n<\/ol>\n<hr\/>\n<h4>\u0421\u0441\u044b\u043b\u043a\u0438<\/h4>\n<ul>\n<li>\n<p>App Store: <a href=\"https:\/\/apps.apple.com\/app\/id6738028065\" rel=\"noopener noreferrer nofollow\">https:\/\/apps.apple.com\/app\/id6738028065<\/a><\/p>\n<\/li>\n<li>\n<p>Apple\u2019s SimplePing reference: <a href=\"https:\/\/developer.apple.com\/library\/archive\/samplecode\/SimplePing\/Introduction\/Intro.html\" rel=\"noopener noreferrer nofollow\">https:\/\/developer.apple.com\/library\/archive\/samplecode\/SimplePing\/Introduction\/Intro.html<\/a><\/p>\n<\/li>\n<li>\n<p>BGTaskScheduler docs: <a href=\"https:\/\/developer.apple.com\/documentation\/backgroundtasks\" rel=\"noopener noreferrer nofollow\">https:\/\/developer.apple.com\/documentation\/backgroundtasks<\/a><\/p>\n<\/li>\n<li>\n<p>UMP SDK docs: <a href=\"https:\/\/developers.google.com\/admob\/ios\/privacy\" rel=\"noopener noreferrer nofollow\">https:\/\/developers.google.com\/admob\/ios\/privacy<\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0434\u0435\u043b\u0430\u043b \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u043d\u0430 iOS \u2014 \u0431\u044b\u043b\u043e \u0431\u044b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u043e background-\u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0443. \u041f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u044b.<\/p>\n<\/div>\n<p>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/1038188\/\">https:\/\/habr.com\/ru\/articles\/1038188\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u042f \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 iOS-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u2014 NetDiag+. \u042d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0443\u0442\u0438\u043b\u0438\u0442: ping, traceroute, DNS lookup, whois, LAN-\u0441\u043a\u0430\u043d\u0435\u0440, port scanner, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 SSL-\u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432, BGP\/ASN lookup, Wi-Fi info \u0438 \u0444\u043e\u043d\u043e\u0432\u044b\u0439 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0445\u043e\u0441\u0442\u043e\u0432 \u0441 \u043f\u0443\u0448\u0430\u043c\u0438 \u043f\u0440\u0438 \u043f\u0430\u0434\u0435\u043d\u0438\u0438. \u042f \u043d\u0430\u0447\u0438\u043d\u0430\u043b \u0435\u0433\u043e \u043a\u0430\u043a \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043b\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043d\u0443\u0436\u0434, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430 iOS \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0434\u043b\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438, \u0438 \u0432 \u0442\u0440\u0451\u0445 \u0438\u0437 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u0431\u044b\u043b\u0430 \u0440\u0435\u043a\u043b\u0430\u043c\u0430.\u0425\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0442\u0435\u043c, \u0447\u0442\u043e \u043c\u043d\u0435 \u0441\u0430\u043c\u043e\u043c\u0443 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u2014 \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0435\u0449\u0438 \u043d\u0430 iOS \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0435 \u0442\u0430\u043a, \u043a\u0430\u043a \u043e\u0436\u0438\u0434\u0430\u0435\u0448\u044c \u043e\u0442 Unix-\u0444\u043e\u043d\u0430, \u0438 \u0433\u0434\u0435 \u0433\u0440\u0430\u0431\u043b\u0438 \u043b\u0435\u0436\u0430\u0442 \u043d\u0435 \u0442\u0430\u043c, \u0433\u0434\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f.\u0421\u0440\u0430\u0437\u0443 \u0441\u043f\u043e\u0439\u043b\u0435\u0440 \u043f\u043e \u0432\u044b\u0432\u043e\u0434\u0430\u043c: \u0441\u0430\u043c\u044b\u043c \u0431\u043e\u043b\u0435\u0437\u043d\u0435\u043d\u043d\u044b\u043c \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043d\u0435 \u0441\u0435\u0442\u0435\u0432\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0430 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f UMP-\u043a\u043e\u043d\u0441\u0435\u043d\u0442\u0430 \u0434\u043b\u044f AdMob.\u0421\u0442\u0435\u043aSwiftUI, iOS 16+, \u0447\u0438\u0441\u0442\u044b\u0439 Swift Concurrency (async\/await, AsyncStream, TaskGroup), Darwin C-API \u0442\u0430\u043c \u0433\u0434\u0435 \u0434\u0435\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u043a\u0443\u0434\u0430. \u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u2014 \u0432\u0441\u0451 \u043d\u0430 \u0433\u043e\u043b\u044b\u0445 BSD-\u0441\u043e\u043a\u0435\u0442\u0430\u0445 \u0447\u0435\u0440\u0435\u0437 C-\u0438\u043d\u0442\u0435\u0440\u043e\u043f.ICMP ping \u0431\u0435\u0437 entitlement\u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u0443\u0434\u0438\u0432\u0438\u043b\u043e: \u043d\u0430 iOS \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c ICMP-\u0441\u043e\u043a\u0435\u0442 \u0431\u0435\u0437 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 entitlements \u0438 \u0431\u0435\u0437 \u0440\u0443\u0442\u0430, \u0447\u0435\u0433\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u043c Linux \u0431\u0435\u0437 CAP_NET_RAW \u0438\u043b\u0438 setuid. Apple \u0441\u0434\u0435\u043b\u0430\u043b\u0430 \u044d\u0442\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u0434\u043b\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 SOCK_DGRAM (\u0430 \u043d\u0435 SOCK_RAW):final class ICMPSocket {    private let fd: Int32    init() throws {        fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP)        guard fd &gt;= 0 else {            throw SocketError.creationFailed(errno)        }    }    deinit {        close(fd)    }    \/\/ &#8230;}\u042d\u0442\u043e \u0442\u0430 \u0436\u0435 \u043c\u043e\u0434\u0435\u043b\u044c, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 macOS-\u043e\u0432\u0441\u043a\u0438\u0439 ping(8) \u0431\u0435\u0437 setuid \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0438\u0437 \u0441\u0442\u0430\u0440\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 macOS. \u042f\u0434\u0440\u043e \u0441\u0430\u043c\u043e \u043f\u0438\u0448\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 ICMP-header \u0437\u0430 \u0442\u0435\u0431\u044f (\u0442\u0438\u043f\/\u043a\u043e\u0434\/checksum \u0434\u043b\u044f echo request), \u0430 identifier \u043f\u043e\u0434\u043c\u0435\u043d\u044f\u0435\u0442 \u043d\u0430 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u2014 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 recv \u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0448\u044c \u043d\u0435 \u0442\u043e\u0442 ID, \u0447\u0442\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u043b, \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 matching \u043f\u043e identifier \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u042d\u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0433\u0440\u0430\u0431\u043b\u044f.\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 matching \u043f\u043e sequence number \u0438 payload. \u042f \u043a\u043b\u0430\u0434\u0443 \u0441\u0432\u043e\u0439 \u043c\u0430\u0440\u043a\u0435\u0440 \u0432 payload \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e \u0435\u0433\u043e \u043d\u0430 \u043f\u0440\u0438\u0451\u043c\u0435:\/\/ Sendvar header = ICMPHeader()header.type = ICMPType.echoRequest.rawValueheader.code = 0header.identifier = 0   \/\/ \u044f\u0434\u0440\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u0442header.sequence = currentSequence.bigEndianlet payload = makePayload(sequence: currentSequence)let packet = header.bytes + payloadtry socket.send(data: packet, to: address)\/\/ Receivelet (data, fromIP) = try socket.receive()guard let received = ICMPHeader.parse(data),      received.type == ICMPType.echoReply.rawValue,      received.sequence == currentSequence.bigEndianelse { continue }\u0412\u0442\u043e\u0440\u0430\u044f \u0433\u0440\u0430\u0431\u043b\u044f \u2014 \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u044b. recvfrom \u0431\u0435\u0437 SO_RCVTIMEO \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u0432\u0441\u0435\u0433\u0434\u0430, \u0447\u0442\u043e \u0432 Swift Concurrency \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0448\u0438\u0439 Task, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0442\u043e\u043c \u043d\u0435\u043b\u044c\u0437\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c. \u042f \u0441\u0442\u0430\u0432\u043b\u044e \u0442\u0430\u0439\u043c\u0430\u0443\u0442 \u043d\u0430 \u0441\u043e\u043a\u0435\u0442:func setTimeout(seconds: Double) {    var tv = timeval(        tv_sec: Int(seconds),        tv_usec: Int32((seconds.truncatingRemainder(dividingBy: 1)) * 1_000_000)    )    setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &amp;tv, socklen_t(MemoryLayout&lt;timeval&gt;.size))}\u0418 \u043d\u0430 EAGAIN\/EWOULDBLOCK \u0431\u0440\u043e\u0441\u0430\u044e \u0441\u0432\u043e\u0439 SocketError.timeout, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0448\u0435 \u043f\u043e \u0441\u0442\u0435\u043a\u0443 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0438\u043d\u0433\u043e\u0432\u044b\u0439 \u201ctimeout\u201d hop.Apple \u043a\u043e\u0433\u0434\u0430-\u0442\u043e \u0432\u044b\u043b\u043e\u0436\u0438\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u0440 SimplePing \u2014 \u044d\u0442\u043e OG-\u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0441 \u043d\u0430 Objective-C, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043d\u043e\u0433\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043d\u043e \u043e\u043d \u043f\u043b\u043e\u0445\u043e \u043b\u043e\u0436\u0438\u0442\u0441\u044f \u0432 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 Swift Concurrency \u0438 \u043d\u0435\u0443\u0434\u043e\u0431\u0435\u043d \u0434\u043b\u044f multi-host \u043f\u0438\u043d\u0433\u043e\u0432. \u042f \u0432 \u0438\u0442\u043e\u0433\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u0432\u043e\u044e \u0442\u043e\u043d\u043a\u0443\u044e \u043e\u0431\u0451\u0440\u0442\u043a\u0443 \u0438 \u043d\u0435 \u0436\u0430\u043b\u0435\u044e.Traceroute, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 Unix-traceroute \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u0440\u0435\u043c\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438: ICMP echo (\u043a\u0430\u043a Windows tracert), UDP \u043a \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u043c \u043f\u043e\u0440\u0442\u0430\u043c (\u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 BSD-\u0432\u0430\u0440\u0438\u0430\u043d\u0442) \u0438\u043b\u0438 TCP SYN (paris\/traceroute-tcp).\u041d\u0430 iOS \u044f \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b ICMP-\u0432\u0430\u0440\u0438\u043d\u0442 \u043f\u0435\u0440\u0432\u044b\u043c. \u0418\u0434\u0435\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f: \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0448\u044c ICMP echo \u0441 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u043c TTL, \u0436\u0434\u0451\u0448\u044c ICMP Time Exceeded \u043e\u0442 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0445\u043e\u043f\u0430, \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0448\u044c TTL. \u041d\u0430 \u0431\u0443\u043c\u0430\u0433\u0435 \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e. \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u0438 \u0434\u0432\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b:Setsockopt(IP_TTL) \u043d\u0430 SOCK_DGRAM ICMP-\u0441\u043e\u043a\u0435\u0442\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043f\u0440\u0438\u0437\u043d\u043e \u2014 \u0443 \u043c\u0435\u043d\u044f \u043d\u0435 \u0432\u0441\u0435 \u0445\u043e\u043f\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u0438 Time Exceeded, \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u044b\u043c \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0441\u0435\u0442\u044f\u043c\u0438.Matching \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u2014 \u043d\u0430 receive \u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0448\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u043e ICMP Time Exceeded, \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043b\u0435\u0436\u0438\u0442 \u0442\u0432\u043e\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442. \u0427\u0442\u043e\u0431\u044b \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 TTL-\u0448\u0430\u0433\u0443, \u043d\u0443\u0436\u043d\u043e \u043f\u0430\u0440\u0441\u0438\u0442\u044c inner-payload, \u0447\u0442\u043e \u043c\u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0445\u0440\u0443\u043f\u043a\u043e.\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u043b\u0441\u044f \u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 BSD-\u043f\u043e\u0434\u0445\u043e\u0434: UDP-\u043f\u0430\u043a\u0435\u0442\u044b \u043d\u0430 \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0435 \u043f\u043e\u0440\u0442\u044b \u0441 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u043c\u0441\u044f TTL, \u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0441\u043b\u0443\u0448\u0430\u0435\u043c ICMP-\u0441\u043e\u043a\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 Time Exceeded:let icmpSock = try ICMPSocket()  \/\/ \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u0451\u043c\u0430icmpSock.setTimeout(seconds: timeout)for ttl in 1&#8230;maxHops {    let udpSock = try UDPSocket()    udpSock.setTTL(ttl)    var dest = address    dest.sin_port = (port + UInt16(ttl &#8212; 1)).bigEndian  \/\/ 33434, 33435, &#8230;    let probe = Data(repeating: 0x40, count: 32)    let sendTime = CFAbsoluteTimeGetCurrent()    try udpSock.send(data: probe, to: dest)    let (data, fromIP) = try icmpSock.receive()    let rtt = CFAbsoluteTimeGetCurrent() &#8212; sendTime    \/\/ &#8230;}\u041f\u043e\u0440\u0442\u044b 33434+ttl \u2014 \u044d\u0442\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0432\u044b\u0431\u043e\u0440 traceroute(8) \u0435\u0449\u0451 \u0441 80-\u0445: \u043c\u0430\u043b\u043e\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043e\u043d\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u044b \u043d\u0430 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0445\u043e\u0441\u0442\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u044b \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0448\u044c \u043b\u0438\u0431\u043e ICMP Time Exceeded \u043e\u0442 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0445\u043e\u043f\u0430, \u043b\u0438\u0431\u043e ICMP Port Unreachable \u043e\u0442 destination \u2014 \u043e\u0431\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0435\u0434\u0438\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e.\u0427\u0442\u043e \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c: \u043d\u0430 iOS UDP_TTL \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 setsockopt(IP_TTL), \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 ICMP-\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430. \u0418 ICMP-\u0441\u043e\u043a\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u043a \u043f\u0430\u0441\u0441\u0438\u0432\u043d\u044b\u0439 \u043f\u0440\u0438\u0451\u043c\u043d\u0438\u043a \u2014 \u043c\u044b \u0438\u0437 \u043d\u0435\u0433\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0448\u043b\u0451\u043c, \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0442\u0430\u0435\u043c \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 Time Exceeded.\u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0445\u043e\u043f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e \u043f\u043e \u0434\u0432\u0443\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c:let isFinal = fromIP == destIP    || header.type == ICMPType.destinationUnreachable.rawValue\u0422\u043e \u0435\u0441\u0442\u044c \u043b\u0438\u0431\u043e \u043e\u0442\u0432\u0435\u0442 \u043f\u0440\u0438\u0448\u0451\u043b \u043e\u0442 \u0446\u0435\u043b\u0435\u0432\u043e\u0433\u043e IP (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0435\u0441\u043b\u0438 \u0441\u0430\u043c destination \u043f\u0440\u0438\u0441\u043b\u0430\u043b ICMP Port Unreachable), \u043b\u0438\u0431\u043e \u0442\u0438\u043f ICMP \u2014 Destination Unreachable.LAN-\u0441\u043a\u0430\u043d\u0435\u0440: ARP \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d\u0417\u0434\u0435\u0441\u044c iOS \u0440\u0435\u0436\u0435\u0442 \u0436\u0451\u0441\u0442\u0447\u0435. \u0422\u0435\u0431\u0435 \u043d\u0435 \u043e\u0442\u0434\u0430\u044e\u0442 ARP-\u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432 userspace. \u041d\u0435\u0442 API \u0442\u0438\u043f\u0430 getarp(), \u043d\u0435\u0442 \/proc\/net\/arp \u043a\u0430\u043a \u043d\u0430 Linux. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043f\u0440\u043e \u0438\u0434\u0435\u044e \u201c\u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c ARP-\u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0442\u043e \u0432 \u043b\u043e\u043a\u0430\u043b\u043a\u0435\u201d.\u0427\u0442\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e:Concurrent TCP connect \u043d\u0430 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u043f\u043e\u0440\u0442\u044b (80, 443, 22, 8080 \u0438 \u0442.\u0434.) \u2014 \u0435\u0441\u043b\u0438 \u0445\u043e\u0441\u0442 \u043e\u0442\u0432\u0435\u0442\u0438\u043b, \u043e\u043d \u0436\u0438\u0432\u043e\u0439. Raw SYN \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0438\u0437 userspace, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 TCP handshake.mDNS \/ Bonjour discovery \u0447\u0435\u0440\u0435\u0437 NetServiceBrowser \u0438\u043b\u0438 NWBrowser \u2014 \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u043f\u043e\u043b\u043d\u0430\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u0430, \u0432\u0438\u0434\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0430\u043c\u0438 \u0430\u043d\u043e\u043d\u0441\u0438\u0440\u0443\u044e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u044b.NSLocalNetworkUsageDescription \u0432 Info.plist \u2014 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0438\u043d\u0430\u0447\u0435 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u0430 \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 IP iOS \u043e\u0442\u043a\u0440\u043e\u0435\u0442 alert \u201cAllow Local Network Access\u201d, \u0438 \u0434\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.\u042f \u043f\u043e\u0448\u0451\u043b \u043f\u043e \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u043f\u0443\u0442\u0438 \u2014 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 TCP connect \u0447\u0435\u0440\u0435\u0437 withThrowingTaskGroup:private static let maxConcurrentProbes = 20func discoverHosts(localIP: String, subnetMask: String) -&gt; AsyncThrowingStream&lt;LANDevice, Error&gt; {    AsyncThrowingStream { continuation in        Task.detached {            let range = Self.calculateSubnetRange(ip: localIP, mask: subnetMask)            try await withThrowingTaskGroup(of: LANDevice?.self) { group in                var activeCount = 0                for ip in range {                    if activeCount &gt;= Self.maxConcurrentProbes {                        if let device = try? await group.next() {                            if let d = device { continuation.yield(d) }                        }                        activeCount -= 1                    }                    group.addTask {                        try await Self.probeHost(ip: ip)                    }                    activeCount += 1                }                for try await device in group {                    if let d = device { continuation.yield(d) }                }            }            continuation.finish()        }    }}\u041e\u0434\u0438\u043d connect() \u043d\u0430 \u043f\u043e\u0440\u0442 80 \u0441 \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u043e\u043c 500\u043c\u0441 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 IP \u0432 \/24 \u2014 \u0445\u043e\u0441\u0442 \u043b\u0438\u0431\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u0442 SYN+ACK (\u0436\u0438\u0432\u043e\u0439), \u043b\u0438\u0431\u043e RST (\u0436\u0438\u0432\u043e\u0439, \u043d\u043e \u043f\u043e\u0440\u0442 \u0437\u0430\u043a\u0440\u044b\u0442 \u2014 \u0442\u043e\u0436\u0435 \u0441\u0447\u0438\u0442\u0430\u044e \u0436\u0438\u0432\u044b\u043c), \u043b\u0438\u0431\u043e \u0442\u0430\u0439\u043c\u0430\u0443\u0442 (\u043c\u0451\u0440\u0442\u0432\u044b\u0439 \u0438\u043b\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u0442). \u0417\u0430 \u0441\u0447\u0451\u0442 maxConcurrentProbes = 20 \u0432\u0435\u0441\u044c \/24 \u043f\u0440\u043e\u0431\u0435\u0433\u0430\u0435\u0442\u0441\u044f \u0437\u0430 \u043f\u0430\u0440\u0443 \u0441\u0435\u043a\u0443\u043d\u0434.\u0427\u0442\u043e \u044f \u043d\u0435 \u0434\u0435\u043b\u0430\u044e, \u043d\u043e \u043c\u043e\u0433 \u0431\u044b:\u041d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e mDNS \u0434\u043b\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 (\u0435\u0441\u0442\u044c \u0432 TODO)\u041d\u0435 \u0434\u0435\u043b\u0430\u044e port scanning \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u2014 \u044d\u0442\u043e \u0443\u0436\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438\u0413\u0440\u0430\u0431\u043b\u044f, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u043b: \u043d\u0430 iOS 17 alert \u201cLocal Network Access\u201d \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437. \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043e\u0442\u043a\u0430\u0437\u0430\u043b \u2014 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u043e\u043f\u044b\u0442\u043a\u0430 connect() \u043c\u043e\u043b\u0447\u0430 \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u0438\u0442\u0441\u044f, \u0431\u0435\u0437 \u044f\u0432\u043d\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438. \u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0434\u0435\u043b\u0430\u0442\u044c UI-\u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0443 \u043f\u0440\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438.Host Monitor: BGTaskScheduler \u043a\u0430\u043a \u043e\u043d \u0435\u0441\u0442\u044c\u0421\u0430\u043c\u0430\u044f \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043d\u043e \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0445\u043e\u0447\u0435\u0442: \u201c\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u0445\u043e\u0441\u0442, \u0438 \u0435\u0441\u043b\u0438 \u043e\u043d \u0443\u043f\u0430\u0434\u0451\u0442 \u2014 \u043c\u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043f\u0443\u0448, \u043a\u0430\u043a \u0443 UptimeRobot\u201d. \u041d\u0430 iOS \u044d\u0442\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u201c\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u201d, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e:\u041d\u0435\u0442 background-thread, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0438\u0441\u0438\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u2014 iOS \u0443\u0431\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 ~30 \u0441\u0435\u043a\u0443\u043d\u0434 \u043f\u043e\u0441\u043b\u0435 \u0443\u0445\u043e\u0434\u0430 \u0432 background.Silent push \u043a\u0430\u043a \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c wake \u2014 \u0435\u0441\u0442\u044c, \u043d\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u0430 \u0443 \u043c\u0435\u043d\u044f \u0432\u0441\u0451 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0435.BGTaskScheduler \u2014 \u0434\u0430\u0451\u0442 ~30 \u0441\u0435\u043a\u0443\u043d\u0434 CPU \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0437 \u0432 15+ \u043c\u0438\u043d\u0443\u0442. iOS \u0441\u0430\u043c \u0440\u0435\u0448\u0430\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u0442\u0435\u0431\u044f \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f.\u0422\u043e \u0435\u0441\u0442\u044c \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u043d\u0430 iOS \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u043e \u0445\u0443\u0436\u0435, \u0447\u0435\u043c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435. \u042d\u0442\u043e \u043d\u0430\u0434\u043e \u0447\u0435\u0441\u0442\u043d\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u0442\u044c \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0438\u0437\u0430\u0439\u043d \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u044d\u0442\u043e\u0433\u043e.\u0427\u0442\u043e \u044f \u0434\u0435\u043b\u0430\u044e:BGTaskScheduler.shared.register(forTaskWithIdentifier: &#171;com.netdiag.hostmonitor&#187;, using: nil) { task in    Task {        await HostMonitorService.shared.runMonitoringPass()        task.setTaskCompleted(success: true)    }    submitNext()  \/\/ \u043f\u0435\u0440\u0435\u043f\u043e\u0434\u0430\u0451\u043c \u0437\u0430\u0434\u0430\u0447\u0443 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435}let request = BGAppRefreshTaskRequest(identifier: &#171;com.netdiag.hostmonitor&#187;)request.earliestBeginDate = Date(timeIntervalSinceNow: 15 * 60)  \/\/ \u043d\u0435 \u0440\u0430\u043d\u044c\u0448\u0435 \u0447\u0435\u043c \u0447\u0435\u0440\u0435\u0437 15 \u043c\u0438\u043dtry BGTaskScheduler.shared.submit(request)\u0418 \u0432\u043d\u0443\u0442\u0440\u0438 runMonitoringPass():\u0411\u0435\u0440\u0443 \u0432\u0441\u0435 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0445\u043e\u0441\u0442\u044b\u041f\u0438\u043d\u0433\u0443\u044e \u0438\u0445 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e (withTaskGroup) \u2014 \u0443\u0441\u043f\u0435\u0442\u044c \u0432 30-\u0441\u0435\u043a\u0443\u043d\u0434\u043d\u044b\u0439 \u0431\u044e\u0434\u0436\u0435\u0442\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e: \u0435\u0441\u043b\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c (up\u2192down \u0438\u043b\u0438 down\u2192up), \u0448\u043b\u044e local notification\u0415\u0441\u043b\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c \u2014 \u043c\u043e\u043b\u0447\u0443, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0441\u043f\u0430\u043c\u0438\u0442\u044c\u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0443\u0448\u0435\u0439 \u201c\u0445\u043e\u0441\u0442 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 up \u043a\u0430\u0436\u0434\u044b\u0435 5 \u043c\u0438\u043d\u0443\u0442\u201d, \u0442\u043e\u043b\u044c\u043a\u043e state transitions. \u042d\u0442\u043e \u0438 \u0431\u0438\u0442\u0432\u0443 \u0441 iOS background-\u043b\u0438\u043c\u0438\u0442\u0430\u043c\u0438 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0432\u044b\u0438\u0433\u0440\u0430\u0442\u044c, \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043d\u0435 \u043d\u0430\u0434\u043e\u0435\u0434\u0430\u0435\u0442.\u0413\u0440\u0430\u0431\u043b\u044f: BGTaskScheduler \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435. \u0422\u043e\u0447\u043d\u0435\u0435, \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0442\u044b \u0440\u0443\u043a\u0430\u043c\u0438 \u0434\u0451\u0440\u043d\u0435\u0448\u044c \u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 debugger:e -l objc &#8212; (void)[[BGTaskScheduler sharedScheduler]&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-480659","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/480659","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=480659"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/480659\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=480659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=480659"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=480659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}