Myzel394 020cc8ad67
refactor(server): Improve Wireguard indexes
Signed-off-by: Myzel394 <github.7a2op@simplelogin.co>
2025-03-16 00:23:54 +01:00

23 lines
470 B
Go

package indexes
import (
"config-lsp/common"
"config-lsp/handlers/wireguard/ast"
)
func CreateIndexes(config *ast.WGConfig) (*WGIndexes, []common.LSPError) {
errs := make([]common.LSPError, 0)
indexes := &WGIndexes{
SectionsByName: make(map[string][]*ast.WGSection),
}
for _, section := range config.Sections {
indexes.SectionsByName[section.Header.Name] = append(
indexes.SectionsByName[section.Header.Name],
section,
)
}
return indexes, errs
}