Skip to content

Commit 140b0fb

Browse files
committed
rename ForwardsFor → Accessible
makes clear that Accessible must not contains forwarded devices
1 parent 8e10d1c commit 140b0fb

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

coord/server.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,10 @@ type PatchReifySpecRequest struct {
157157
PresharedKeySet bool
158158
PersistentKeepalive goal.Duration
159159
PersistentKeepaliveSet bool
160-
ForwardsFor []string
161-
ForwardsForSet bool
160+
161+
// Accessible is the list of devices accessible without forwarding.
162+
Accessible []string
163+
AccessibleSet bool
162164
}
163165

164166
func (s *Server) patchReifySpec(w http.ResponseWriter, r *http.Request) {
@@ -206,15 +208,15 @@ func (s *Server) patchReifySpec(w http.ResponseWriter, r *http.Request) {
206208
if req.PersistentKeepaliveSet {
207209
newSpec.Networks[nI].Devices[sndI].PersistentKeepalive = req.PersistentKeepalive
208210
}
209-
if req.ForwardsForSet {
211+
if req.AccessibleSet {
210212
// TODO: check req.ForwardsFor validity
211-
for _, name := range req.ForwardsFor {
213+
for _, name := range req.Accessible {
212214
if _, ok := newSpec.Networks[nI].GetDevice(name); !ok {
213215
http.Error(w, fmt.Sprintf("ForwardsFor contains nonexistent device name: %s/%s", network, name), 400)
214216
return
215217
}
216218
}
217-
newSpec.Networks[nI].Devices[sndI].ForwardsFor = req.ForwardsFor
219+
newSpec.Networks[nI].Devices[sndI].ForwardsFor = req.Accessible
218220
}
219221
s.latestLock.Lock()
220222
defer s.latestLock.Unlock()

device/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,8 @@ func (c *Client) patchForwardsFor(nc *spec.NetworkCensored) error {
284284
if len(forwardsFor) == 0 {
285285
zap.S().Debugf("I can forward for %d devices.", len(forwardsFor))
286286
err := c.patchSpec(coord.PatchReifySpecRequest{
287-
ForwardsFor: forwardsFor,
288-
ForwardsForSet: true,
287+
Accessible: forwardsFor,
288+
AccessibleSet: true,
289289
})
290290
if err != nil {
291291
return fmt.Errorf("patch spec: %w", err)

0 commit comments

Comments
 (0)