Skip to content

Commit

Permalink
Equatable conformance on IPAddress (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardpiazza committed Jan 21, 2024
1 parent 15d801b commit de5d038
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Sources/DynuREST/IPAddress.swift
@@ -1,6 +1,6 @@
import Foundation

public enum IPAddress: Codable {
public enum IPAddress: Equatable, Codable {
case ipV4(String)
case ipV6(String)

Expand Down Expand Up @@ -60,4 +60,18 @@ extension IPAddress: CustomStringConvertible {
return address
}
}

public var isIPv4: Bool {
switch self {
case .ipV4: return true
default: return false
}
}

public var isIPv6: Bool {
switch self {
case .ipV6: return true
default: return false
}
}
}

0 comments on commit de5d038

Please sign in to comment.