WireGuardKit: Delegate IPv*Address initialization to self.init

Signed-off-by: Andrej Mihajlov <and@mullvad.net>
This commit is contained in:
Andrej Mihajlov 2020-12-04 11:25:16 +01:00
parent b4ebe2440f
commit 8f67435d4a
1 changed files with 2 additions and 10 deletions

View File

@ -12,11 +12,7 @@ extension IPv4Address {
return Data(bytes: &ptr.pointee.sin_addr, count: MemoryLayout<in_addr>.size)
}
if let ipAddress = IPv4Address(addressData) {
self = ipAddress
} else {
return nil
}
self.init(addressData)
}
}
@ -28,10 +24,6 @@ extension IPv6Address {
return Data(bytes: &ptr.pointee.sin6_addr, count: MemoryLayout<in6_addr>.size)
}
if let ipAddress = IPv6Address(addressData) {
self = ipAddress
} else {
return nil
}
self.init(addressData)
}
}