Skip to content

Commit 9caa1f2

Browse files
committed
hosts bug fix
1 parent 0fd1248 commit 9caa1f2

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

profile.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,23 +76,20 @@ func (p *Profile) Validate() (err error) {
7676

7777
func (p *Profile) GetHosts() (hosts []Host) {
7878
hosts = []Host{}
79-
index := 0
8079
known := []string{}
8180
for _, host := range p.Receive.Hosts {
8281
if slices.Contains(known, host.Protocol+host.Address+host.Port) {
8382
continue
8483
}
8584
known = append(known, host.Protocol+host.Address+host.Port)
86-
hosts[index] = host
87-
index++
85+
hosts = append(hosts, host)
8886
}
8987
for _, host := range p.Respond.Hosts {
9088
if slices.Contains(known, host.Protocol+host.Address+host.Port) {
9189
continue
9290
}
9391
known = append(known, host.Protocol+host.Address+host.Port)
94-
hosts[index] = host
95-
index++
92+
hosts = append(hosts, host)
9693
}
9794
return hosts
9895
}

0 commit comments

Comments
 (0)