forked from TrueCloudLab/frostfs-http-gw
[#129] Remove resolver duplicate
Signed-off-by: Alex Vanin <a.vanin@yadro.com>
This commit is contained in:
parent
418767c8ec
commit
9e2d1208cb
2 changed files with 1 additions and 36 deletions
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
Loading…
Reference in a new issue