├── .swift-version
├── .codecov.yml
├── GCXMulticastDNSKit.xcodeproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
├── xcshareddata
│ └── xcschemes
│ │ └── GCXMulticastDNSKit.xcscheme
└── project.pbxproj
├── GCXMulticastDNSKit.podspec
├── GCXMulticastDNSKitTests
├── Info.plist
└── GCXDiscoveryTests.swift
├── GCXMulticastDNSKit
├── Info.plist
├── DiscoveryConfiguration.swift
└── Discovery.swift
├── .swiftlint.yml
├── Package.swift
├── .gitignore
├── README.md
└── LICENSE.txt
/.swift-version:
--------------------------------------------------------------------------------
1 | 5.0
2 |
--------------------------------------------------------------------------------
/.codecov.yml:
--------------------------------------------------------------------------------
1 | ignore:
2 | - "GCXMulticastDNSKitTests"
3 |
4 | coverage:
5 | range: 70..100
6 |
--------------------------------------------------------------------------------
/GCXMulticastDNSKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/GCXMulticastDNSKit.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |spec|
2 | spec.name = "GCXMulticastDNSKit"
3 | spec.version = "1.4.0"
4 | spec.summary = "mDNS discovery framework for iOS."
5 | spec.homepage = "https://github.com/grandcentrix/GCXMulticastDNSKit"
6 | spec.license = { :type => 'Apache License, Version 2.0', :file => 'LICENSE.txt' }
7 | spec.authors = { "Christian Netthöfel" => 'christian.netthoefel@grandcentrix.net' }
8 | spec.social_media_url = "http://twitter.com/grandcentrix"
9 | spec.platform = :ios, "9.0"
10 | spec.source = { git: "https://github.com/grandcentrix/GCXMulticastDNSKit.git", tag: "v#{spec.version}"}
11 | spec.source_files = "GCXMulticastDNSKit/**/*.{swift}"
12 | spec.swift_version = "5.0"
13 | end
14 |
--------------------------------------------------------------------------------
/GCXMulticastDNSKitTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/GCXMulticastDNSKit/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.4.0
19 | CFBundleVersion
20 | $(CURRENT_PROJECT_VERSION)
21 | NSPrincipalClass
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/.swiftlint.yml:
--------------------------------------------------------------------------------
1 | included:
2 | - GCXMulticastDNSKit
3 | excluded: # paths to ignore during linting. Takes precedence over `included`.
4 | - GCXMulticastDNSKitTests
5 | disabled_rules: # rule identifiers to exclude from running
6 | - line_length
7 | - trailing_whitespace
8 | - todo
9 | opt_in_rules:
10 | - array_init
11 | - attributes
12 | - closure_end_indentation
13 | - closure_spacing
14 | - empty_count
15 | - fatal_error_message
16 | - first_where
17 | - force_unwrapping
18 | - number_separator
19 | - prohibited_super_call
20 | - overridden_super_call
21 | - redundant_nil_coalescing
22 | - sorted_imports
23 | - sorted_first_last
24 | - trailing_closure
25 | vertical_whitespace:
26 | max_empty_lines: 2
27 | identifier_name:
28 | max_length: 150
29 | excluded:
30 | - id
31 | - on
32 | - up
33 | - ok
34 | type_name:
35 | max_length: 150
--------------------------------------------------------------------------------
/GCXMulticastDNSKit/DiscoveryConfiguration.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DiscoveryConfiguration.swift
3 | // GCXMulticastDNSKit
4 | //
5 | // Copyright 2017 grandcentrix GmbH
6 | //
7 | // Licensed under the Apache License, Version 2.0 (the "License");
8 | // you may not use this file except in compliance with the License.
9 | // You may obtain a copy of the License at
10 | //
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | //
13 | // Unless required by applicable law or agreed to in writing, software
14 | // distributed under the License is distributed on an "AS IS" BASIS,
15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | // See the License for the specific language governing permissions and
17 | // limitations under the License.
18 |
19 | import Foundation
20 |
21 | public class DiscoveryConfiguration: NSObject {
22 | public let serviceType: String
23 | public var serviceNamePrefix: String?
24 |
25 | public init(serviceType: String, serviceNamePrefix: String?) {
26 | self.serviceType = serviceType
27 | self.serviceNamePrefix = serviceNamePrefix
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Package.swift:
--------------------------------------------------------------------------------
1 | // swift-tools-version:5.2
2 | // The swift-tools-version declares the minimum version of Swift required to build this package.
3 |
4 | import PackageDescription
5 |
6 | let package = Package(
7 | name: "GCXMulticastDNSKit",
8 | platforms: [
9 | .iOS(.v9),
10 | ],
11 | products: [
12 | // Products define the executables and libraries produced by a package, and make them visible to other packages.
13 | .library(
14 | name: "GCXMulticastDNSKit",
15 | targets: ["GCXMulticastDNSKit"]),
16 | ],
17 | dependencies: [
18 | // Dependencies declare other packages that this package depends on.
19 | // .package(url: /* package url */, from: "1.0.0"),
20 | ],
21 | targets: [
22 | // Targets are the basic building blocks of a package. A target can define a module or a test suite.
23 | // Targets can depend on other targets in this package, and on products in packages which this package depends on.
24 | .target(
25 | name: "GCXMulticastDNSKit",
26 | dependencies: [],
27 | path: "GCXMulticastDNSKit"),
28 | .testTarget(
29 | name: "GCXMulticastDNSKitTests",
30 | dependencies: ["GCXMulticastDNSKit"],
31 | path: "GCXMulticastDNSKitTests"),
32 | ],
33 | swiftLanguageVersions: [.v5]
34 | )
35 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ############################
2 | # OS X temporary files #
3 | ############################
4 | .Trashes
5 | .DS_Store
6 | *.swp
7 | *.lock
8 |
9 | ############################
10 | # Xcode temporary files #
11 | ############################
12 | *~.nib
13 |
14 | ############################
15 | # Xcode build files #
16 | ############################
17 | DerivedData/
18 | DerivedData
19 | build/
20 |
21 | ############################
22 | # Xcode private settings #
23 | ############################
24 | *.pbxuser
25 | *.mode1v3
26 | *.mode2v3
27 | *.perspectivev3
28 |
29 | # withelist the defaults
30 | !default.pbxuser
31 | !default.mode1v3
32 | !default.mode2v3
33 | !default.perspectivev3
34 |
35 | ############################
36 | # Xcode misc files #
37 | ############################
38 | xcuserdata/
39 | xcuserdata
40 | *.xcuserstate
41 | *.xcscmblueprint
42 |
43 | ############################
44 | # Xcode source control #
45 | ############################
46 | *.xccheckout
47 |
48 | ############################
49 | # Xcode deprecated classes #
50 | ############################
51 | *.moved-aside
52 |
53 | ############################
54 | # Xcode workspace #
55 | ############################
56 | *.xcworkspace
57 |
58 | ############################
59 | # Obj-C/Swift specific #
60 | ############################
61 | *.hmap
62 | *.ipa
63 |
64 | ############################
65 | # JetBrains IDEs files #
66 | ############################
67 | .idea/
68 |
69 | ############################
70 | # Ruby #
71 | ############################
72 | # Gemfile.lock
73 |
74 | ############################
75 | # Cocoapods #
76 | ############################
77 | Pods/
78 |
79 | ############################
80 | # Carthage #
81 | ############################
82 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
83 | # Carthage/Checkouts
84 | Carthage
85 |
86 | ############################
87 | # Fastlane #
88 | ############################
89 | fastlane/report.xml
90 | fastlane/screenshots
91 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # GCXMulticastDNSKit
2 | [](https://opensource.org/licenses/Apache-2.0)  [](https://github.com/Carthage/Carthage) [](https://cocoapods.org/)
3 |
4 |
5 | Multicast DNS framework for iOS
6 |
7 | ## Abtract
8 |
9 | GCXMulticastDNSKit is a framework that can be used to discover network services that are announced on the local network. It is a wrapper for the network services provided by Apple.
10 |
11 | ## Introduction
12 |
13 | mDNS is a service to resolve hostnames on a local network without the use of a central domain name server. Instead a resolving host simply sends a DNS query to a local multicast address and the host with that name responds with a multicast message with its IP address. Multicast DNS is also used in combination with DNS based service discovery where a host that provides a network service can announce its service to the local network. Those services can then be discovered using multicast messages
14 |
15 | See: [1] [Multicast DNS](https://en.wikipedia.org/wiki/Multicast_DNS)
16 | [2] [Zeroconf Service discovery](https://en.wikipedia.org/wiki/Zero-configuration_networking#Service_discovery)
17 |
18 | This framework currenlty provides functionality to discover services on the local network based on their service type and service name.
19 |
20 | ## Installation
21 |
22 | ### Cocoapods
23 |
24 | ```ruby
25 | use_frameworks!
26 |
27 | pod 'GCXMulticastDNSKit', :git => 'https://github.com/grandcentrix/GCXMulticastDNSKit.git', :tag => 'v1.4.0'
28 |
29 | ```
30 |
31 | ### Carthage
32 |
33 | ```ruby
34 | git "https://github.com/grandcentrix/GCXMulticastDNSKit.git" ~> 1.4.0
35 |
36 | ```
37 |
38 | ### Swift Package Manager
39 |
40 | [Swift Package Manager](https://swift.org/package-manager/) is a dependency manager built into Xcode. GCXMulticastDNSKit supports SPM from version 5.2.0.
41 |
42 | If you are using Xcode 11 or higher, go to `File` -> `Swift Packages` -> `Add Package Dependency` and enter the [package repository URL](https://github.com/grandcentrix/GCXMulticastDNSKit.git), then follow the instructions.
43 |
44 | ## Usage
45 |
46 | To use this framework we assume that you know the service type of the services (for example `_ptp._tcp` is valid service type for PTP/IP services, another example would be `_http._tcp`). Because there can be more than one service that provides functionality you can also specify an optional prefix for service name that must match. For the example below we are looking for PTP compatible cameras from Vendor A. Those announce themselves with a PTP service type and a services name of `Vendor A (#serialnr)`. We want to find all VendorA cameras on the local network so we use `_ptp._tcp` as service type and `Vendor A` as service name prefix:
47 |
48 | ```swift
49 | let configurations = [DiscoveryConfiguration(serviceType: "_ptp._tcp",
50 | serviceNamePrefix: "Vendor A")]
51 |
52 | discovery = Discovery(with: configurations, delegate: self)
53 | discovery?.startDiscovery()
54 |
55 | ```
56 |
57 | ## License
58 |
59 | ```
60 | Copyright 2017 grandcentrix GmbH
61 |
62 | Licensed under the Apache License, Version 2.0 (the "License");
63 | you may not use this file except in compliance with the License.
64 | You may obtain a copy of the License at
65 |
66 | http://www.apache.org/licenses/LICENSE-2.0
67 |
68 | Unless required by applicable law or agreed to in writing, software
69 | distributed under the License is distributed on an "AS IS" BASIS,
70 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
71 | See the License for the specific language governing permissions and
72 | limitations under the License.
73 | ```
74 |
--------------------------------------------------------------------------------
/GCXMulticastDNSKit.xcodeproj/xcshareddata/xcschemes/GCXMulticastDNSKit.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
42 |
48 |
49 |
50 |
51 |
52 |
62 |
63 |
69 |
70 |
71 |
72 |
78 |
79 |
85 |
86 |
87 |
88 |
90 |
91 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/GCXMulticastDNSKitTests/GCXDiscoveryTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // GCXDiscoveryTests.swift
3 | // GCXMulticastDNSKit
4 | //
5 | // Copyright 2017 grandcentrix GmbH
6 | //
7 | // Licensed under the Apache License, Version 2.0 (the "License");
8 | // you may not use this file except in compliance with the License.
9 | // You may obtain a copy of the License at
10 | //
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | //
13 | // Unless required by applicable law or agreed to in writing, software
14 | // distributed under the License is distributed on an "AS IS" BASIS,
15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | // See the License for the specific language governing permissions and
17 | // limitations under the License.
18 |
19 | import XCTest
20 | @testable import GCXMulticastDNSKit
21 |
22 |
23 | class GCXDiscoveryTests: XCTestCase {
24 |
25 | var service: NetService?
26 | var didDiscoverExpectation: XCTestExpectation?
27 |
28 | var discovery: Discovery?
29 |
30 | override func tearDown() {
31 | service?.stop()
32 | discovery?.stopDiscovery()
33 | discovery = nil
34 | }
35 |
36 | func testThatInitialzationWithEmptyConfigurationReturnsNil() {
37 | let disovery = Discovery(with: [], delegate: self)
38 | XCTAssertNil(disovery)
39 | }
40 |
41 | func testThatInitialzationWithValidConfigurationReturnsObject() {
42 | let configuration = DiscoveryConfiguration(serviceType: "testService", serviceNamePrefix: nil)
43 | let disovery = Discovery(with: [configuration], delegate: self)
44 | XCTAssertNotNil(disovery)
45 | }
46 |
47 | func testThatInitialzationForClosuresWithEmptyConfigurationReturnsNil() {
48 | let disovery = Discovery(with: [], discoverHandler: nil, failHandler: nil, serviceRemovedHandler: nil)
49 | XCTAssertNil(disovery)
50 | }
51 |
52 | func testThatInitialzationForClosuresWithValidConfigurationReturnsObject() {
53 | let configuration = DiscoveryConfiguration(serviceType: "testService", serviceNamePrefix: nil)
54 | let disovery = Discovery(with: [configuration], discoverHandler: nil, failHandler: nil, serviceRemovedHandler: nil)
55 | XCTAssertNotNil(disovery)
56 | }
57 |
58 | func testThatDiscoveryIsStoppedBeforeStartingANewDiscovery() {
59 | let discoveryConfiguration = DiscoveryConfiguration(serviceType: "serviceType", serviceNamePrefix: nil)
60 |
61 | class DiscoveryMock : Discovery {
62 | var expectation: XCTestExpectation?
63 |
64 | override func stopDiscovery() {
65 | expectation?.fulfill()
66 | super.stopDiscovery()
67 | }
68 | }
69 | guard let discovery = DiscoveryMock(with: [ discoveryConfiguration], delegate: self) else {
70 | XCTAssertTrue(false, "Could not initialize discovery")
71 | return
72 | }
73 |
74 | discovery.expectation = self.expectation(description: "stopDiscovery is called before starting")
75 | discovery.startDiscovery()
76 | waitForExpectations(timeout: 0, handler: nil)
77 | }
78 |
79 |
80 | func testThatAPublishedServiceIsDiscoveredUsingDelegate() {
81 | service = NetService(domain: "", type: "_http._tcp", name: "GCXDNSKitTest", port: 10000 )
82 | service?.publish()
83 |
84 | let discoveryConfiguration = DiscoveryConfiguration(serviceType: "_http._tcp", serviceNamePrefix: "GCXDNSKitTest")
85 |
86 | guard let discovery = Discovery(with: [ discoveryConfiguration], delegate: self) else {
87 | XCTAssertTrue(false, "Could not initialize discovery")
88 | return
89 | }
90 |
91 | self.discovery = discovery
92 | didDiscoverExpectation = self.expectation(description: "disovery did discover service")
93 | discovery.startDiscovery()
94 | waitForExpectations(timeout: 10, handler: nil)
95 | }
96 |
97 | func testThatAPublishedServiceIsDiscoveredUsingClosures() {
98 | service = NetService(domain: "", type: "_http._tcp", name: "GCXDNSKitTest", port: 10000 )
99 | service?.publish()
100 |
101 | didDiscoverExpectation = self.expectation(description: "disovery did discover service")
102 |
103 | let discoveryConfiguration = DiscoveryConfiguration(serviceType: "_http._tcp", serviceNamePrefix: "GCXDNSKitTest")
104 | guard let discovery = Discovery(with: [ discoveryConfiguration ], discoverHandler: { [unowned self] (service) in
105 | self.didDiscoverExpectation?.fulfill()
106 | }, failHandler: nil, serviceRemovedHandler: nil) else {
107 | XCTAssertTrue(false, "Could not initialize discovery")
108 | return
109 | }
110 |
111 | self.discovery = discovery
112 | discovery.startDiscovery()
113 | waitForExpectations(timeout: 10, handler: nil)
114 | }
115 | }
116 |
117 | extension GCXDiscoveryTests: DiscoveryDelegate{
118 |
119 | func discoveryDidDiscover(service: DiscoveryService) {
120 | didDiscoverExpectation?.fulfill()
121 | }
122 |
123 | func discoveryDidDisappear(service: DiscoveryService) {
124 | }
125 |
126 | func discoveryDidFail(configuration: DiscoveryConfiguration, error: DiscoveryError) {
127 | }
128 | }
129 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright 2017 grandcentrix GmbH
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/GCXMulticastDNSKit/Discovery.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Discovery.swift
3 | // GCXMulticastDNSKit
4 | //
5 | // Copyright 2017 grandcentrix GmbH
6 | //
7 | // Licensed under the Apache License, Version 2.0 (the "License");
8 | // you may not use this file except in compliance with the License.
9 | // You may obtain a copy of the License at
10 | //
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | //
13 | // Unless required by applicable law or agreed to in writing, software
14 | // distributed under the License is distributed on an "AS IS" BASIS,
15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | // See the License for the specific language governing permissions and
17 | // limitations under the License.
18 |
19 | import Foundation
20 |
21 | public typealias DiscoveryDiscoverHandler = (DiscoveryService) -> Void
22 | public typealias DiscoveryFailHandler = (DiscoveryConfiguration, DiscoveryError) -> Void
23 | public typealias DiscoveryServiceRemovedHandler = (DiscoveryService) -> Void
24 |
25 |
26 | /// a private class that encapsulates all information for a specific service discovery
27 | private class DiscoveryItem {
28 |
29 | /// the configuration used for this discovery
30 | var configuration: DiscoveryConfiguration
31 |
32 | /// the net service browser used to discover this service
33 | var netServiceBrowser = NetServiceBrowser()
34 |
35 | /// the found net services
36 | var netServices: Set = Set()
37 |
38 |
39 | /// designated initializer, must be initialized with a configuration
40 | ///
41 | /// - Parameter configuration: the configuration
42 | init(with configuration: DiscoveryConfiguration) {
43 | self.configuration = configuration
44 | }
45 |
46 |
47 | /// checks if a service instance is valid for this discovery configuration
48 | ///
49 | /// - Parameter netService: the net service to check
50 | /// - Returns: true if the net service matches the configuration's spec, else false
51 | func isValidForService(netService: NetService) -> Bool {
52 | guard let serviceNamePrefix = configuration.serviceNamePrefix else {
53 | // when no service name prefix is specified, all services are valid
54 | return true
55 | }
56 | return netService.name.hasPrefix(serviceNamePrefix)
57 | }
58 | }
59 |
60 |
61 | /// a structure to enapsulate the result of a service discovery, this is returned
62 | public class DiscoveryService: NSObject {
63 |
64 | /// the configuration used to search
65 | public let configuration: DiscoveryConfiguration
66 |
67 | /// the found service
68 | public let netService: NetService
69 |
70 | public init(configuration: DiscoveryConfiguration, netService: NetService) {
71 | self.configuration = configuration
72 | self.netService = netService
73 | super.init()
74 | }
75 | }
76 |
77 |
78 | /// the errors that can occur whilst searching for services
79 | ///
80 | /// - unknown: a unknown error
81 | /// - browsingFailure: failed to browse
82 | /// - resolvingTimeout: timeout while resolving
83 | /// - resolvingFailure: a general failure while resolving
84 | public enum DiscoveryError: Int, Error {
85 | case unknown
86 | case browsingFailure
87 | case resolvingTimeout
88 | case resolvingFailure
89 | }
90 |
91 |
92 | /// the protocol used for the delegate
93 | public protocol DiscoveryDelegate: AnyObject {
94 |
95 | /// called when a service has been discovered and resolved. Can be called multiple times for a
96 | /// search when more than one matching service is found. Is only called while in search mode.
97 | ///
98 | /// - Parameter service: the found service
99 | func discoveryDidDiscover(service: DiscoveryService)
100 |
101 |
102 | /// called when the discovery for a configuration fails. Can be called multiple times for a
103 | /// search when more than one matching service is present and some of them fail to resolve.
104 | /// Is only called while in search mode.
105 | ///
106 | /// - Parameters:
107 | /// - configuration: the configuration
108 | /// - error: the reason for the fail
109 | func discoveryDidFail(configuration: DiscoveryConfiguration, error: DiscoveryError)
110 |
111 |
112 | /// called when a service disappers, can be called multiple times. Is only called while in search mode.
113 | ///
114 | /// - Parameter service: the service that disappeared
115 | func discoveryDidDisappear(service: DiscoveryService)
116 | }
117 |
118 | // MARK: - public interface
119 |
120 |
121 | /// the class to use to discover service on the network. Initialize a new instance with an array of
122 | /// configurations and start the search.
123 | public class Discovery: NSObject {
124 |
125 |
126 | /// the default search domain, empty string means .local.
127 | /// Should be sufficient for 99% of the use cases
128 | private let defaultMDNSDomain = ""
129 |
130 | /// the timeout for resolving a service
131 | private var serviceResolveTimeout: TimeInterval
132 |
133 | /// the configurations used for the search
134 | private var configurations: [DiscoveryConfiguration]
135 |
136 | /// the local models to manage the search
137 | private var items: [DiscoveryItem]?
138 |
139 | /// the delegate
140 | public weak var delegate: DiscoveryDelegate?
141 |
142 |
143 | /// the completion closures
144 | private var discoverHandler: DiscoveryDiscoverHandler?
145 | private var failHandler: DiscoveryFailHandler?
146 | private var serviceRemovedHandler: DiscoveryServiceRemovedHandler?
147 |
148 | /// the designated initializer. creates a new discovery for the specified configurations
149 | ///
150 | /// - Parameters:
151 | /// - configurations: an array of GCXDiscoveryConfiguration instance. Must contain at least one config or the init will fail
152 | /// - delegate: the delegate
153 | public init?(with configurations: [DiscoveryConfiguration],
154 | delegate: DiscoveryDelegate,
155 | serviceResolveTimeout: TimeInterval = 10) {
156 | if configurations.isEmpty {
157 | return nil
158 | }
159 |
160 | self.configurations = configurations
161 | self.delegate = delegate
162 | self.serviceResolveTimeout = serviceResolveTimeout
163 | }
164 |
165 | /// optional initializer. creates a new discovery utilizing callbacks
166 | ///
167 | /// - Parameters:
168 | /// - configurations: an array of GCXDiscoveryConfiguration instance. Must contain at least one config or the init will fail
169 | /// - discoverHandler: callback for discovery success
170 | /// - failHandler: callback for discovery fail
171 | /// - serviceRemovedHandler: callback for service removal
172 | /// - serviceResolveTimeout: callback for occurred timeouts
173 | public init?(with configurations: [DiscoveryConfiguration],
174 | discoverHandler: DiscoveryDiscoverHandler?,
175 | failHandler: DiscoveryFailHandler?,
176 | serviceRemovedHandler: DiscoveryServiceRemovedHandler?,
177 | serviceResolveTimeout: TimeInterval = 10) {
178 | if configurations.isEmpty {
179 | return nil
180 | }
181 |
182 | self.configurations = configurations
183 | self.discoverHandler = discoverHandler
184 | self.failHandler = failHandler
185 | self.serviceRemovedHandler = serviceRemovedHandler
186 | self.serviceResolveTimeout = serviceResolveTimeout
187 | }
188 |
189 | // sanity workaround for http://www.openradar.me/28943305, also see https://github.com/grandcentrix/GCXMulticastDNSKit/issues/11
190 | deinit {
191 | stopSearchingAndResolving()
192 | }
193 |
194 | /// starts the discovery process
195 | public func startDiscovery() {
196 | stopDiscovery()
197 | initializeItems()
198 | }
199 |
200 | /// stops the discovery process
201 | public func stopDiscovery() {
202 | stopSearchingAndResolving()
203 | }
204 | }
205 |
206 | // MARK: - private methods
207 | extension Discovery {
208 |
209 | /// creates the models from the configurations and starts the search for the services
210 | private func initializeItems() {
211 | items = configurations.map {
212 | let item = DiscoveryItem(with: $0)
213 | item.netServiceBrowser.delegate = self
214 | item.netServiceBrowser.searchForServices(ofType: item.configuration.serviceType, inDomain: defaultMDNSDomain)
215 | return item
216 | }
217 | }
218 |
219 | /// stops all search and resolve operations
220 | private func stopSearchingAndResolving() {
221 | items?.forEach {
222 | $0.netServiceBrowser.stop()
223 | // set delegate to nil to circumvent http://www.openradar.me/28943305
224 | $0.netServiceBrowser.delegate = nil
225 | $0.netServices.forEach {
226 | $0.stop()
227 | $0.delegate = nil
228 | }
229 | }
230 |
231 | items = nil
232 | }
233 |
234 | /// lookup for an item from a net service
235 | private func item(service: NetService) -> DiscoveryItem? {
236 | return items?.first { $0.netServices.contains(service) }
237 | }
238 |
239 | /// lookup for an item from a net service browser
240 | private func item(serviceBrowser: NetServiceBrowser) -> DiscoveryItem? {
241 | return items?.first { $0.netServiceBrowser == serviceBrowser }
242 | }
243 | }
244 |
245 | // MARK: - Delegate notifiction helpers
246 | extension Discovery {
247 |
248 | private func notifyDiscoveryDidDiscover(service: DiscoveryService) {
249 | DispatchQueue.main.async { [weak self] () -> Void in
250 | guard let strongSelf = self else { return }
251 | strongSelf.delegate?.discoveryDidDiscover(service: service)
252 | strongSelf.discoverHandler?(service)
253 | }
254 | }
255 |
256 | private func notifyDiscoveryDidFail(configuration: DiscoveryConfiguration, error: DiscoveryError) {
257 | DispatchQueue.main.async { [weak self] () -> Void in
258 | guard let strongSelf = self else { return }
259 | strongSelf.delegate?.discoveryDidFail(configuration: configuration, error: error)
260 | strongSelf.failHandler?(configuration, error)
261 | }
262 | }
263 |
264 | private func notifyDiscoveryServiceDidDisappear(service: DiscoveryService) {
265 | DispatchQueue.main.async { [weak self] () -> Void in
266 | guard let strongSelf = self else { return }
267 | strongSelf.delegate?.discoveryDidDisappear(service: service)
268 | strongSelf.serviceRemovedHandler?(service)
269 | }
270 | }
271 | }
272 |
273 | // MARK: - NetServiceBrowserDelegate
274 | extension Discovery: NetServiceBrowserDelegate {
275 |
276 | public func netServiceBrowser(_ browser: NetServiceBrowser, didFind service: NetService, moreComing: Bool) {
277 | guard let item = item(serviceBrowser: browser) else { return }
278 |
279 | if item.isValidForService(netService: service) {
280 | item.netServices.insert(service)
281 | service.delegate = self
282 | service.resolve(withTimeout: serviceResolveTimeout)
283 | }
284 | }
285 |
286 | public func netServiceBrowser(_ browser: NetServiceBrowser, didNotSearch errorDict: [String: NSNumber]) {
287 | guard let item = item(serviceBrowser: browser) else { return }
288 |
289 | if let errorCode = errorDict[NetService.errorCode] as? Int {
290 | if let netServiceError = NetService.ErrorCode(rawValue: errorCode) {
291 | switch netServiceError {
292 | // when unknown error is received, browsing has stopped and must be restarted.
293 | // this happens when the app suspends/resumes
294 | case .unknownError:
295 | // notify the caller that all existing discovered services have dissapeared
296 | for service in item.netServices {
297 | notifyDiscoveryServiceDidDisappear(service: DiscoveryService(configuration: item.configuration, netService: service))
298 | }
299 | // immediately restart discovery
300 | self.startDiscovery()
301 |
302 | // don't send .browsingFailure
303 | return
304 | default:
305 | break
306 | }
307 | }
308 | }
309 |
310 | // other failures should be returned because it could be a configuration error
311 | notifyDiscoveryDidFail(configuration: item.configuration, error: .browsingFailure)
312 | }
313 |
314 | public func netServiceBrowser(_ browser: NetServiceBrowser, didRemove service: NetService, moreComing: Bool) {
315 | guard let item = item(service: service) else { return }
316 |
317 | item.netServices.remove(service)
318 |
319 | notifyDiscoveryServiceDidDisappear(service: DiscoveryService(configuration: item.configuration, netService: service))
320 | }
321 | }
322 |
323 | // MARK: - NetServiceDelegate
324 | extension Discovery: NetServiceDelegate {
325 |
326 | public func netServiceDidResolveAddress(_ sender: NetService) {
327 | guard let item = item(service: sender) else { return }
328 |
329 | notifyDiscoveryDidDiscover(service: DiscoveryService(configuration: item.configuration, netService: sender))
330 | }
331 |
332 | public func netService(_ sender: NetService, didNotResolve errorDict: [String: NSNumber]) {
333 | guard let item = item(service: sender) else { return }
334 |
335 | notifyDiscoveryDidFail(configuration: item.configuration, error: .resolvingFailure)
336 | }
337 | }
338 |
--------------------------------------------------------------------------------
/GCXMulticastDNSKit.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 68B792891E69620900A482A8 /* GCXDiscoveryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68B792881E69620900A482A8 /* GCXDiscoveryTests.swift */; };
11 | 68FF3C211E24DDDF00A482A8 /* GCXMulticastDNSKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 68FF3C171E24DDDF00A482A8 /* GCXMulticastDNSKit.framework */; };
12 | 68FF3C4C1E24E6A700A482A8 /* Discovery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68FF3C4B1E24E6A700A482A8 /* Discovery.swift */; };
13 | 68FF3C4E1E24E6D400A482A8 /* DiscoveryConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68FF3C4D1E24E6D400A482A8 /* DiscoveryConfiguration.swift */; };
14 | /* End PBXBuildFile section */
15 |
16 | /* Begin PBXContainerItemProxy section */
17 | 68FF3C221E24DDDF00A482A8 /* PBXContainerItemProxy */ = {
18 | isa = PBXContainerItemProxy;
19 | containerPortal = 68FF3C0E1E24DDDF00A482A8 /* Project object */;
20 | proxyType = 1;
21 | remoteGlobalIDString = 68FF3C161E24DDDF00A482A8;
22 | remoteInfo = GCXMulticastDNSKit;
23 | };
24 | /* End PBXContainerItemProxy section */
25 |
26 | /* Begin PBXFileReference section */
27 | 68B792881E69620900A482A8 /* GCXDiscoveryTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GCXDiscoveryTests.swift; sourceTree = ""; };
28 | 68FF3C171E24DDDF00A482A8 /* GCXMulticastDNSKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GCXMulticastDNSKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
29 | 68FF3C1B1E24DDDF00A482A8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
30 | 68FF3C201E24DDDF00A482A8 /* GCXMulticastDNSKitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GCXMulticastDNSKitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
31 | 68FF3C271E24DDDF00A482A8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
32 | 68FF3C4B1E24E6A700A482A8 /* Discovery.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Discovery.swift; sourceTree = ""; };
33 | 68FF3C4D1E24E6D400A482A8 /* DiscoveryConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DiscoveryConfiguration.swift; sourceTree = ""; };
34 | 68FF3C7B1E2621C100A482A8 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; };
35 | /* End PBXFileReference section */
36 |
37 | /* Begin PBXFrameworksBuildPhase section */
38 | 68FF3C131E24DDDF00A482A8 /* Frameworks */ = {
39 | isa = PBXFrameworksBuildPhase;
40 | buildActionMask = 2147483647;
41 | files = (
42 | );
43 | runOnlyForDeploymentPostprocessing = 0;
44 | };
45 | 68FF3C1D1E24DDDF00A482A8 /* Frameworks */ = {
46 | isa = PBXFrameworksBuildPhase;
47 | buildActionMask = 2147483647;
48 | files = (
49 | 68FF3C211E24DDDF00A482A8 /* GCXMulticastDNSKit.framework in Frameworks */,
50 | );
51 | runOnlyForDeploymentPostprocessing = 0;
52 | };
53 | /* End PBXFrameworksBuildPhase section */
54 |
55 | /* Begin PBXGroup section */
56 | 68B792871E6961D000A482A8 /* Unit Tests */ = {
57 | isa = PBXGroup;
58 | children = (
59 | 68B792881E69620900A482A8 /* GCXDiscoveryTests.swift */,
60 | );
61 | name = "Unit Tests";
62 | sourceTree = "";
63 | };
64 | 68FF3C0D1E24DDDF00A482A8 = {
65 | isa = PBXGroup;
66 | children = (
67 | 68FF3C191E24DDDF00A482A8 /* GCXMulticastDNSKit */,
68 | 68FF3C241E24DDDF00A482A8 /* GCXMulticastDNSKitTests */,
69 | 68FF3C181E24DDDF00A482A8 /* Products */,
70 | );
71 | sourceTree = "";
72 | };
73 | 68FF3C181E24DDDF00A482A8 /* Products */ = {
74 | isa = PBXGroup;
75 | children = (
76 | 68FF3C171E24DDDF00A482A8 /* GCXMulticastDNSKit.framework */,
77 | 68FF3C201E24DDDF00A482A8 /* GCXMulticastDNSKitTests.xctest */,
78 | );
79 | name = Products;
80 | sourceTree = "";
81 | };
82 | 68FF3C191E24DDDF00A482A8 /* GCXMulticastDNSKit */ = {
83 | isa = PBXGroup;
84 | children = (
85 | 68FF3C7B1E2621C100A482A8 /* README.md */,
86 | 68FF3C1B1E24DDDF00A482A8 /* Info.plist */,
87 | 68FF3C4B1E24E6A700A482A8 /* Discovery.swift */,
88 | 68FF3C4D1E24E6D400A482A8 /* DiscoveryConfiguration.swift */,
89 | );
90 | path = GCXMulticastDNSKit;
91 | sourceTree = "";
92 | };
93 | 68FF3C241E24DDDF00A482A8 /* GCXMulticastDNSKitTests */ = {
94 | isa = PBXGroup;
95 | children = (
96 | 68B792871E6961D000A482A8 /* Unit Tests */,
97 | 68FF3C271E24DDDF00A482A8 /* Info.plist */,
98 | );
99 | path = GCXMulticastDNSKitTests;
100 | sourceTree = "";
101 | };
102 | /* End PBXGroup section */
103 |
104 | /* Begin PBXHeadersBuildPhase section */
105 | 68FF3C141E24DDDF00A482A8 /* Headers */ = {
106 | isa = PBXHeadersBuildPhase;
107 | buildActionMask = 2147483647;
108 | files = (
109 | );
110 | runOnlyForDeploymentPostprocessing = 0;
111 | };
112 | /* End PBXHeadersBuildPhase section */
113 |
114 | /* Begin PBXNativeTarget section */
115 | 68FF3C161E24DDDF00A482A8 /* GCXMulticastDNSKit */ = {
116 | isa = PBXNativeTarget;
117 | buildConfigurationList = 68FF3C2B1E24DDDF00A482A8 /* Build configuration list for PBXNativeTarget "GCXMulticastDNSKit" */;
118 | buildPhases = (
119 | 68FF3C121E24DDDF00A482A8 /* Sources */,
120 | 68FF3C131E24DDDF00A482A8 /* Frameworks */,
121 | 68FF3C141E24DDDF00A482A8 /* Headers */,
122 | 68FF3C151E24DDDF00A482A8 /* Resources */,
123 | 4F16EA7B2045A00500F4FE07 /* ShellScript */,
124 | );
125 | buildRules = (
126 | );
127 | dependencies = (
128 | );
129 | name = GCXMulticastDNSKit;
130 | productName = GCXMulticastDNSKit;
131 | productReference = 68FF3C171E24DDDF00A482A8 /* GCXMulticastDNSKit.framework */;
132 | productType = "com.apple.product-type.framework";
133 | };
134 | 68FF3C1F1E24DDDF00A482A8 /* GCXMulticastDNSKitTests */ = {
135 | isa = PBXNativeTarget;
136 | buildConfigurationList = 68FF3C2E1E24DDDF00A482A8 /* Build configuration list for PBXNativeTarget "GCXMulticastDNSKitTests" */;
137 | buildPhases = (
138 | 68FF3C1C1E24DDDF00A482A8 /* Sources */,
139 | 68FF3C1D1E24DDDF00A482A8 /* Frameworks */,
140 | 68FF3C1E1E24DDDF00A482A8 /* Resources */,
141 | );
142 | buildRules = (
143 | );
144 | dependencies = (
145 | 68FF3C231E24DDDF00A482A8 /* PBXTargetDependency */,
146 | );
147 | name = GCXMulticastDNSKitTests;
148 | productName = GCXMulticastDNSKitTests;
149 | productReference = 68FF3C201E24DDDF00A482A8 /* GCXMulticastDNSKitTests.xctest */;
150 | productType = "com.apple.product-type.bundle.unit-test";
151 | };
152 | /* End PBXNativeTarget section */
153 |
154 | /* Begin PBXProject section */
155 | 68FF3C0E1E24DDDF00A482A8 /* Project object */ = {
156 | isa = PBXProject;
157 | attributes = {
158 | LastSwiftUpdateCheck = 0820;
159 | LastUpgradeCheck = 1250;
160 | ORGANIZATIONNAME = "grandcentrix GmbH";
161 | TargetAttributes = {
162 | 68FF3C161E24DDDF00A482A8 = {
163 | CreatedOnToolsVersion = 8.2.1;
164 | LastSwiftMigration = 1020;
165 | ProvisioningStyle = Automatic;
166 | };
167 | 68FF3C1F1E24DDDF00A482A8 = {
168 | CreatedOnToolsVersion = 8.2.1;
169 | LastSwiftMigration = 1020;
170 | ProvisioningStyle = Automatic;
171 | };
172 | };
173 | };
174 | buildConfigurationList = 68FF3C111E24DDDF00A482A8 /* Build configuration list for PBXProject "GCXMulticastDNSKit" */;
175 | compatibilityVersion = "Xcode 3.2";
176 | developmentRegion = en;
177 | hasScannedForEncodings = 0;
178 | knownRegions = (
179 | en,
180 | Base,
181 | );
182 | mainGroup = 68FF3C0D1E24DDDF00A482A8;
183 | productRefGroup = 68FF3C181E24DDDF00A482A8 /* Products */;
184 | projectDirPath = "";
185 | projectRoot = "";
186 | targets = (
187 | 68FF3C161E24DDDF00A482A8 /* GCXMulticastDNSKit */,
188 | 68FF3C1F1E24DDDF00A482A8 /* GCXMulticastDNSKitTests */,
189 | );
190 | };
191 | /* End PBXProject section */
192 |
193 | /* Begin PBXResourcesBuildPhase section */
194 | 68FF3C151E24DDDF00A482A8 /* Resources */ = {
195 | isa = PBXResourcesBuildPhase;
196 | buildActionMask = 2147483647;
197 | files = (
198 | );
199 | runOnlyForDeploymentPostprocessing = 0;
200 | };
201 | 68FF3C1E1E24DDDF00A482A8 /* Resources */ = {
202 | isa = PBXResourcesBuildPhase;
203 | buildActionMask = 2147483647;
204 | files = (
205 | );
206 | runOnlyForDeploymentPostprocessing = 0;
207 | };
208 | /* End PBXResourcesBuildPhase section */
209 |
210 | /* Begin PBXShellScriptBuildPhase section */
211 | 4F16EA7B2045A00500F4FE07 /* ShellScript */ = {
212 | isa = PBXShellScriptBuildPhase;
213 | buildActionMask = 2147483647;
214 | files = (
215 | );
216 | inputPaths = (
217 | );
218 | outputPaths = (
219 | );
220 | runOnlyForDeploymentPostprocessing = 0;
221 | shellPath = /bin/sh;
222 | shellScript = "if which swiftlint >/dev/null; then\nswiftlint\nelse\necho \"SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi";
223 | };
224 | /* End PBXShellScriptBuildPhase section */
225 |
226 | /* Begin PBXSourcesBuildPhase section */
227 | 68FF3C121E24DDDF00A482A8 /* Sources */ = {
228 | isa = PBXSourcesBuildPhase;
229 | buildActionMask = 2147483647;
230 | files = (
231 | 68FF3C4E1E24E6D400A482A8 /* DiscoveryConfiguration.swift in Sources */,
232 | 68FF3C4C1E24E6A700A482A8 /* Discovery.swift in Sources */,
233 | );
234 | runOnlyForDeploymentPostprocessing = 0;
235 | };
236 | 68FF3C1C1E24DDDF00A482A8 /* Sources */ = {
237 | isa = PBXSourcesBuildPhase;
238 | buildActionMask = 2147483647;
239 | files = (
240 | 68B792891E69620900A482A8 /* GCXDiscoveryTests.swift in Sources */,
241 | );
242 | runOnlyForDeploymentPostprocessing = 0;
243 | };
244 | /* End PBXSourcesBuildPhase section */
245 |
246 | /* Begin PBXTargetDependency section */
247 | 68FF3C231E24DDDF00A482A8 /* PBXTargetDependency */ = {
248 | isa = PBXTargetDependency;
249 | target = 68FF3C161E24DDDF00A482A8 /* GCXMulticastDNSKit */;
250 | targetProxy = 68FF3C221E24DDDF00A482A8 /* PBXContainerItemProxy */;
251 | };
252 | /* End PBXTargetDependency section */
253 |
254 | /* Begin XCBuildConfiguration section */
255 | 68FF3C291E24DDDF00A482A8 /* Debug */ = {
256 | isa = XCBuildConfiguration;
257 | buildSettings = {
258 | ALWAYS_SEARCH_USER_PATHS = NO;
259 | BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
260 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
261 | CLANG_ANALYZER_NONNULL = YES;
262 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
263 | CLANG_CXX_LIBRARY = "libc++";
264 | CLANG_ENABLE_MODULES = YES;
265 | CLANG_ENABLE_OBJC_ARC = YES;
266 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
267 | CLANG_WARN_BOOL_CONVERSION = YES;
268 | CLANG_WARN_COMMA = YES;
269 | CLANG_WARN_CONSTANT_CONVERSION = YES;
270 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
271 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
272 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
273 | CLANG_WARN_EMPTY_BODY = YES;
274 | CLANG_WARN_ENUM_CONVERSION = YES;
275 | CLANG_WARN_INFINITE_RECURSION = YES;
276 | CLANG_WARN_INT_CONVERSION = YES;
277 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
278 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
279 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
280 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
281 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
282 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
283 | CLANG_WARN_STRICT_PROTOTYPES = YES;
284 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
285 | CLANG_WARN_UNREACHABLE_CODE = YES;
286 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
287 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
288 | COPY_PHASE_STRIP = NO;
289 | CURRENT_PROJECT_VERSION = 1;
290 | DEBUG_INFORMATION_FORMAT = dwarf;
291 | ENABLE_STRICT_OBJC_MSGSEND = YES;
292 | ENABLE_TESTABILITY = YES;
293 | GCC_C_LANGUAGE_STANDARD = gnu99;
294 | GCC_DYNAMIC_NO_PIC = NO;
295 | GCC_NO_COMMON_BLOCKS = YES;
296 | GCC_OPTIMIZATION_LEVEL = 0;
297 | GCC_PREPROCESSOR_DEFINITIONS = (
298 | "DEBUG=1",
299 | "$(inherited)",
300 | );
301 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
302 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
303 | GCC_WARN_UNDECLARED_SELECTOR = YES;
304 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
305 | GCC_WARN_UNUSED_FUNCTION = YES;
306 | GCC_WARN_UNUSED_VARIABLE = YES;
307 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
308 | MTL_ENABLE_DEBUG_INFO = YES;
309 | ONLY_ACTIVE_ARCH = YES;
310 | SDKROOT = iphoneos;
311 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
312 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
313 | TARGETED_DEVICE_FAMILY = "1,2";
314 | VERSIONING_SYSTEM = "apple-generic";
315 | VERSION_INFO_PREFIX = "";
316 | };
317 | name = Debug;
318 | };
319 | 68FF3C2A1E24DDDF00A482A8 /* Release */ = {
320 | isa = XCBuildConfiguration;
321 | buildSettings = {
322 | ALWAYS_SEARCH_USER_PATHS = NO;
323 | BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
324 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
325 | CLANG_ANALYZER_NONNULL = YES;
326 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
327 | CLANG_CXX_LIBRARY = "libc++";
328 | CLANG_ENABLE_MODULES = YES;
329 | CLANG_ENABLE_OBJC_ARC = YES;
330 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
331 | CLANG_WARN_BOOL_CONVERSION = YES;
332 | CLANG_WARN_COMMA = YES;
333 | CLANG_WARN_CONSTANT_CONVERSION = YES;
334 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
335 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
336 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
337 | CLANG_WARN_EMPTY_BODY = YES;
338 | CLANG_WARN_ENUM_CONVERSION = YES;
339 | CLANG_WARN_INFINITE_RECURSION = YES;
340 | CLANG_WARN_INT_CONVERSION = YES;
341 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
342 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
343 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
344 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
345 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
346 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
347 | CLANG_WARN_STRICT_PROTOTYPES = YES;
348 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
349 | CLANG_WARN_UNREACHABLE_CODE = YES;
350 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
351 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
352 | COPY_PHASE_STRIP = NO;
353 | CURRENT_PROJECT_VERSION = 1;
354 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
355 | ENABLE_NS_ASSERTIONS = NO;
356 | ENABLE_STRICT_OBJC_MSGSEND = YES;
357 | GCC_C_LANGUAGE_STANDARD = gnu99;
358 | GCC_NO_COMMON_BLOCKS = YES;
359 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
360 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
361 | GCC_WARN_UNDECLARED_SELECTOR = YES;
362 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
363 | GCC_WARN_UNUSED_FUNCTION = YES;
364 | GCC_WARN_UNUSED_VARIABLE = YES;
365 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
366 | MTL_ENABLE_DEBUG_INFO = NO;
367 | SDKROOT = iphoneos;
368 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
369 | TARGETED_DEVICE_FAMILY = "1,2";
370 | VALIDATE_PRODUCT = YES;
371 | VERSIONING_SYSTEM = "apple-generic";
372 | VERSION_INFO_PREFIX = "";
373 | };
374 | name = Release;
375 | };
376 | 68FF3C2C1E24DDDF00A482A8 /* Debug */ = {
377 | isa = XCBuildConfiguration;
378 | buildSettings = {
379 | CLANG_ENABLE_MODULES = YES;
380 | CODE_SIGN_IDENTITY = "";
381 | DEFINES_MODULE = YES;
382 | DYLIB_COMPATIBILITY_VERSION = 1;
383 | DYLIB_CURRENT_VERSION = 1;
384 | DYLIB_INSTALL_NAME_BASE = "@rpath";
385 | INFOPLIST_FILE = GCXMulticastDNSKit/Info.plist;
386 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
387 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
388 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
389 | PRODUCT_BUNDLE_IDENTIFIER = net.grandcentrix.GCXMulticastDNSKit;
390 | PRODUCT_NAME = "$(TARGET_NAME)";
391 | SKIP_INSTALL = YES;
392 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
393 | SWIFT_VERSION = 5.0;
394 | };
395 | name = Debug;
396 | };
397 | 68FF3C2D1E24DDDF00A482A8 /* Release */ = {
398 | isa = XCBuildConfiguration;
399 | buildSettings = {
400 | CLANG_ENABLE_MODULES = YES;
401 | CODE_SIGN_IDENTITY = "";
402 | DEFINES_MODULE = YES;
403 | DYLIB_COMPATIBILITY_VERSION = 1;
404 | DYLIB_CURRENT_VERSION = 1;
405 | DYLIB_INSTALL_NAME_BASE = "@rpath";
406 | INFOPLIST_FILE = GCXMulticastDNSKit/Info.plist;
407 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
408 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
409 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
410 | PRODUCT_BUNDLE_IDENTIFIER = net.grandcentrix.GCXMulticastDNSKit;
411 | PRODUCT_NAME = "$(TARGET_NAME)";
412 | SKIP_INSTALL = YES;
413 | SWIFT_VERSION = 5.0;
414 | };
415 | name = Release;
416 | };
417 | 68FF3C2F1E24DDDF00A482A8 /* Debug */ = {
418 | isa = XCBuildConfiguration;
419 | buildSettings = {
420 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
421 | CLANG_ENABLE_MODULES = YES;
422 | DEVELOPMENT_TEAM = "";
423 | INFOPLIST_FILE = GCXMulticastDNSKitTests/Info.plist;
424 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
425 | PRODUCT_BUNDLE_IDENTIFIER = net.grandcentrix.GCXMulticastDNSKitTests;
426 | PRODUCT_NAME = "$(TARGET_NAME)";
427 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
428 | SWIFT_VERSION = 5.0;
429 | };
430 | name = Debug;
431 | };
432 | 68FF3C301E24DDDF00A482A8 /* Release */ = {
433 | isa = XCBuildConfiguration;
434 | buildSettings = {
435 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
436 | CLANG_ENABLE_MODULES = YES;
437 | DEVELOPMENT_TEAM = "";
438 | INFOPLIST_FILE = GCXMulticastDNSKitTests/Info.plist;
439 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
440 | PRODUCT_BUNDLE_IDENTIFIER = net.grandcentrix.GCXMulticastDNSKitTests;
441 | PRODUCT_NAME = "$(TARGET_NAME)";
442 | SWIFT_VERSION = 5.0;
443 | };
444 | name = Release;
445 | };
446 | /* End XCBuildConfiguration section */
447 |
448 | /* Begin XCConfigurationList section */
449 | 68FF3C111E24DDDF00A482A8 /* Build configuration list for PBXProject "GCXMulticastDNSKit" */ = {
450 | isa = XCConfigurationList;
451 | buildConfigurations = (
452 | 68FF3C291E24DDDF00A482A8 /* Debug */,
453 | 68FF3C2A1E24DDDF00A482A8 /* Release */,
454 | );
455 | defaultConfigurationIsVisible = 0;
456 | defaultConfigurationName = Release;
457 | };
458 | 68FF3C2B1E24DDDF00A482A8 /* Build configuration list for PBXNativeTarget "GCXMulticastDNSKit" */ = {
459 | isa = XCConfigurationList;
460 | buildConfigurations = (
461 | 68FF3C2C1E24DDDF00A482A8 /* Debug */,
462 | 68FF3C2D1E24DDDF00A482A8 /* Release */,
463 | );
464 | defaultConfigurationIsVisible = 0;
465 | defaultConfigurationName = Release;
466 | };
467 | 68FF3C2E1E24DDDF00A482A8 /* Build configuration list for PBXNativeTarget "GCXMulticastDNSKitTests" */ = {
468 | isa = XCConfigurationList;
469 | buildConfigurations = (
470 | 68FF3C2F1E24DDDF00A482A8 /* Debug */,
471 | 68FF3C301E24DDDF00A482A8 /* Release */,
472 | );
473 | defaultConfigurationIsVisible = 0;
474 | defaultConfigurationName = Release;
475 | };
476 | /* End XCConfigurationList section */
477 | };
478 | rootObject = 68FF3C0E1E24DDDF00A482A8 /* Project object */;
479 | }
480 |
--------------------------------------------------------------------------------