<!DOCTYPE html>
<html lang="en">
	<head>
		<title>reverseproxy - service.go</title>
		<link type="text/css" rel="stylesheet" href="/style/src.css">
	</head>
	<body>
		<h1><a href="/reverseproxy">reverseproxy</a> - service.go</h1>
		<pre>
<span class="hidden"><a id="L1" href="#L1">     1</a>  </span><span>package reverseproxy</span>
<span class="hidden"><a id="L2" href="#L2">     2</a>  </span>
<span class="hidden"><a id="L3" href="#L3">     3</a>  </span><span>import &#34;strings&#34;</span>
<span class="hidden"><a id="L4" href="#L4">     4</a>  </span>
<span class="hidden"><a id="L5" href="#L5">     5</a>  </span><span class="text">// MatchServiceName allows differing ways of matching a service name to a service.</span>
<span class="hidden"><a id="L6" href="#L6">     6</a>  </span><span>type MatchServiceName interface {</span>
<span class="hidden"><a id="L7" href="#L7">     7</a>  </span><span>	MatchService(string) bool</span>
<span class="hidden"><a id="L8" href="#L8">     8</a>  </span><span>}</span>
<span class="hidden"><a id="L9" href="#L9">     9</a>  </span>
<span class="hidden"><a id="L10" href="#L10">    10</a>  </span><span class="text">// HostName represents an exact hostname to match on.</span>
<span class="hidden"><a id="L11" href="#L11">    11</a>  </span><span>type HostName string</span>
<span class="hidden"><a id="L12" href="#L12">    12</a>  </span>
<span class="hidden"><a id="L13" href="#L13">    13</a>  </span><span class="text">// MatchService implements the MatchServiceName interface.</span>
<span class="hidden"><a id="L14" href="#L14">    14</a>  </span><span>func (h HostName) MatchService(serviceName string) bool {</span>
<span class="hidden"><a id="L15" href="#L15">    15</a>  </span><span>	return string(h) == serviceName</span>
<span class="hidden"><a id="L16" href="#L16">    16</a>  </span><span>}</span>
<span class="hidden"><a id="L17" href="#L17">    17</a>  </span>
<span class="hidden"><a id="L18" href="#L18">    18</a>  </span><span class="text">// HostNameSuffix represents a partial hostname to match the end on.</span>
<span class="hidden"><a id="L19" href="#L19">    19</a>  </span><span>type HostNameSuffix string</span>
<span class="hidden"><a id="L20" href="#L20">    20</a>  </span>
<span class="hidden"><a id="L21" href="#L21">    21</a>  </span><span class="text">// MatchService implements the MatchServiceName interface.</span>
<span class="hidden"><a id="L22" href="#L22">    22</a>  </span><span>func (h HostNameSuffix) MatchService(serviceName string) bool {</span>
<span class="hidden"><a id="L23" href="#L23">    23</a>  </span><span>	return strings.HasSuffix(serviceName, string(h))</span>
<span class="hidden"><a id="L24" href="#L24">    24</a>  </span><span>}</span>
<span class="hidden"><a id="L25" href="#L25">    25</a>  </span>
<span class="hidden"><a id="L26" href="#L26">    26</a>  </span><span class="text">// Hosts represents a list of service names to match against.</span>
<span class="hidden"><a id="L27" href="#L27">    27</a>  </span><span>type Hosts []MatchServiceName</span>
<span class="hidden"><a id="L28" href="#L28">    28</a>  </span>
<span class="hidden"><a id="L29" href="#L29">    29</a>  </span><span class="text">// MatchService implements the MatchServiceName interface.</span>
<span class="hidden"><a id="L30" href="#L30">    30</a>  </span><span>func (h Hosts) MatchService(serviceName string) bool {</span>
<span class="hidden"><a id="L31" href="#L31">    31</a>  </span><span>	for _, s := range h {</span>
<span class="hidden"><a id="L32" href="#L32">    32</a>  </span><span>		if s.MatchService(serviceName) {</span>
<span class="hidden"><a id="L33" href="#L33">    33</a>  </span><span>			return true</span>
<span class="hidden"><a id="L34" href="#L34">    34</a>  </span><span>		}</span>
<span class="hidden"><a id="L35" href="#L35">    35</a>  </span><span>	}</span>
<span class="hidden"><a id="L36" href="#L36">    36</a>  </span>
<span class="hidden"><a id="L37" href="#L37">    37</a>  </span><span>	return false</span>
<span class="hidden"><a id="L38" href="#L38">    38</a>  </span><span>}</span>
<span class="hidden"><a id="L39" href="#L39">    39</a>  </span></pre>
	</body>
</html>
