Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

describe how to use options in README #105

Merged
merged 1 commit into from
Dec 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ h, err := libp2p.New(
```

The example above will replace the default transports with a single TCP
transport. To add multiple tranports, use `ChainOptions`:
transport. To add multiple transports:

``` go
// TCP and QUIC:
Expand All @@ -79,6 +79,13 @@ h, err := libp2p.New(
)
```

To use TCP transport options, pass them to the `libp2p.Transport` constructor:
```go
h, err := libp2p.New(
libp2p.Transport(tcp.NewTCPTransport, tcp.DisableReuseport(), tcp.WithConnectionTimeout(20*time.Second))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seams like a good way to do this, but it's not currently supported. Are you planning on implementing it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of libp2p/go-libp2p#1205, it is implemented. It's just not released yet

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably should hold this PR back until we've cut the next go-libp2p release.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that's really cool!

)
```

## Addresses

The TCP transport supports [multiaddrs][multiaddr] that contain a `tcp`
Expand Down