WireGuardKit: Delegate IPv*Address initialization to self.init
Signed-off-by: Andrej Mihajlov <and@mullvad.net>
This commit is contained in:
parent
b4ebe2440f
commit
8f67435d4a
|
@ -12,11 +12,7 @@ extension IPv4Address {
|
||||||
return Data(bytes: &ptr.pointee.sin_addr, count: MemoryLayout<in_addr>.size)
|
return Data(bytes: &ptr.pointee.sin_addr, count: MemoryLayout<in_addr>.size)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let ipAddress = IPv4Address(addressData) {
|
self.init(addressData)
|
||||||
self = ipAddress
|
|
||||||
} else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,10 +24,6 @@ extension IPv6Address {
|
||||||
return Data(bytes: &ptr.pointee.sin6_addr, count: MemoryLayout<in6_addr>.size)
|
return Data(bytes: &ptr.pointee.sin6_addr, count: MemoryLayout<in6_addr>.size)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let ipAddress = IPv6Address(addressData) {
|
self.init(addressData)
|
||||||
self = ipAddress
|
|
||||||
} else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue