From 9e2d1208cb20a2993de526061f859e2dc0ce3533 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 19 Jul 2024 17:55:34 +0300 Subject: [PATCH] [#129] Remove resolver duplicate Signed-off-by: Alex Vanin --- cmd/http-gw/app.go | 2 +- resolver/frostfs.go | 35 ----------------------------------- 2 files changed, 1 insertion(+), 36 deletions(-) delete mode 100644 resolver/frostfs.go diff --git a/cmd/http-gw/app.go b/cmd/http-gw/app.go index 3d02faa..561598f 100644 --- a/cmd/http-gw/app.go +++ b/cmd/http-gw/app.go @@ -223,7 +223,7 @@ func (a *app) initResolver() { func (a *app) getResolverConfig() ([]string, *resolver.Config) { resolveCfg := &resolver.Config{ - FrostFS: resolver.NewFrostFSResolver(a.pool), + FrostFS: frostfs.NewResolverFrostFS(a.pool), RPCAddress: a.cfg.GetString(cfgRPCEndpoint), Settings: a.settings, } diff --git a/resolver/frostfs.go b/resolver/frostfs.go deleted file mode 100644 index aa7a751..0000000 --- a/resolver/frostfs.go +++ /dev/null @@ -1,35 +0,0 @@ -package resolver - -import ( - "context" - "errors" - "fmt" - - "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool" -) - -// FrostFSResolver represents virtual connection to the FrostFS network. -// It implements resolver.FrostFS. -type FrostFSResolver struct { - pool *pool.Pool -} - -// NewFrostFSResolver creates new FrostFSResolver using provided pool.Pool. -func NewFrostFSResolver(p *pool.Pool) *FrostFSResolver { - return &FrostFSResolver{pool: p} -} - -// SystemDNS implements resolver.FrostFS interface method. -func (x *FrostFSResolver) SystemDNS(ctx context.Context) (string, error) { - networkInfo, err := x.pool.NetworkInfo(ctx) - if err != nil { - return "", fmt.Errorf("read network info via client: %w", err) - } - - domain := networkInfo.RawNetworkParameter("SystemDNS") - if domain == nil { - return "", errors.New("system DNS parameter not found or empty") - } - - return string(domain), nil -}