update caching and server creation

This commit is contained in:
Fran Jurmanović
2025-06-01 19:48:39 +02:00
parent 8a3b11b1ef
commit d57013bb50
26 changed files with 888 additions and 249 deletions

View File

@@ -0,0 +1,26 @@
package regex_handler
import (
"acc-server-manager/local/model"
"regexp"
)
type AccServerInstance struct {
Model *model.Server
State *model.ServerState
}
type RegexHandler struct {
regex *regexp.Regexp
}
func (rh *RegexHandler) Contains(line string, callback func(...string)) {
match := rh.regex.FindStringSubmatch(line)
callback(match...)
}
func New(str string) *RegexHandler {
return &RegexHandler{
regex: regexp.MustCompile(str),
}
}