DataConnectSettings.swift 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2024 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. import Foundation
  15. @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
  16. public struct DataConnectSettings: Hashable, Equatable {
  17. public private(set) var host: String
  18. public private(set) var port: Int
  19. public private(set) var sslEnabled: Bool
  20. public init(host: String, port: Int, sslEnabled: Bool) {
  21. self.host = host
  22. self.port = port
  23. self.sslEnabled = sslEnabled
  24. }
  25. public init() {
  26. host = "firebasedataconnect.googleapis.com"
  27. port = 443
  28. sslEnabled = true
  29. }
  30. public func hash(into hasher: inout Hasher) {
  31. hasher.combine(host)
  32. hasher.combine(port)
  33. hasher.combine(sslEnabled)
  34. }
  35. public static func == (lhs: DataConnectSettings, rhs: DataConnectSettings) -> Bool {
  36. return lhs.host == rhs.host &&
  37. lhs.port == rhs.port &&
  38. lhs.sslEnabled == rhs.sslEnabled
  39. }
  40. }