HostMatcher

A builder/container that holds include and exclude HostPatterns.

Excludes always take precedence over includes. If no include patterns are specified, all hosts match (unless explicitly excluded).

Usage with DSL operators:

val matcher = HostMatcher().apply {
+"*.example.com" // include
-"internal.example.com" // exclude
}
matcher.matches("api.example.com") // true
matcher.matches("internal.example.com") // false

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun matches(hostname: String): Boolean

Returns true if the given hostname is included and not excluded.

Link copied to clipboard
operator fun String.unaryMinus()

Add a host pattern to the exclude list.

Link copied to clipboard
operator fun String.unaryPlus()

Add a host pattern to the include list.