Skip to content

Commit a64c39c

Browse files
committed
Correct linter warnings
1 parent cfffc79 commit a64c39c

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

http.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func (p *Proxy) AddHTTPHostRoute(ipPort, httpHost string, dest Target) {
3737
// for any additional routes on ipPort.
3838
//
3939
// The ipPort is any valid net.Listen TCP address.
40-
func (p *Proxy) AddHTTPHostMatchRoute(ipPort string, match Matcher, dest Target) (routeId int) {
40+
func (p *Proxy) AddHTTPHostMatchRoute(ipPort string, match Matcher, dest Target) (routeID int) {
4141
return p.addRoute(ipPort, httpHostMatch{match, dest})
4242
}
4343

sni.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import (
3434
// with AddStopACMESearch.
3535
//
3636
// The ipPort is any valid net.Listen TCP address.
37-
func (p *Proxy) AddSNIRoute(ipPort, sni string, dest Target) (routeId int) {
37+
func (p *Proxy) AddSNIRoute(ipPort, sni string, dest Target) (routeID int) {
3838
return p.AddSNIMatchRoute(ipPort, equals(sni), dest)
3939
}
4040

@@ -48,7 +48,7 @@ func (p *Proxy) AddSNIRoute(ipPort, sni string, dest Target) (routeId int) {
4848
// with AddStopACMESearch.
4949
//
5050
// The ipPort is any valid net.Listen TCP address.
51-
func (p *Proxy) AddSNIMatchRoute(ipPort string, matcher Matcher, dest Target) (routeId int) {
51+
func (p *Proxy) AddSNIMatchRoute(ipPort string, matcher Matcher, dest Target) (routeID int) {
5252
cfg := p.configFor(ipPort)
5353
if !cfg.stopACME {
5454
if len(cfg.acmeTargets) == 0 {

tcpproxy.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,16 @@ func equals(want string) Matcher {
9595
// config contains the proxying state for one listener.
9696
type config struct {
9797
sync.Mutex // protect w of routes
98-
nextRouteId int
98+
nextRouteID int
9999
routes map[int]route
100100
acmeTargets []Target // accumulates targets that should be probed for acme.
101101
stopACME bool // if true, AddSNIRoute doesn't add targets to acmeTargets.
102102
}
103103

104-
func NewConfig() (cfg *config) {
104+
func newConfig() (cfg *config) {
105105
cfg = &config{}
106106
cfg.routes = make(map[int]route)
107-
cfg.nextRouteId = 1
107+
cfg.nextRouteID = 1
108108
return
109109
}
110110

@@ -132,12 +132,12 @@ func (p *Proxy) configFor(ipPort string) *config {
132132
p.configs = make(map[string]*config)
133133
}
134134
if p.configs[ipPort] == nil {
135-
p.configs[ipPort] = NewConfig()
135+
p.configs[ipPort] = newConfig()
136136
}
137137
return p.configs[ipPort]
138138
}
139139

140-
func (p *Proxy) addRoute(ipPort string, r route) (routeId int) {
140+
func (p *Proxy) addRoute(ipPort string, r route) (routeID int) {
141141
var cfg *config
142142
if p.donec != nil {
143143
// NOTE: Do not create config file if the server is listening.
@@ -149,33 +149,33 @@ func (p *Proxy) addRoute(ipPort string, r route) (routeId int) {
149149
}
150150
if cfg != nil {
151151
cfg.Lock()
152-
routeId = cfg.nextRouteId
153-
cfg.nextRouteId++
154-
cfg.routes[routeId] = r
152+
routeID = cfg.nextRouteID
153+
cfg.nextRouteID++
154+
cfg.routes[routeID] = r
155155
cfg.Unlock()
156156
}
157157
return
158158
}
159159

160160
// AddRoute appends an always-matching route to the ipPort listener,
161161
// directing any connection to dest. The added route's id is returned
162-
// for future removal. If routeId is zero, the route is not registered.
162+
// for future removal. If routeID is zero, the route is not registered.
163163
//
164164
// This is generally used as either the only rule (for simple TCP
165165
// proxies), or as the final fallback rule for an ipPort.
166166
//
167167
// The ipPort is any valid net.Listen TCP address.
168-
func (p *Proxy) AddRoute(ipPort string, dest Target) (routeId int) {
168+
func (p *Proxy) AddRoute(ipPort string, dest Target) (routeID int) {
169169
return p.addRoute(ipPort, fixedTarget{dest})
170170
}
171171

172172
// RemoveRoute removes an existing route for ipPort. If the route is
173173
// not found, this is an no-op.
174174
//
175175
// Both AddRoute and RemoveRoute is go-routine safe.
176-
func (p *Proxy) RemoveRoute(ipPort string, routeId int) (err error) {
176+
func (p *Proxy) RemoveRoute(ipPort string, routeID int) (err error) {
177177
cfg := p.configFor(ipPort)
178-
cfg.routes[routeId] = nil
178+
cfg.routes[routeID] = nil
179179
return
180180
}
181181

tcpproxy_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,12 +311,12 @@ func TestProxyRemoveRoute(t *testing.T) {
311311

312312
backBar := newLocalListener(t)
313313
defer backBar.Close()
314-
routeId := p.AddSNIRoute(testFrontAddr, "bar.com", To(backBar.Addr().String()))
314+
routeID := p.AddSNIRoute(testFrontAddr, "bar.com", To(backBar.Addr().String()))
315315

316316
msg := clientHelloRecord(t, "bar.com")
317317
testRouteToBackend(t, front, backBar, msg)
318318

319-
p.RemoveRoute(testFrontAddr, routeId)
319+
p.RemoveRoute(testFrontAddr, routeID)
320320
<-testNotRouteToBackend(t, front, backBar, msg)
321321
}
322322

0 commit comments

Comments
 (0)