istio: Index | Files

package host

import ""


Package Files

name.go names.go

type Name Uses

type Name string

Name describes a (possibly wildcarded) hostname

func (Name) IsWildCarded Uses

func (n Name) IsWildCarded() bool

func (Name) Matches Uses

func (n Name) Matches(o Name) bool

Matches returns true if this hostname overlaps with the other hostname. Names overlap if: - they're fully resolved (i.e. not wildcarded) and match exactly (i.e. an exact string match) - one or both are wildcarded (e.g. "*"), in which case we use wildcard resolution rules to determine if h is covered by o or o is covered by h. e.g.:

Name("").Matches("")   = true
Name("").Matches("")   = false
Name("*.com").Matches("")     = true
Name("").Matches("*.com")     = true
Name("*").Matches("") = false
Name("*").Matches("")         = true
Name("*").Matches("*.com")           = true

func (Name) SubsetOf Uses

func (n Name) SubsetOf(o Name) bool

SubsetOf returns true if this hostname is a valid subset of the other hostname. The semantics are the same as "Matches", but only in one direction (i.e., h is covered by o).

type Names Uses

type Names []Name

Names is a collection of Name; it exists so it's easy to sort hostnames consistently across Istio. In a few locations we care about the order hostnames appear in Envoy config: primarily HTTP routes, but also in gateways, and for SNI. In those locations, we sort hostnames longest to shortest with wildcards last.

func NamesForNamespace Uses

func NamesForNamespace(hosts []string, namespace string) Names

NamesForNamespace returns the subset of hosts that are in the specified namespace. The list of hosts contains host names optionally qualified with namespace/ or */. If not qualified or qualified with *, the host name is considered to be in every namespace. e.g.: NamesForNamespace(["ns1/","ns2/"], "ns1") = Names([""]) NamesForNamespace(["ns1/","ns2/"], "ns3") = Names([]) NamesForNamespace(["ns1/","*/"], "ns1") = Names(["",""]) NamesForNamespace(["ns1/","*/"], "ns3") = Names([""]) NamesForNamespace(["","ns2/"], "ns2") = Names(["",""]) NamesForNamespace(["","ns2/"], "ns3") = Names([""])

func NewNames Uses

func NewNames(hosts []string) Names

NewNames converts a slice of host name strings to type Names.

func (Names) Contains Uses

func (h Names) Contains(host Name) bool

func (Names) Intersection Uses

func (h Names) Intersection(other Names) Names

Intersection returns the subset of host names that are covered by both h and other. e.g.:

Names(["",""]).Intersection(Names(["*.com"]))         = Names(["",""])
Names(["","*.net"]).Intersection(Names(["*.com",""])) = Names(["",""])
Names(["","*.net"]).Intersection(Names(["*"]))       = Names(["*"])
Names([""]).Intersection(Names([""]))                 = Names([])
Names([]).Intersection(Names([""])                           = Names([])

func (Names) Len Uses

func (h Names) Len() int

func (Names) Less Uses

func (h Names) Less(i, j int) bool

func (Names) Swap Uses

func (h Names) Swap(i, j int)

Package host imports 2 packages (graph) and is imported by 39 packages. Updated 2020-12-12. Refresh now. Tools for package owners.