File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
ziti/src/main/kotlin/org/openziti/api Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -73,17 +73,28 @@ internal class ServiceUpdates(val lastChangeAt: Date)
73
73
74
74
private data class ClientV1Config (val hostname : String , val port : Int )
75
75
76
- data class PortRange (val low : Int , val high : Int ) {
76
+ data class PortRange (val low : Int , val high : Int ): Comparable<PortRange> {
77
77
fun contains (port : Int ) = (port in low.. high)
78
+
79
+ override fun toString (): String = if (low == high) low.toString() else " $low -$high "
80
+ override fun compareTo (other : PortRange ): Int {
81
+ val ord = low.compareTo(other.low)
82
+ return if (ord == 0 ) high.compareTo(other.high) else ord
83
+ }
78
84
}
79
85
86
+ fun <T > Array<T>.display () = joinToString(prefix = " [" , postfix = " ]" )
80
87
data class InterceptConfig (
81
88
val protocols : Array <InterceptProtocol >,
82
89
val addresses : Array <String >,
83
90
val portRanges : Array <PortRange >,
84
91
val dialOptions : Map <String ,Any > = emptyMap(),
85
92
val sourceIp : String? = null
86
- )
93
+ ) {
94
+ override fun toString (): String {
95
+ return """ ${protocols.display()} :${addresses.display()} :${portRanges.display()} """
96
+ }
97
+ }
87
98
88
99
class Service internal constructor(
89
100
internal val id : String ,
You can’t perform that action at this time.
0 commit comments