Skip to content

Commit

Permalink
proxy: use strings.TrimSuffix
Browse files Browse the repository at this point in the history
Change-Id: Icca4cdbdc1fb964eda8e0fed559f8d4e5dc45073
Reviewed-on: https://go-review.googlesource.com/c/net/+/586115
Reviewed-by: Ian Lance Taylor <[email protected]>
Auto-Submit: Tobias Klauser <[email protected]>
Reviewed-by: Carlos Amedee <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
  • Loading branch information
tklauser authored and gopherbot committed May 20, 2024
1 parent c87a5b6 commit 49bf2d7
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions proxy/per_host.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ func (p *PerHost) AddNetwork(net *net.IPNet) {
// AddZone specifies a DNS suffix that will use the bypass proxy. A zone of
// "example.com" matches "example.com" and all of its subdomains.
func (p *PerHost) AddZone(zone string) {
if strings.HasSuffix(zone, ".") {
zone = zone[:len(zone)-1]
}
zone = strings.TrimSuffix(zone, ".")
if !strings.HasPrefix(zone, ".") {
zone = "." + zone
}
Expand All @@ -148,8 +146,6 @@ func (p *PerHost) AddZone(zone string) {

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

0 comments on commit 49bf2d7

Please sign in to comment.