Skip to content

Commit e2d27f1

Browse files
committed
chore: apply feedback
1 parent ec371e0 commit e2d27f1

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

client.go

+11-8
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"errors"
77
"fmt"
88
"io"
9-
"log"
109
"os"
1110
"time"
1211

@@ -77,12 +76,16 @@ func printIter(w io.Writer, prettyOutput bool, iter iter.ResultIter[types.Record
7776
fmt.Fprintln(w, "\tAddresses:", record.Addrs)
7877

7978
default:
80-
// You may not want to fail here, it's up to you. You can just handle
81-
// the schemas you want, or that you know, but not fail.
82-
log.Printf("unrecognized schema: %s", res.Val.GetSchema())
79+
// This is an unknown schema. Let's just print it raw.
80+
err := json.NewEncoder(w).Encode(res.Val)
81+
if err != nil {
82+
return err
83+
}
8384
}
85+
86+
fmt.Fprintln(w)
8487
} else {
85-
err := json.NewEncoder(os.Stdout).Encode(res.Val)
88+
err := json.NewEncoder(w).Encode(res.Val)
8689
if err != nil {
8790
return err
8891
}
@@ -125,12 +128,12 @@ func getIPNS(ctx context.Context, name ipns.Name, endpoint string, prettyOutput
125128
// do not need to verify it again. However, if you were not using this specific
126129
// client, but using some other tool, you should always validate the IPNS Record
127130
// using the [ipns.Validate] or [ipns.ValidateWithName] functions.
128-
fmt.Println("\tSignature: VALID")
131+
fmt.Println("\tSignature Validated")
129132
fmt.Println("\tValue:", v.String())
130133
fmt.Println("\tSequence:", seq)
134+
fmt.Println("\tValidityType : EOL/End-of-Life")
131135
fmt.Println("\tValidity:", eol.Format(time.RFC3339))
132-
ttl, err := rec.TTL()
133-
if err == nil {
136+
if ttl, err := rec.TTL(); err == nil {
134137
fmt.Println("\tTTL:", ttl.String())
135138
}
136139

main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func main() {
3333
Value: true,
3434
},
3535
&cli.StringSliceFlag{
36-
Name: "content-endpoints",
36+
Name: "provider-endpoints",
3737
Usage: "other Delegated Routing V1 endpoints to proxy provider requests to",
3838
Value: cli.NewStringSlice(cidContactEndpoint),
3939
},
@@ -49,7 +49,7 @@ func main() {
4949
},
5050
},
5151
Action: func(ctx *cli.Context) error {
52-
return start(ctx.Context, ctx.Int("port"), ctx.Bool("accelerated-dht"), ctx.StringSlice("content-endpoints"), ctx.StringSlice("peer-endpoints"), ctx.StringSlice("ipns-endpoints"))
52+
return start(ctx.Context, ctx.Int("port"), ctx.Bool("accelerated-dht"), ctx.StringSlice("provider-endpoints"), ctx.StringSlice("peer-endpoints"), ctx.StringSlice("ipns-endpoints"))
5353
},
5454
},
5555
{

0 commit comments

Comments
 (0)