import template code

This commit is contained in:
2026-03-24 10:31:30 +02:00
commit b443292720
974 changed files with 487563 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
package operator
import (
"helmet/pkg/passwd"
)
func (oper *Operator) ValidateUser(username, password string) bool {
for i := range oper.auths {
if username == oper.auths[i].Username && passwd.PasswordMatchCompat([]byte(password), oper.auths[i].Password) {
return true
}
}
return false
}
+15
View File
@@ -0,0 +1,15 @@
package operator
import (
"context"
"helmet/pkg/mlbctl"
)
func (lg *Operator) GetHello(ctx context.Context, req *mlbctl.GetHelloParams) (*mlbctl.GetHelloResult, error) {
var err error
res := &mlbctl.GetHelloResult{
Message: "hello",
}
return res, err
}
+25
View File
@@ -0,0 +1,25 @@
package operator
import (
"helmet/app/logger"
"helmet/app/config"
)
type OperatorConfig struct {
Auths []config.Auth
}
type Operator struct {
log *logger.Logger
auths []config.Auth
}
func NewOperator(conf *OperatorConfig) (*Operator, error) {
var err error
lg := &Operator{
auths: conf.Auths,
}
lg.log = logger.NewLogger("operator")
return lg, err
}