Describe routes in IPv*Settings

This commit is contained in:
Davide De Rosa 2018-08-28 17:39:23 +02:00
parent 373a36b9c1
commit e6036095c9
1 changed files with 21 additions and 7 deletions

View File

@ -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)"
}
}