Skip to content

Commit dd75405

Browse files
committed
Rename vpnIp to vpnAddrs in host map functions and tests
1 parent 295f9b4 commit dd75405

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

control.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ func listHostMapHostsIter(hl controlHostLister) iter.Seq[*ControlHostInfo] {
329329
pr := hl.GetPreferredRanges()
330330

331331
return iter.Seq[*ControlHostInfo](func(yield func(*ControlHostInfo) bool) {
332-
hl.ForEachVpnIp(func(hostinfo *HostInfo) {
332+
hl.ForEachVpnAddr(func(hostinfo *HostInfo) {
333333
host := copyHostInfo(hostinfo, pr)
334334
if !yield(&host) {
335335
return // Stop iteration early if yield returns false

control_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func TestControl_GetHostInfoByVpnIp(t *testing.T) {
112112

113113
func TestListHostMapHostsIter(t *testing.T) {
114114
l := logrus.New()
115-
hm := newHostMap(l, netip.Prefix{})
115+
hm := newHostMap(l)
116116
hm.preferredRanges.Store(&[]netip.Prefix{})
117117

118118
hosts := []struct {
@@ -134,7 +134,7 @@ func TestListHostMapHostsIter(t *testing.T) {
134134
},
135135
localIndexId: h.localIndexId,
136136
remoteIndexId: h.remoteIndexId,
137-
vpnIp: h.vpnIp,
137+
vpnAddrs: []netip.Addr{h.vpnIp},
138138
}, &Interface{})
139139
}
140140

@@ -147,7 +147,7 @@ func TestListHostMapHostsIter(t *testing.T) {
147147

148148
assert.Equal(t, len(hosts), len(results), "expected number of hosts in iterator")
149149
for i, h := range hosts {
150-
assert.Equal(t, h.vpnIp, results[i].VpnIp)
150+
assert.Equal(t, h.vpnIp, results[i].VpnAddrs[0])
151151
assert.Equal(t, h.localIndexId, results[i].LocalIndex)
152152
assert.Equal(t, h.remoteIndexId, results[i].RemoteIndex)
153153
assert.Equal(t, h.remoteAddr, results[i].CurrentRemote)
@@ -156,7 +156,7 @@ func TestListHostMapHostsIter(t *testing.T) {
156156

157157
func TestListHostMapIndexesIter(t *testing.T) {
158158
l := logrus.New()
159-
hm := newHostMap(l, netip.Prefix{})
159+
hm := newHostMap(l)
160160
hm.preferredRanges.Store(&[]netip.Prefix{})
161161

162162
hosts := []struct {
@@ -178,7 +178,7 @@ func TestListHostMapIndexesIter(t *testing.T) {
178178
},
179179
localIndexId: h.localIndexId,
180180
remoteIndexId: h.remoteIndexId,
181-
vpnIp: h.vpnIp,
181+
vpnAddrs: []netip.Addr{h.vpnIp},
182182
}, &Interface{})
183183
}
184184

@@ -191,7 +191,7 @@ func TestListHostMapIndexesIter(t *testing.T) {
191191

192192
assert.Equal(t, len(hosts), len(results), "expected number of hosts in iterator")
193193
for i, h := range hosts {
194-
assert.Equal(t, h.vpnIp, results[i].VpnIp)
194+
assert.Equal(t, h.vpnIp, results[i].VpnAddrs[0])
195195
assert.Equal(t, h.localIndexId, results[i].LocalIndex)
196196
assert.Equal(t, h.remoteIndexId, results[i].RemoteIndex)
197197
assert.Equal(t, h.remoteAddr, results[i].CurrentRemote)

0 commit comments

Comments
 (0)