Skip to content

Commit

Permalink
chore: apply feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Oct 12, 2023
1 parent ec371e0 commit e2d27f1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
19 changes: 11 additions & 8 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"io"
"log"
"os"
"time"

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

default:
// You may not want to fail here, it's up to you. You can just handle
// the schemas you want, or that you know, but not fail.
log.Printf("unrecognized schema: %s", res.Val.GetSchema())
// This is an unknown schema. Let's just print it raw.
err := json.NewEncoder(w).Encode(res.Val)
if err != nil {
return err
}
}

fmt.Fprintln(w)
} else {
err := json.NewEncoder(os.Stdout).Encode(res.Val)
err := json.NewEncoder(w).Encode(res.Val)
if err != nil {
return err
}
Expand Down Expand Up @@ -125,12 +128,12 @@ func getIPNS(ctx context.Context, name ipns.Name, endpoint string, prettyOutput
// do not need to verify it again. However, if you were not using this specific
// client, but using some other tool, you should always validate the IPNS Record
// using the [ipns.Validate] or [ipns.ValidateWithName] functions.
fmt.Println("\tSignature: VALID")
fmt.Println("\tSignature Validated")
fmt.Println("\tValue:", v.String())
fmt.Println("\tSequence:", seq)
fmt.Println("\tValidityType : EOL/End-of-Life")
fmt.Println("\tValidity:", eol.Format(time.RFC3339))
ttl, err := rec.TTL()
if err == nil {
if ttl, err := rec.TTL(); err == nil {
fmt.Println("\tTTL:", ttl.String())
}

Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func main() {
Value: true,
},
&cli.StringSliceFlag{
Name: "content-endpoints",
Name: "provider-endpoints",
Usage: "other Delegated Routing V1 endpoints to proxy provider requests to",
Value: cli.NewStringSlice(cidContactEndpoint),
},
Expand All @@ -49,7 +49,7 @@ func main() {
},
},
Action: func(ctx *cli.Context) error {
return start(ctx.Context, ctx.Int("port"), ctx.Bool("accelerated-dht"), ctx.StringSlice("content-endpoints"), ctx.StringSlice("peer-endpoints"), ctx.StringSlice("ipns-endpoints"))
return start(ctx.Context, ctx.Int("port"), ctx.Bool("accelerated-dht"), ctx.StringSlice("provider-endpoints"), ctx.StringSlice("peer-endpoints"), ctx.StringSlice("ipns-endpoints"))
},
},
{
Expand Down

0 comments on commit e2d27f1

Please sign in to comment.