From e6036095c95a5dc63fe9d96e1c2b543531a13165 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Tue, 28 Aug 2018 17:39:23 +0200 Subject: [PATCH] Describe routes in IPv*Settings --- .../Sources/Core/SessionProxy+PushReply.swift | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/TunnelKit/Sources/Core/SessionProxy+PushReply.swift b/TunnelKit/Sources/Core/SessionProxy+PushReply.swift index f07bf15..37d61de 100644 --- a/TunnelKit/Sources/Core/SessionProxy+PushReply.swift +++ b/TunnelKit/Sources/Core/SessionProxy+PushReply.swift @@ -40,8 +40,8 @@ import Foundation /// Encapsulates the IPv4 settings for the tunnel. public struct IPv4Settings: CustomStringConvertible { - /// Represents a route in the routing table. - public struct Route { + /// Represents an IPv4 route in the routing table. + public struct Route: CustomStringConvertible { /// The destination host or subnet. public let destination: String @@ -57,6 +57,13 @@ public struct IPv4Settings: CustomStringConvertible { self.mask = mask ?? "255.255.255.255" self.gateway = gateway } + + // MARK: CustomStringConvertible + + /// :nodoc: + public var description: String { + return "{\(destination)/\(mask) \(gateway ?? "default")}" + } } /// The address. @@ -75,16 +82,16 @@ public struct IPv4Settings: CustomStringConvertible { /// :nodoc: public var description: String { - return "addr \(address) netmask \(addressMask) gw \(defaultGateway)" + return "addr \(address) netmask \(addressMask) gw \(defaultGateway) routes \(routes)" } } /// Encapsulates the IPv6 settings for the tunnel. public struct IPv6Settings: CustomStringConvertible { - /// Represents a route in the routing table. - public struct Route { - + /// Represents an IPv6 route in the routing table. + public struct Route: CustomStringConvertible { + /// The destination host or subnet. public let destination: String @@ -99,6 +106,13 @@ public struct IPv6Settings: CustomStringConvertible { self.prefixLength = prefixLength ?? 3 self.gateway = gateway } + + // MARK: CustomStringConvertible + + /// :nodoc: + public var description: String { + return "{\(destination)/\(prefixLength) \(gateway ?? "default")}" + } } /// The address. @@ -117,7 +131,7 @@ public struct IPv6Settings: CustomStringConvertible { /// :nodoc: public var description: String { - return "addr \(address)/\(addressPrefixLength) gw \(defaultGateway)" + return "addr \(address)/\(addressPrefixLength) gw \(defaultGateway) routes \(routes)" } }