@@ -95,19 +95,13 @@ func equals(want string) Matcher {
95
95
// config contains the proxying state for one listener.
96
96
type config struct {
97
97
sync.Mutex // protect w of routes
98
- nextRouteID int
99
98
routes map [int ]route
99
+ nextRouteID int
100
+
100
101
acmeTargets []Target // accumulates targets that should be probed for acme.
101
102
stopACME bool // if true, AddSNIRoute doesn't add targets to acmeTargets.
102
103
}
103
104
104
- func newConfig () (cfg * config ) {
105
- cfg = & config {}
106
- cfg .routes = make (map [int ]route )
107
- cfg .nextRouteID = 1
108
- return
109
- }
110
-
111
105
// A route matches a connection to a target.
112
106
type route interface {
113
107
// match examines the initial bytes of a connection, looking for a
@@ -132,7 +126,10 @@ func (p *Proxy) configFor(ipPort string) *config {
132
126
p .configs = make (map [string ]* config )
133
127
}
134
128
if p .configs [ipPort ] == nil {
135
- p .configs [ipPort ] = newConfig ()
129
+ cfg := & config {}
130
+ cfg .routes = make (map [int ]route )
131
+ cfg .nextRouteID = 1
132
+ p .configs [ipPort ] = cfg
136
133
}
137
134
return p .configs [ipPort ]
138
135
}
@@ -173,10 +170,9 @@ func (p *Proxy) AddRoute(ipPort string, dest Target) (routeID int) {
173
170
// not found, this is an no-op.
174
171
//
175
172
// Both AddRoute and RemoveRoute is go-routine safe.
176
- func (p * Proxy ) RemoveRoute (ipPort string , routeID int ) ( err error ) {
173
+ func (p * Proxy ) RemoveRoute (ipPort string , routeID int ) {
177
174
cfg := p .configFor (ipPort )
178
175
cfg .routes [routeID ] = nil
179
- return
180
176
}
181
177
182
178
type fixedTarget struct {
0 commit comments