istore: updated

This commit is contained in:
Олег Бородин
2024-08-07 09:20:36 +02:00
parent f8ba5d2b05
commit 07b32e881e
25 changed files with 620 additions and 447 deletions

1
.gitignore vendored
View File

@@ -6,6 +6,7 @@ Makefile
autom4te.cache/ autom4te.cache/
*.service *.service
tmp.* tmp.*
tmp/*
*.tar.* *.tar.*
cmd/certmanagerctl/certmanagerctl cmd/certmanagerctl/certmanagerctl
cmd/certmanagerd/certmanagerd cmd/certmanagerd/certmanagerd

View File

@@ -23,25 +23,98 @@ certmanagerctl$(EXEEXT): $(certmanagerctl_SOURCES) $(EXTRA_certmanagerd_SOURCES)
env CGO_ENABLED=1 $(GO) build $(GOFLAGS) -o certmanagerctl$(EXEEXT) $(certmanagerctl_SOURCES) env CGO_ENABLED=1 $(GO) build $(GOFLAGS) -o certmanagerctl$(EXEEXT) $(certmanagerctl_SOURCES)
EXTRA_certmanagerd_SOURCES = EXTRA_certmanagerd_SOURCES = \
internal/config/config.go \
internal/database/database.go \
internal/database/issuer.go \
internal/database/service.go \
internal/descriptor/descriptor.go \
internal/grpc/handler/certman.go \
internal/grpc/handler/handler.go \
internal/grpc/handler/status.go \
internal/grpc/service/service.go \
internal/logic/auth.go \
internal/logic/issuer.go \
internal/logic/logic.go \
internal/logic/service.go \
internal/logic/status.go \
internal/server/server.go \
internal/wrpc/handler/basauth.go \
internal/wrpc/handler/handler.go \
internal/wrpc/handler/status.go \
internal/wrpc/service/service.go \
pkg/aux509/x509cert.go \
pkg/auxgin/corsmw.go \
pkg/auxgin/logmw.go \
pkg/auxgin/reqlog.go \
pkg/auxgin/reslog.go \
pkg/auxgrpc/error.go \
pkg/auxhttp/genres.go \
pkg/auxhttp/getbearer.go \
pkg/auxhttp/parseauth.go \
pkg/auxid/genid.go \
pkg/client/auth.go \
pkg/client/certman.go \
pkg/client/control.go \
pkg/cm509/x509.go \
pkg/common/common.go \
pkg/logger/logger.go \
pkg/cmctl/cmctl_grpc.pb.go \
pkg/cmctl/cmctl.pb.go
EXTRA_DIST = $(EXTRA_certmanagerd_SOURCES)
GENDIR=api/certmanagercontrol EXTRA_DIST = $(EXTRA_certmanagerd_SOURCES) \
internal/test/auxfunction_test.go \
internal/test/database_test.go \
internal/test/logic_issuer_create_test.go \
internal/test/logic_issuer_import_test.go \
pkg/aux509/x509cert_test.go \
pkg/cm509/x509_test.go \
internal/test/testchain_a00.crt \
internal/test/testchain_a01.crt \
internal/test/testchain_a02.crt \
internal/test/testchain_a03.crt \
pkg/cm509/testchain_a00.crt \
pkg/cm509/testchain_a01.crt \
pkg/cm509/testchain_a02.crt \
pkg/cm509/testchain_a03.crt \
internal/test/testchain_a00.key \
etc/certmanager/certmanagerd.yaml \
proto/cmctl.proto \
go.mod \
go.sum \
README.md
GENDIR=pkg/cmctl
grpc: grpc:
mkdir -p $(GENDIR) mkdir -p $(GENDIR)
protoc --proto_path=proto --go_out=$(GENDIR) --go-grpc_out=$(GENDIR) proto/certmanagercontrol.proto protoc --proto_path=proto --go_out=$(GENDIR) --go-grpc_out=$(GENDIR) proto/cmctl.proto
SYSTEMD_LIBDIR = /lib/systemd/system SYSTEMD_LIBDIR = /lib/systemd/system
FREEBSD_LOCALBASE = /usr/local
FREEBSD_RCDIR = $(FREEBSD_LOCALBASE)/etc/rc.d
LINUX_SYSTEMDDIR = /lib/systemd/system
install-data-local: install-data-local:
test -z $(DESTDIR)$(SRV_CONFDIR) || $(MKDIR_P) $(DESTDIR)$(SRV_CONFDIR) test -z $(DESTDIR)$(SRV_CONFDIR) || $(MKDIR_P) $(DESTDIR)$(SRV_CONFDIR)
test -z $(DESTDIR)$(SRV_LOGDIR) || $(MKDIR_P) $(DESTDIR)$(SRV_LOGDIR) test -z $(DESTDIR)$(SRV_LOGDIR) || $(MKDIR_P) $(DESTDIR)$(SRV_LOGDIR)
test -z $(DESTDIR)$(SRV_RUNDIR) || $(MKDIR_P) $(DESTDIR)$(SRV_RUNDIR) test -z $(DESTDIR)$(SRV_RUNDIR) || $(MKDIR_P) $(DESTDIR)$(SRV_RUNDIR)
test -z $(DESTDIR)$(SRV_DATADIR) || $(MKDIR_P) $(DESTDIR)$(SRV_DATADIR) test -z $(DESTDIR)$(SRV_DATADIR) || $(MKDIR_P) $(DESTDIR)$(SRV_DATADIR)
test -z $(DESTDIR)$(SYSTEMD_LIBDIR) || $(MKDIR_P) $(DESTDIR)$(SYSTEMD_LIBDIR) test -z $(DESTDIR)$(SYSTEMD_LIBDIR) || $(MKDIR_P) $(DESTDIR)$(SYSTEMD_LIBDIR)
$(INSTALL_DATA) initrc/certmanagerd.service $(DESTDIR)$(SYSTEMD_LIBDIR) if FREEBSD_OS
test -z $(DESTDIR)$(FREEBSD_RCDIR) || $(MKDIR_P) $(DESTDIR)$(FREEBSD_RCDIR)
$(INSTALL_DATA) initrc/certmanagerd $(DESTDIR)$(FREEBSD_RCDIR)
chmod a+x $(DESTDIR)$(FREEBSD_RCDIR)/certmanagerd
endif
if LINUX_OS
if SYSTEMD
test -z $(DESTDIR)$(LINUX_SYSTEMDDIR) || $(MKDIR_P) $(DESTDIR)$(LINUX_SYSTEMDDIR)
$(INSTALL_DATA) initrc/certmanagerd.service $(DESTDIR)$(LINUX_SYSTEMDDIR)
endif
endif
goformat: gformat goformat: gformat
gformat: gformat:
@@ -62,5 +135,6 @@ clean-local:
rm -rf autom4te.cache rm -rf autom4te.cache
rm -f cmd/certmanagerd/certmanagerd rm -f cmd/certmanagerd/certmanagerd
rm -f cmd/certmanagerctl/certmanagerctl rm -f cmd/certmanagerctl/certmanagerctl
rm -rf tmp.*/ rm -rf tmp/
rm -rf autom4te.cache/

View File

@@ -301,10 +301,72 @@ certmanagerctl_SOURCES = cmd/certmanagerctl/main.go \
cmd/certmanagerctl/servicecli.go \ cmd/certmanagerctl/servicecli.go \
cmd/certmanagerctl/issuercli.go cmd/certmanagerctl/issuercli.go
EXTRA_certmanagerd_SOURCES = EXTRA_certmanagerd_SOURCES = \
EXTRA_DIST = $(EXTRA_certmanagerd_SOURCES) internal/config/config.go \
GENDIR = api/certmanagercontrol internal/database/database.go \
internal/database/issuer.go \
internal/database/service.go \
internal/descriptor/descriptor.go \
internal/grpc/handler/certman.go \
internal/grpc/handler/handler.go \
internal/grpc/handler/status.go \
internal/grpc/service/service.go \
internal/logic/auth.go \
internal/logic/issuer.go \
internal/logic/logic.go \
internal/logic/service.go \
internal/logic/status.go \
internal/server/server.go \
internal/wrpc/handler/basauth.go \
internal/wrpc/handler/handler.go \
internal/wrpc/handler/status.go \
internal/wrpc/service/service.go \
pkg/aux509/x509cert.go \
pkg/auxgin/corsmw.go \
pkg/auxgin/logmw.go \
pkg/auxgin/reqlog.go \
pkg/auxgin/reslog.go \
pkg/auxgrpc/error.go \
pkg/auxhttp/genres.go \
pkg/auxhttp/getbearer.go \
pkg/auxhttp/parseauth.go \
pkg/auxid/genid.go \
pkg/client/auth.go \
pkg/client/certman.go \
pkg/client/control.go \
pkg/cm509/x509.go \
pkg/common/common.go \
pkg/logger/logger.go \
pkg/cmctl/cmctl_grpc.pb.go \
pkg/cmctl/cmctl.pb.go
EXTRA_DIST = $(EXTRA_certmanagerd_SOURCES) \
internal/test/auxfunction_test.go \
internal/test/database_test.go \
internal/test/logic_issuer_create_test.go \
internal/test/logic_issuer_import_test.go \
pkg/aux509/x509cert_test.go \
pkg/cm509/x509_test.go \
internal/test/testchain_a00.crt \
internal/test/testchain_a01.crt \
internal/test/testchain_a02.crt \
internal/test/testchain_a03.crt \
pkg/cm509/testchain_a00.crt \
pkg/cm509/testchain_a01.crt \
pkg/cm509/testchain_a02.crt \
pkg/cm509/testchain_a03.crt \
internal/test/testchain_a00.key \
etc/certmanager/certmanagerd.yaml \
proto/cmctl.proto \
go.mod \
go.sum \
README.md
GENDIR = pkg/cmctl
SYSTEMD_LIBDIR = /lib/systemd/system SYSTEMD_LIBDIR = /lib/systemd/system
FREEBSD_LOCALBASE = /usr/local
FREEBSD_RCDIR = $(FREEBSD_LOCALBASE)/etc/rc.d
LINUX_SYSTEMDDIR = /lib/systemd/system
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:
@@ -804,7 +866,7 @@ certmanagerctl$(EXEEXT): $(certmanagerctl_SOURCES) $(EXTRA_certmanagerd_SOURCES)
env CGO_ENABLED=1 $(GO) build $(GOFLAGS) -o certmanagerctl$(EXEEXT) $(certmanagerctl_SOURCES) env CGO_ENABLED=1 $(GO) build $(GOFLAGS) -o certmanagerctl$(EXEEXT) $(certmanagerctl_SOURCES)
grpc: grpc:
mkdir -p $(GENDIR) mkdir -p $(GENDIR)
protoc --proto_path=proto --go_out=$(GENDIR) --go-grpc_out=$(GENDIR) proto/certmanagercontrol.proto protoc --proto_path=proto --go_out=$(GENDIR) --go-grpc_out=$(GENDIR) proto/cmctl.proto
install-data-local: install-data-local:
test -z $(DESTDIR)$(SRV_CONFDIR) || $(MKDIR_P) $(DESTDIR)$(SRV_CONFDIR) test -z $(DESTDIR)$(SRV_CONFDIR) || $(MKDIR_P) $(DESTDIR)$(SRV_CONFDIR)
@@ -812,7 +874,11 @@ install-data-local:
test -z $(DESTDIR)$(SRV_RUNDIR) || $(MKDIR_P) $(DESTDIR)$(SRV_RUNDIR) test -z $(DESTDIR)$(SRV_RUNDIR) || $(MKDIR_P) $(DESTDIR)$(SRV_RUNDIR)
test -z $(DESTDIR)$(SRV_DATADIR) || $(MKDIR_P) $(DESTDIR)$(SRV_DATADIR) test -z $(DESTDIR)$(SRV_DATADIR) || $(MKDIR_P) $(DESTDIR)$(SRV_DATADIR)
test -z $(DESTDIR)$(SYSTEMD_LIBDIR) || $(MKDIR_P) $(DESTDIR)$(SYSTEMD_LIBDIR) test -z $(DESTDIR)$(SYSTEMD_LIBDIR) || $(MKDIR_P) $(DESTDIR)$(SYSTEMD_LIBDIR)
$(INSTALL_DATA) initrc/certmanagerd.service $(DESTDIR)$(SYSTEMD_LIBDIR) @FREEBSD_OS_TRUE@ test -z $(DESTDIR)$(FREEBSD_RCDIR) || $(MKDIR_P) $(DESTDIR)$(FREEBSD_RCDIR)
@FREEBSD_OS_TRUE@ $(INSTALL_DATA) initrc/certmanagerd $(DESTDIR)$(FREEBSD_RCDIR)
@FREEBSD_OS_TRUE@ chmod a+x $(DESTDIR)$(FREEBSD_RCDIR)/certmanagerd
@LINUX_OS_TRUE@@SYSTEMD_TRUE@ test -z $(DESTDIR)$(LINUX_SYSTEMDDIR) || $(MKDIR_P) $(DESTDIR)$(LINUX_SYSTEMDDIR)
@LINUX_OS_TRUE@@SYSTEMD_TRUE@ $(INSTALL_DATA) initrc/certmanagerd.service $(DESTDIR)$(LINUX_SYSTEMDDIR)
goformat: gformat goformat: gformat
gformat: gformat:
@@ -833,7 +899,8 @@ clean-local:
rm -rf autom4te.cache rm -rf autom4te.cache
rm -f cmd/certmanagerd/certmanagerd rm -f cmd/certmanagerd/certmanagerd
rm -f cmd/certmanagerctl/certmanagerctl rm -f cmd/certmanagerctl/certmanagerctl
rm -rf tmp.*/ rm -rf tmp/
rm -rf autom4te.cache/
# Tell versions [3.59,3.63) of GNU make to not export all variables. # Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded. # Otherwise a system limit (for SysV at least) may be exceeded.

View File

@@ -5,7 +5,7 @@ import (
"encoding/base64" "encoding/base64"
"os" "os"
cmapi "certmanager/api/certmanagercontrol" cmapi "certmanager/pkg/cmctl"
"certmanager/pkg/client" "certmanager/pkg/client"
) )

View File

@@ -14,7 +14,7 @@ import (
"path/filepath" "path/filepath"
"time" "time"
cmapi "certmanager/api/certmanagercontrol" cmapi "certmanager/pkg/cmctl"
"certmanager/pkg/client" "certmanager/pkg/client"
"sigs.k8s.io/yaml" "sigs.k8s.io/yaml"

View File

@@ -5,7 +5,7 @@ import (
"encoding/base64" "encoding/base64"
"strings" "strings"
cmapi "certmanager/api/certmanagercontrol" cmapi "certmanager/pkg/cmctl"
"certmanager/pkg/client" "certmanager/pkg/client"
) )

6
configure vendored
View File

@@ -3075,7 +3075,7 @@ fi
if test "x$enable_devel_mode" = "xyes" if test "x$enable_devel_mode" = "xyes"
then : then :
SRV_LOGDIR="${SRCDIR}/tmp.log" SRV_LOGDIR="${SRCDIR}/tmp/log"
fi fi
@@ -3113,7 +3113,7 @@ fi
if test "x$enable_devel_mode" = "xyes" if test "x$enable_devel_mode" = "xyes"
then : then :
SRV_RUNDIR="${SRCDIR}/tmp.run" SRV_RUNDIR="${SRCDIR}/tmp/run"
fi fi
@@ -3152,7 +3152,7 @@ fi
if test "x$enable_devel_mode" = "xyes" if test "x$enable_devel_mode" = "xyes"
then : then :
SRV_DATADIR="${SRCDIR}/tmp.data" SRV_DATADIR="${SRCDIR}/tmp/data"
fi fi

View File

@@ -117,7 +117,7 @@ AC_ARG_WITH(logdir,
fi ]) fi ])
AS_IF([test "x$enable_devel_mode" = "xyes"], [ AS_IF([test "x$enable_devel_mode" = "xyes"], [
SRV_LOGDIR="${SRCDIR}/tmp.log" SRV_LOGDIR="${SRCDIR}/tmp/log"
]) ])
@@ -144,7 +144,7 @@ AC_ARG_WITH(rundir,
fi ]) fi ])
AS_IF([test "x$enable_devel_mode" = "xyes"], [ AS_IF([test "x$enable_devel_mode" = "xyes"], [
SRV_RUNDIR="${SRCDIR}/tmp.run" SRV_RUNDIR="${SRCDIR}/tmp/run"
]) ])
AC_DEFINE_UNQUOTED(SRV_RUNDIR, "$SRV_RUNDIR", [location of rundir]) AC_DEFINE_UNQUOTED(SRV_RUNDIR, "$SRV_RUNDIR", [location of rundir])
@@ -172,7 +172,7 @@ AC_ARG_WITH(datadir,
AS_IF([test "x$enable_devel_mode" = "xyes"], [ AS_IF([test "x$enable_devel_mode" = "xyes"], [
SRV_DATADIR="${SRCDIR}/tmp.data" SRV_DATADIR="${SRCDIR}/tmp/data"
]) ])
AC_DEFINE_UNQUOTED(SRV_DATADIR, "$SRV_DATADIR", [location of datadir]) AC_DEFINE_UNQUOTED(SRV_DATADIR, "$SRV_DATADIR", [location of datadir])

22
initrc/certmanagerd.in Normal file
View File

@@ -0,0 +1,22 @@
#!/bin/sh
#
# PROVIDE: certmanagerd
# REQUIRE: DAEMON
. /etc/rc.subr
name="certmanagerd"
rcvar="certmanagerd_enable"
pidfile="@srv_rundir@"/certmanagerd.pid
command="@prefix@/sbin/${name}"
command_args="-daemon"
procname="@prefix@/sbin/${name}"
load_rc_config ${name}
: ${certmanagerd_enable:="NO"}
run_rc_command "$1"
#EOF

View File

@@ -1,8 +1,9 @@
package config package config
const ( const (
confdirPath = "/home/ziggi/projects/certman/etc/certmanager" confdirPath = "/home/ziggi/Projects/certman/etc/certmanager"
rundirPath = "/home/ziggi/projects/certman/tmp.run" rundirPath = "/home/ziggi/Projects/certman/tmp/run"
logdirPath = "/home/ziggi/projects/certman/tmp.log" logdirPath = "/home/ziggi/Projects/certman/tmp/log"
datadirPath = "/home/ziggi/projects/certman/tmp.data" datadirPath = "/home/ziggi/Projects/certman/tmp/data"
) )

View File

@@ -3,73 +3,73 @@ package handler
import ( import (
"context" "context"
"certmanager/api/certmanagercontrol" "certmanager/pkg/cmctl"
) )
func (hand *Handler) CreateIssuerPair(ctx context.Context, req *certmanagercontrol.CreateIssuerPairParams) (*certmanagercontrol.CreateIssuerPairResult, error) { func (hand *Handler) CreateIssuerPair(ctx context.Context, req *cmctl.CreateIssuerPairParams) (*cmctl.CreateIssuerPairResult, error) {
var err error var err error
hand.log.Debugf("Handle CreateIssuerPair request") hand.log.Debugf("Handle CreateIssuerPair request")
res, err := hand.lg.CreateIssuerPair(ctx, req) res, err := hand.lg.CreateIssuerPair(ctx, req)
return res, err return res, err
} }
func (hand *Handler) ImportIssuerPair(ctx context.Context, req *certmanagercontrol.ImportIssuerPairParams) (*certmanagercontrol.ImportIssuerPairResult, error) { func (hand *Handler) ImportIssuerPair(ctx context.Context, req *cmctl.ImportIssuerPairParams) (*cmctl.ImportIssuerPairResult, error) {
var err error var err error
hand.log.Debugf("Handle ImportIssuerPair request") hand.log.Debugf("Handle ImportIssuerPair request")
res, err := hand.lg.ImportIssuerPair(ctx, req) res, err := hand.lg.ImportIssuerPair(ctx, req)
return res, err return res, err
} }
func (hand *Handler) RevokeIssuerPair(ctx context.Context, req *certmanagercontrol.RevokeIssuerPairParams) (*certmanagercontrol.RevokeIssuerPairResult, error) { func (hand *Handler) RevokeIssuerPair(ctx context.Context, req *cmctl.RevokeIssuerPairParams) (*cmctl.RevokeIssuerPairResult, error) {
var err error var err error
hand.log.Debugf("Handle RevokeIssuerPair request") hand.log.Debugf("Handle RevokeIssuerPair request")
res, err := hand.lg.RevokeIssuerPair(ctx, req) res, err := hand.lg.RevokeIssuerPair(ctx, req)
return res, err return res, err
} }
func (hand *Handler) UnrevokeIssuerPair(ctx context.Context, req *certmanagercontrol.UnrevokeIssuerPairParams) (*certmanagercontrol.UnrevokeIssuerPairResult, error) { func (hand *Handler) UnrevokeIssuerPair(ctx context.Context, req *cmctl.UnrevokeIssuerPairParams) (*cmctl.UnrevokeIssuerPairResult, error) {
var err error var err error
hand.log.Debugf("Handle UnrevokeIssuerPair request") hand.log.Debugf("Handle UnrevokeIssuerPair request")
res, err := hand.lg.UnrevokeIssuerPair(ctx, req) res, err := hand.lg.UnrevokeIssuerPair(ctx, req)
return res, err return res, err
} }
func (hand *Handler) ListIssuerPairs(ctx context.Context, req *certmanagercontrol.ListIssuerPairsParams) (*certmanagercontrol.ListIssuerPairsResult, error) { func (hand *Handler) ListIssuerPairs(ctx context.Context, req *cmctl.ListIssuerPairsParams) (*cmctl.ListIssuerPairsResult, error) {
var err error var err error
hand.log.Debugf("Handle ListIssuerPairs request") hand.log.Debugf("Handle ListIssuerPairs request")
res, err := hand.lg.ListIssuerPairs(ctx, req) res, err := hand.lg.ListIssuerPairs(ctx, req)
return res, err return res, err
} }
func (hand *Handler) GetIssuerCertificate(ctx context.Context, req *certmanagercontrol.GetIssuerCertificateParams) (*certmanagercontrol.GetIssuerCertificateResult, error) { func (hand *Handler) GetIssuerCertificate(ctx context.Context, req *cmctl.GetIssuerCertificateParams) (*cmctl.GetIssuerCertificateResult, error) {
var err error var err error
hand.log.Debugf("Handle GetIssuerCertificate request") hand.log.Debugf("Handle GetIssuerCertificate request")
res, err := hand.lg.GetIssuerCertificate(ctx, req) res, err := hand.lg.GetIssuerCertificate(ctx, req)
return res, err return res, err
} }
func (hand *Handler) CreateServicePair(ctx context.Context, req *certmanagercontrol.CreateServicePairParams) (*certmanagercontrol.CreateServicePairResult, error) { func (hand *Handler) CreateServicePair(ctx context.Context, req *cmctl.CreateServicePairParams) (*cmctl.CreateServicePairResult, error) {
var err error var err error
hand.log.Debugf("Handle CreateServicePair request") hand.log.Debugf("Handle CreateServicePair request")
res, err := hand.lg.CreateServicePair(ctx, req) res, err := hand.lg.CreateServicePair(ctx, req)
return res, err return res, err
} }
func (hand *Handler) RevokeServicePair(ctx context.Context, req *certmanagercontrol.RevokeServicePairParams) (*certmanagercontrol.RevokeServicePairResult, error) { func (hand *Handler) RevokeServicePair(ctx context.Context, req *cmctl.RevokeServicePairParams) (*cmctl.RevokeServicePairResult, error) {
var err error var err error
hand.log.Debugf("Handle RevokeServicePair request") hand.log.Debugf("Handle RevokeServicePair request")
res, err := hand.lg.RevokeServicePair(ctx, req) res, err := hand.lg.RevokeServicePair(ctx, req)
return res, err return res, err
} }
func (hand *Handler) ListServicePairs(ctx context.Context, req *certmanagercontrol.ListServicePairsParams) (*certmanagercontrol.ListServicePairsResult, error) { func (hand *Handler) ListServicePairs(ctx context.Context, req *cmctl.ListServicePairsParams) (*cmctl.ListServicePairsResult, error) {
var err error var err error
hand.log.Debugf("Handle ListServicePairs request") hand.log.Debugf("Handle ListServicePairs request")
res, err := hand.lg.ListServicePairs(ctx, req) res, err := hand.lg.ListServicePairs(ctx, req)
return res, err return res, err
} }
func (hand *Handler) GetServicePair(ctx context.Context, req *certmanagercontrol.GetServicePairParams) (*certmanagercontrol.GetServicePairResult, error) { func (hand *Handler) GetServicePair(ctx context.Context, req *cmctl.GetServicePairParams) (*cmctl.GetServicePairResult, error) {
var err error var err error
hand.log.Debugf("Handle GetServicePair request") hand.log.Debugf("Handle GetServicePair request")
res, err := hand.lg.GetServicePair(ctx, req) res, err := hand.lg.GetServicePair(ctx, req)

View File

@@ -1,7 +1,7 @@
package handler package handler
import ( import (
"certmanager/api/certmanagercontrol" "certmanager/pkg/cmctl"
"certmanager/internal/logic" "certmanager/internal/logic"
"certmanager/pkg/logger" "certmanager/pkg/logger"
@@ -13,7 +13,7 @@ type HandlerConfig struct {
} }
type Handler struct { type Handler struct {
certmanagercontrol.UnimplementedControlServer cmctl.UnimplementedControlServer
lg *logic.Logic lg *logic.Logic
log *logger.Logger log *logger.Logger
} }
@@ -27,5 +27,5 @@ func NewHandler(conf *HandlerConfig) *Handler {
} }
func (hand *Handler) Register(gsrv *grpc.Server) { func (hand *Handler) Register(gsrv *grpc.Server) {
certmanagercontrol.RegisterControlServer(gsrv, hand) cmctl.RegisterControlServer(gsrv, hand)
} }

View File

@@ -3,10 +3,10 @@ package handler
import ( import (
"context" "context"
"certmanager/api/certmanagercontrol" "certmanager/pkg/cmctl"
) )
func (hand *Handler) GetStatus(ctx context.Context, req *certmanagercontrol.GetStatusParams) (*certmanagercontrol.GetStatusResult, error) { func (hand *Handler) GetStatus(ctx context.Context, req *cmctl.GetStatusParams) (*cmctl.GetStatusResult, error) {
var err error var err error
hand.log.Debugf("Handle getStatus request") hand.log.Debugf("Handle getStatus request")
res, err := hand.lg.GetStatus(ctx, req) res, err := hand.lg.GetStatus(ctx, req)

View File

@@ -5,7 +5,7 @@ import (
"fmt" "fmt"
"time" "time"
cmapi "certmanager/api/certmanagercontrol" cmapi "certmanager/pkg/cmctl"
"certmanager/internal/descriptor" "certmanager/internal/descriptor"
"certmanager/pkg/cm509" "certmanager/pkg/cm509"
) )

View File

@@ -4,7 +4,7 @@ import (
"context" "context"
"fmt" "fmt"
cmapi "certmanager/api/certmanagercontrol" cmapi "certmanager/pkg/cmctl"
"certmanager/internal/descriptor" "certmanager/internal/descriptor"
"certmanager/pkg/cm509" "certmanager/pkg/cm509"
) )

View File

@@ -3,12 +3,12 @@ package logic
import ( import (
"context" "context"
"certmanager/api/certmanagercontrol" "certmanager/pkg/cmctl"
) )
func (lg *Logic) GetStatus(ctx context.Context, params *certmanagercontrol.GetStatusParams) (*certmanagercontrol.GetStatusResult, error) { func (lg *Logic) GetStatus(ctx context.Context, params *cmctl.GetStatusParams) (*cmctl.GetStatusResult, error) {
var err error var err error
res := &certmanagercontrol.GetStatusResult{ res := &cmctl.GetStatusResult{
Message: "Hello", Message: "Hello",
} }
return res, err return res, err

View File

@@ -233,9 +233,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \ exit 1;; \
esac; \ esac; \
done; \ done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu internal/test/Makefile'; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign internal/test/Makefile'; \
$(am__cd) $(top_srcdir) && \ $(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu internal/test/Makefile $(AUTOMAKE) --foreign internal/test/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \ @case '$?' in \
*config.status*) \ *config.status*) \

View File

@@ -6,7 +6,7 @@ import (
"testing" "testing"
"time" "time"
cmapi "certmanager/api/certmanagercontrol" cmapi "certmanager/pkg/cmctl"
"certmanager/internal/config" "certmanager/internal/config"
"certmanager/internal/database" "certmanager/internal/database"
"certmanager/internal/logic" "certmanager/internal/logic"

View File

@@ -11,7 +11,7 @@ import (
"testing" "testing"
"time" "time"
cmapi "certmanager/api/certmanagercontrol" cmapi "certmanager/pkg/cmctl"
"certmanager/internal/config" "certmanager/internal/config"
"certmanager/internal/database" "certmanager/internal/database"
"certmanager/internal/logic" "certmanager/internal/logic"

View File

@@ -1,7 +1,7 @@
package handler package handler
import ( import (
"certmanager/api/certmanagercontrol" "certmanager/pkg/cmctl"
"certmanager/pkg/auxhttp" "certmanager/pkg/auxhttp"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
@@ -9,7 +9,7 @@ import (
func (hand *Handler) GetStatus(gctx *gin.Context) { func (hand *Handler) GetStatus(gctx *gin.Context) {
var err error var err error
nReq := &certmanagercontrol.GetStatusParams{} nReq := &cmctl.GetStatusParams{}
// Bind request // Bind request
err = gctx.ShouldBind(nReq) err = gctx.ShouldBind(nReq)
if err != nil { if err != nil {

View File

@@ -4,7 +4,7 @@ import (
"context" "context"
"time" "time"
cmapi "certmanager/api/certmanagercontrol" cmapi "certmanager/pkg/cmctl"
"certmanager/pkg/auxgrpc" "certmanager/pkg/auxgrpc"
) )

View File

@@ -6,7 +6,7 @@ import (
"fmt" "fmt"
"time" "time"
cmapi "certmanager/api/certmanagercontrol" cmapi "certmanager/pkg/cmctl"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials"

View File

@@ -2,9 +2,9 @@
// versions: // versions:
// - protoc-gen-go-grpc v1.3.0 // - protoc-gen-go-grpc v1.3.0
// - protoc v3.21.12 // - protoc v3.21.12
// source: certmanagercontrol.proto // source: cmctl.proto
package certmanagercontrol package cmctl
import ( import (
context "context" context "context"
@@ -512,5 +512,5 @@ var Control_ServiceDesc = grpc.ServiceDesc{
}, },
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "certmanagercontrol.proto", Metadata: "cmctl.proto",
} }

View File

@@ -1,6 +1,6 @@
syntax = "proto3"; syntax = "proto3";
option go_package = ".;certmanagercontrol"; option go_package = ".;cmctl";
package certmanagercontrol; package certmanagercontrol;
@@ -84,7 +84,6 @@ message IssierShortDescriptor {
bool revoked = 3; bool revoked = 3;
} }
message createServicePairParams { message createServicePairParams {
string issuerName = 1; string issuerName = 1;
int64 issuerID = 2; int64 issuerID = 2;
@@ -143,5 +142,5 @@ message getServicePairResult {
string issuerName = 5; string issuerName = 5;
bool revoked = 6; bool revoked = 6;
string issuerCertificate = 7; string issuerCertificate = 7;
repeated string issuerCertificates = 8;
} }