Introduced `lol.Tracer` for function entry/exit logging across various packages. This improves traceability and debugging of function executions while preserving existing behavior. Removed unused files `doc.go` and `nothing.go` to clean up the repository.
34 lines
757 B
Go
34 lines
757 B
Go
package bunker
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"realy.lol/chk"
|
|
"realy.lol/dns"
|
|
"realy.lol/errorf"
|
|
"realy.lol/lol"
|
|
)
|
|
|
|
func queryWellKnownNostrJson(ctx context.Context, fullname string) (pubkey string,
|
|
relays []string, err error) {
|
|
lol.Tracer("queryWellKnownNostrJson", fullname)
|
|
defer func() { lol.Tracer("end queryWellKnownNostrJson", pubkey, relays, err) }()
|
|
var result *dns.WellKnownResponse
|
|
var name string
|
|
if result, name, err = dns.Fetch(ctx, fullname); chk.E(err) {
|
|
return
|
|
}
|
|
|
|
var ok bool
|
|
if pubkey, ok = result.Names[name]; !ok {
|
|
return "", nil, fmt.Errorf("no entry found for the '%s' name", name)
|
|
}
|
|
if relays, ok = result.NIP46[pubkey]; !ok {
|
|
err = errorf.E("no bunker relays found for the '%s' name", name)
|
|
return
|
|
}
|
|
|
|
return
|
|
}
|