mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 18:37:45 +08:00
namesys: degrade most logging to debug level
License: MIT Signed-off-by: Lars Gierth <larsg@systemli.org>
This commit is contained in:
parent
bbdbd0ac6f
commit
5d6b3c5701
@ -18,10 +18,9 @@ func resolve(ctx context.Context, r resolver, name string, depth int, prefixes .
|
||||
for {
|
||||
p, err := r.resolveOnce(ctx, name)
|
||||
if err != nil {
|
||||
log.Warningf("Could not resolve %s", name)
|
||||
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/") {
|
||||
// we've bottomed out with an IPFS path
|
||||
|
||||
@ -55,7 +55,7 @@ func (r *DNSResolver) resolveOnce(ctx context.Context, name string) (path.Path,
|
||||
if !isd.IsDomain(domain) {
|
||||
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)
|
||||
go workDomain(r, domain, rootChan)
|
||||
|
||||
@ -91,7 +91,7 @@ func (ns *mpns) resolveOnce(ctx context.Context, name string) (path.Path, error)
|
||||
}
|
||||
segments := strings.SplitN(name, "/", 4)
|
||||
if len(segments) < 3 || segments[0] != "" {
|
||||
log.Warningf("Invalid name syntax for %s", name)
|
||||
log.Debugf("invalid name syntax for %s", name)
|
||||
return "", ErrResolveFailed
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ func (ns *mpns) resolveOnce(ctx context.Context, name string) (path.Path, error)
|
||||
return "", ErrResolveFailed
|
||||
}
|
||||
|
||||
log.Warningf("No resolver found for %s", name)
|
||||
log.Debugf("no resolver found for %s", name)
|
||||
return "", ErrResolveFailed
|
||||
}
|
||||
|
||||
|
||||
@ -117,7 +117,7 @@ func (r *routingResolver) ResolveN(ctx context.Context, name string, depth int)
|
||||
// resolveOnce implements resolver. Uses the IPFS routing system to
|
||||
// resolve SFS-like names.
|
||||
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)
|
||||
if ok {
|
||||
return cached, nil
|
||||
@ -127,7 +127,7 @@ func (r *routingResolver) resolveOnce(ctx context.Context, name string) (path.Pa
|
||||
hash, err := mh.FromB58String(name)
|
||||
if err != nil {
|
||||
// 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
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ func (r *routingResolver) resolveOnce(ctx context.Context, name string) (path.Pa
|
||||
ipnsKey := string(h)
|
||||
val, err := r.routing.GetValue(ctx, ipnsKey)
|
||||
if err != nil {
|
||||
log.Warning("RoutingResolve get failed.")
|
||||
log.Debugf("RoutingResolver: dht get failed: %s", err)
|
||||
resp <- err
|
||||
return
|
||||
}
|
||||
@ -179,7 +179,7 @@ func (r *routingResolver) resolveOnce(ctx context.Context, name string) (path.Pa
|
||||
|
||||
// check sig with pk
|
||||
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.
|
||||
@ -197,7 +197,7 @@ func (r *routingResolver) resolveOnce(ctx context.Context, name string) (path.Pa
|
||||
return p, nil
|
||||
} else {
|
||||
// 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))
|
||||
r.cacheSet(name, p, entry)
|
||||
return p, nil
|
||||
|
||||
Loading…
Reference in New Issue
Block a user