Skip to content

Commit

Permalink
README: remove obsolete notice, fix example code for tracing.
Browse files Browse the repository at this point in the history
  • Loading branch information
vyzo committed Oct 18, 2021
1 parent 7ef0669 commit cee11bb
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ This repo contains the canonical pubsub implementation for libp2p. We currently
- Randomsub, which is a simple probabilistic router that propagates to random subsets of peers.
- Gossipsub, which is a more advanced router with mesh formation and gossip propagation. See [spec](https://github.com/libp2p/specs/tree/master/pubsub/gossipsub) and [implementation](https://github.com/libp2p/go-libp2p-pubsub/blob/master/gossipsub.go) for more details.

**PSA: The Hardening Extensions for Gossipsub (Gossipsub V1.1) can be found under development at https://github.com/libp2p/go-libp2p-pubsub/pull/263**

## Repo Lead Maintainer

Expand Down Expand Up @@ -106,12 +105,22 @@ If you want to trace using a remote peer, you can do so using the `traced` daemo

For instance, to capture the trace as a json file, you can use the following option:
```go
pubsub.NewGossipSub(..., pubsub.NewEventTracer(pubsub.NewJSONTracer("/path/to/trace.json")))
tracer, err := pubsub.NewJSONTracer("/path/to/trace.json")
if err != nil {
panic(err)
}

pubsub.NewGossipSub(..., pubsub.WithEventTracer(tracer))
```

To capture the trace as a protobuf, you can use the following option:
```go
pubsub.NewGossipSub(..., pubsub.NewEventTracer(pubsub.NewPBTracer("/path/to/trace.pb")))
tracer, err := pubsub.NewPBTracer("/path/to/trace.pb")
if err != nil {
panic(err)
}

pubsub.NewGossipSub(..., pubsub.WithEventTracer(tracer))
```

Finally, to use the remote tracer, you can use the following incantations:
Expand Down

0 comments on commit cee11bb

Please sign in to comment.