Drop some extra return

This commit is contained in:
Davide De Rosa 2022-11-04 23:04:47 +01:00
parent 47281cafc9
commit 3d226a20f3
2 changed files with 22 additions and 22 deletions

View File

@ -40,7 +40,7 @@ extension WireGuard.Configuration {
} }
public func asWgQuickConfig() -> String { public func asWgQuickConfig() -> String {
return tunnelConfiguration.asWgQuickConfig() tunnelConfiguration.asWgQuickConfig()
} }
public var endpointRepresentation: String { public var endpointRepresentation: String {

View File

@ -92,7 +92,7 @@ extension WireGuard {
public var privateKey: String { public var privateKey: String {
get { get {
return interface.privateKey.base64Key interface.privateKey.base64Key
} }
set { set {
guard let key = PrivateKey(base64Key: newValue) else { guard let key = PrivateKey(base64Key: newValue) else {
@ -104,7 +104,7 @@ extension WireGuard {
public var addresses: [String] { public var addresses: [String] {
get { get {
return interface.addresses.map(\.stringRepresentation) interface.addresses.map(\.stringRepresentation)
} }
set { set {
interface.addresses = newValue.compactMap(IPAddressRange.init) interface.addresses = newValue.compactMap(IPAddressRange.init)
@ -113,7 +113,7 @@ extension WireGuard {
public var dnsServers: [String] { public var dnsServers: [String] {
get { get {
return interface.dns.map(\.stringRepresentation) interface.dns.map(\.stringRepresentation)
} }
set { set {
interface.dns = newValue.compactMap(DNSServer.init) interface.dns = newValue.compactMap(DNSServer.init)
@ -122,7 +122,7 @@ extension WireGuard {
public var dnsSearchDomains: [String] { public var dnsSearchDomains: [String] {
get { get {
return interface.dnsSearch interface.dnsSearch
} }
set { set {
interface.dnsSearch = newValue interface.dnsSearch = newValue
@ -131,7 +131,7 @@ extension WireGuard {
public var mtu: UInt16? { public var mtu: UInt16? {
get { get {
return interface.mtu interface.mtu
} }
set { set {
interface.mtu = newValue interface.mtu = newValue
@ -219,11 +219,11 @@ extension WireGuard {
public let tunnelConfiguration: TunnelConfiguration public let tunnelConfiguration: TunnelConfiguration
public var interface: InterfaceConfiguration { public var interface: InterfaceConfiguration {
return tunnelConfiguration.interface tunnelConfiguration.interface
} }
public var peers: [PeerConfiguration] { public var peers: [PeerConfiguration] {
return tunnelConfiguration.peers tunnelConfiguration.peers
} }
public init(tunnelConfiguration: TunnelConfiguration) { public init(tunnelConfiguration: TunnelConfiguration) {
@ -231,33 +231,33 @@ extension WireGuard {
} }
public func builder() -> WireGuard.ConfigurationBuilder { public func builder() -> WireGuard.ConfigurationBuilder {
return WireGuard.ConfigurationBuilder(tunnelConfiguration) WireGuard.ConfigurationBuilder(tunnelConfiguration)
} }
// MARK: WireGuardConfigurationProviding // MARK: WireGuardConfigurationProviding
public var privateKey: String { public var privateKey: String {
return interface.privateKey.base64Key interface.privateKey.base64Key
} }
public var publicKey: String { public var publicKey: String {
return interface.privateKey.publicKey.base64Key interface.privateKey.publicKey.base64Key
} }
public var addresses: [String] { public var addresses: [String] {
return interface.addresses.map(\.stringRepresentation) interface.addresses.map(\.stringRepresentation)
} }
public var dnsServers: [String] { public var dnsServers: [String] {
return interface.dns.map(\.stringRepresentation) interface.dns.map(\.stringRepresentation)
} }
public var dnsSearchDomains: [String] { public var dnsSearchDomains: [String] {
return interface.dnsSearch interface.dnsSearch
} }
public var mtu: UInt16? { public var mtu: UInt16? {
return interface.mtu interface.mtu
} }
// MARK: Codable // MARK: Codable
@ -279,30 +279,30 @@ extension WireGuard {
extension WireGuardConfigurationProviding { extension WireGuardConfigurationProviding {
public var publicKey: String { public var publicKey: String {
return interface.privateKey.publicKey.base64Key interface.privateKey.publicKey.base64Key
} }
public var peersCount: Int { public var peersCount: Int {
return peers.count peers.count
} }
public func publicKey(ofPeer peerIndex: Int) -> String { public func publicKey(ofPeer peerIndex: Int) -> String {
return peers[peerIndex].publicKey.base64Key peers[peerIndex].publicKey.base64Key
} }
public func preSharedKey(ofPeer peerIndex: Int) -> String? { public func preSharedKey(ofPeer peerIndex: Int) -> String? {
return peers[peerIndex].preSharedKey?.base64Key peers[peerIndex].preSharedKey?.base64Key
} }
public func endpoint(ofPeer peerIndex: Int) -> String? { public func endpoint(ofPeer peerIndex: Int) -> String? {
return peers[peerIndex].endpoint?.stringRepresentation peers[peerIndex].endpoint?.stringRepresentation
} }
public func allowedIPs(ofPeer peerIndex: Int) -> [String] { public func allowedIPs(ofPeer peerIndex: Int) -> [String] {
return peers[peerIndex].allowedIPs.map(\.stringRepresentation) peers[peerIndex].allowedIPs.map(\.stringRepresentation)
} }
public func keepAlive(ofPeer peerIndex: Int) -> UInt16? { public func keepAlive(ofPeer peerIndex: Int) -> UInt16? {
return peers[peerIndex].persistentKeepAlive peers[peerIndex].persistentKeepAlive
} }
} }