mirror of
https://github.com/juanfont/headscale.git
synced 2025-10-15 18:19:49 +00:00
refact: use generics for contains functions
This commit is contained in:
@@ -125,7 +125,7 @@ func (machine Machine) isExpired() bool {
|
||||
|
||||
func containsAddresses(inputs []string, addrs []string) bool {
|
||||
for _, addr := range addrs {
|
||||
if containsString(inputs, addr) {
|
||||
if contains(inputs, addr) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -803,7 +803,7 @@ func (h *Headscale) EnableRoutes(machine *Machine, routeStrs ...string) error {
|
||||
}
|
||||
|
||||
for _, newRoute := range newRoutes {
|
||||
if !containsIPPrefix(machine.GetAdvertisedRoutes(), newRoute) {
|
||||
if !contains(machine.GetAdvertisedRoutes(), newRoute) {
|
||||
return fmt.Errorf(
|
||||
"route (%s) is not available on node %s: %w",
|
||||
machine.Name,
|
||||
|
Reference in New Issue
Block a user