提交 5d6b3c57 作者: Lars Gierth

namesys: degrade most logging to debug level

License: MIT
Signed-off-by: 's avatarLars Gierth <larsg@systemli.org>
上级 bbdbd0ac
...@@ -18,10 +18,9 @@ func resolve(ctx context.Context, r resolver, name string, depth int, prefixes . ...@@ -18,10 +18,9 @@ func resolve(ctx context.Context, r resolver, name string, depth int, prefixes .
for { for {
p, err := r.resolveOnce(ctx, name) p, err := r.resolveOnce(ctx, name)
if err != nil { if err != nil {
log.Warningf("Could not resolve %s", name)
return "", err return "", err
} }
log.Debugf("Resolved %s to %s", name, p.String()) log.Debugf("resolved %s to %s", name, p.String())
if strings.HasPrefix(p.String(), "/ipfs/") { if strings.HasPrefix(p.String(), "/ipfs/") {
// we've bottomed out with an IPFS path // we've bottomed out with an IPFS path
......
...@@ -55,7 +55,7 @@ func (r *DNSResolver) resolveOnce(ctx context.Context, name string) (path.Path, ...@@ -55,7 +55,7 @@ func (r *DNSResolver) resolveOnce(ctx context.Context, name string) (path.Path,
if !isd.IsDomain(domain) { if !isd.IsDomain(domain) {
return "", errors.New("not a valid domain name") return "", errors.New("not a valid domain name")
} }
log.Infof("DNSResolver resolving %s", domain) log.Debugf("DNSResolver resolving %s", domain)
rootChan := make(chan lookupRes, 1) rootChan := make(chan lookupRes, 1)
go workDomain(r, domain, rootChan) go workDomain(r, domain, rootChan)
......
...@@ -91,7 +91,7 @@ func (ns *mpns) resolveOnce(ctx context.Context, name string) (path.Path, error) ...@@ -91,7 +91,7 @@ func (ns *mpns) resolveOnce(ctx context.Context, name string) (path.Path, error)
} }
segments := strings.SplitN(name, "/", 4) segments := strings.SplitN(name, "/", 4)
if len(segments) < 3 || segments[0] != "" { if len(segments) < 3 || segments[0] != "" {
log.Warningf("Invalid name syntax for %s", name) log.Debugf("invalid name syntax for %s", name)
return "", ErrResolveFailed return "", ErrResolveFailed
} }
...@@ -153,7 +153,7 @@ func (ns *mpns) resolveOnce(ctx context.Context, name string) (path.Path, error) ...@@ -153,7 +153,7 @@ func (ns *mpns) resolveOnce(ctx context.Context, name string) (path.Path, error)
return "", ErrResolveFailed return "", ErrResolveFailed
} }
log.Warningf("No resolver found for %s", name) log.Debugf("no resolver found for %s", name)
return "", ErrResolveFailed return "", ErrResolveFailed
} }
......
...@@ -117,7 +117,7 @@ func (r *routingResolver) ResolveN(ctx context.Context, name string, depth int) ...@@ -117,7 +117,7 @@ func (r *routingResolver) ResolveN(ctx context.Context, name string, depth int)
// resolveOnce implements resolver. Uses the IPFS routing system to // resolveOnce implements resolver. Uses the IPFS routing system to
// resolve SFS-like names. // resolve SFS-like names.
func (r *routingResolver) resolveOnce(ctx context.Context, name string) (path.Path, error) { func (r *routingResolver) resolveOnce(ctx context.Context, name string) (path.Path, error) {
log.Debugf("RoutingResolve: '%s'", name) log.Debugf("RoutingResolver resolving %s", name)
cached, ok := r.cacheGet(name) cached, ok := r.cacheGet(name)
if ok { if ok {
return cached, nil return cached, nil
...@@ -127,7 +127,7 @@ func (r *routingResolver) resolveOnce(ctx context.Context, name string) (path.Pa ...@@ -127,7 +127,7 @@ func (r *routingResolver) resolveOnce(ctx context.Context, name string) (path.Pa
hash, err := mh.FromB58String(name) hash, err := mh.FromB58String(name)
if err != nil { if err != nil {
// name should be a multihash. if it isn't, error out here. // name should be a multihash. if it isn't, error out here.
log.Warningf("RoutingResolve: bad input hash: [%s]\n", name) log.Debugf("RoutingResolver: bad input hash: [%s]\n", name)
return "", err return "", err
} }
...@@ -143,7 +143,7 @@ func (r *routingResolver) resolveOnce(ctx context.Context, name string) (path.Pa ...@@ -143,7 +143,7 @@ func (r *routingResolver) resolveOnce(ctx context.Context, name string) (path.Pa
ipnsKey := string(h) ipnsKey := string(h)
val, err := r.routing.GetValue(ctx, ipnsKey) val, err := r.routing.GetValue(ctx, ipnsKey)
if err != nil { if err != nil {
log.Warning("RoutingResolve get failed.") log.Debugf("RoutingResolver: dht get failed: %s", err)
resp <- err resp <- err
return return
} }
...@@ -179,7 +179,7 @@ func (r *routingResolver) resolveOnce(ctx context.Context, name string) (path.Pa ...@@ -179,7 +179,7 @@ func (r *routingResolver) resolveOnce(ctx context.Context, name string) (path.Pa
// check sig with pk // check sig with pk
if ok, err := pubkey.Verify(ipnsEntryDataForSig(entry), entry.GetSignature()); err != nil || !ok { if ok, err := pubkey.Verify(ipnsEntryDataForSig(entry), entry.GetSignature()); err != nil || !ok {
return "", fmt.Errorf("Invalid value. Not signed by PrivateKey corresponding to %v", pubkey) return "", fmt.Errorf("ipns entry for %s has invalid signature", h)
} }
// ok sig checks out. this is a valid name. // ok sig checks out. this is a valid name.
...@@ -197,7 +197,7 @@ func (r *routingResolver) resolveOnce(ctx context.Context, name string) (path.Pa ...@@ -197,7 +197,7 @@ func (r *routingResolver) resolveOnce(ctx context.Context, name string) (path.Pa
return p, nil return p, nil
} else { } else {
// Its an old style multihash record // Its an old style multihash record
log.Warning("Detected old style multihash record") log.Debugf("encountered CIDv0 ipns entry: %s", h)
p := path.FromCid(cid.NewCidV0(valh)) p := path.FromCid(cid.NewCidV0(valh))
r.cacheSet(name, p, entry) r.cacheSet(name, p, entry)
return p, nil return p, nil
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论