avoid adding static nodes to tags

This commit is contained in:
abhishek9686 2024-11-11 16:59:16 +04:00
parent d485a3060f
commit dcbe94eeb5
3 changed files with 4 additions and 16 deletions

View file

@ -470,8 +470,8 @@ func createExtClient(w http.ResponseWriter, r *http.Request) {
extclient.IngressGatewayID = nodeid
extclient.Network = node.Network
extclient.Tags = make(map[models.TagID]struct{})
extclient.Tags[models.TagID(fmt.Sprintf("%s.%s", extclient.Network,
models.RemoteAccessTagName))] = struct{}{}
// extclient.Tags[models.TagID(fmt.Sprintf("%s.%s", extclient.Network,
// models.RemoteAccessTagName))] = struct{}{}
// set extclient dns to ingressdns if extclient dns is not explicitly set
if (extclient.DNS == "") && (node.IngressDNS != "") {
extclient.DNS = node.IngressDNS

View file

@ -226,18 +226,6 @@ func updateNodes() {
}
}
}
extclients, _ := logic.GetAllExtClients()
for _, extclient := range extclients {
tagID := models.TagID(fmt.Sprintf("%s.%s", extclient.Network,
models.RemoteAccessTagName))
if extclient.Tags == nil {
extclient.Tags = make(map[models.TagID]struct{})
}
if _, ok := extclient.Tags[tagID]; !ok {
extclient.Tags[tagID] = struct{}{}
logic.SaveExtClient(&extclient)
}
}
}
func removeInterGw(egressRanges []string) ([]string, bool) {

View file

@ -1006,8 +1006,8 @@ func getRemoteAccessGatewayConf(w http.ResponseWriter, r *http.Request) {
userConf.Enabled = parentNetwork.DefaultACL == "yes"
}
userConf.Tags = make(map[models.TagID]struct{})
userConf.Tags[models.TagID(fmt.Sprintf("%s.%s", userConf.Network,
models.RemoteAccessTagName))] = struct{}{}
// userConf.Tags[models.TagID(fmt.Sprintf("%s.%s", userConf.Network,
// models.RemoteAccessTagName))] = struct{}{}
if err = logic.CreateExtClient(&userConf); err != nil {
slog.Error(
"failed to create extclient",