Skip to content

Commit 49bf2d7

Browse files
tklausergopherbot
authored andcommitted
proxy: use strings.TrimSuffix
Change-Id: Icca4cdbdc1fb964eda8e0fed559f8d4e5dc45073 Reviewed-on: https://go-review.googlesource.com/c/net/+/586115 Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Carlos Amedee <carlos@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
1 parent c87a5b6 commit 49bf2d7

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

proxy/per_host.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,7 @@ func (p *PerHost) AddNetwork(net *net.IPNet) {
137137
// AddZone specifies a DNS suffix that will use the bypass proxy. A zone of
138138
// "example.com" matches "example.com" and all of its subdomains.
139139
func (p *PerHost) AddZone(zone string) {
140-
if strings.HasSuffix(zone, ".") {
141-
zone = zone[:len(zone)-1]
142-
}
140+
zone = strings.TrimSuffix(zone, ".")
143141
if !strings.HasPrefix(zone, ".") {
144142
zone = "." + zone
145143
}
@@ -148,8 +146,6 @@ func (p *PerHost) AddZone(zone string) {
148146

149147
// AddHost specifies a host name that will use the bypass proxy.
150148
func (p *PerHost) AddHost(host string) {
151-
if strings.HasSuffix(host, ".") {
152-
host = host[:len(host)-1]
153-
}
149+
host = strings.TrimSuffix(host, ".")
154150
p.bypassHosts = append(p.bypassHosts, host)
155151
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy