import from minilb repo

This commit is contained in:
2026-03-25 16:55:28 +02:00
parent 8efe7090be
commit 3aa1e52a5d
37 changed files with 1977 additions and 424 deletions

View File

@@ -15,13 +15,13 @@ type HandlerConfig struct {
type Handler struct {
mlbctl.UnimplementedControlServer
lg *operator.Operator
log *logger.Logger
oper *operator.Operator
log *logger.Logger
}
func NewHandler(conf *HandlerConfig) *Handler {
hand := Handler{
lg: conf.Operator,
oper: conf.Operator,
}
hand.log = logger.NewLogger("handler")
return &hand

View File

@@ -9,6 +9,6 @@ import (
func (hand *Handler) GetHello(ctx context.Context, req *mlbctl.GetHelloParams) (*mlbctl.GetHelloResult, error) {
var err error
hand.log.Debugf("Handle getHello request")
res, err := hand.lg.GetHello(ctx, req)
res, err := hand.oper.GetHello(ctx, req)
return res, err
}

25
app/handler/proxy.go Normal file
View File

@@ -0,0 +1,25 @@
package handler
import (
"context"
"helmet/pkg/mlbctl"
)
func (hand *Handler) ListForwarders(ctx context.Context, req *mlbctl.ListForwardersParams) (*mlbctl.ListForwardersResult, error) {
var err error
res, err := hand.oper.ListForwarders(ctx, req)
return res, err
}
func (hand *Handler) CreateForwarder(ctx context.Context, req *mlbctl.CreateForwarderParams) (*mlbctl.CreateForwarderResult, error) {
var err error
res, err := hand.oper.CreateForwarder(ctx, req)
return res, err
}
func (hand *Handler) DeleteForwarder(ctx context.Context, req *mlbctl.DeleteForwarderParams) (*mlbctl.DeleteForwarderResult, error) {
var err error
res, err := hand.oper.DeleteForwarder(ctx, req)
return res, err
}