Skip to content

Commit

Permalink
refactor: reuse /udp port for /webrtc-direct
Browse files Browse the repository at this point in the history
switches to version from
libp2p/go-libp2p#2889
  • Loading branch information
lidel committed Jul 30, 2024
1 parent 0e0f585 commit b3719e8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
4 changes: 2 additions & 2 deletions config/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ func addressesConfig() Addresses {
"/ip6/::/tcp/4001",
"/ip4/0.0.0.0/udp/4001/quic-v1",
"/ip4/0.0.0.0/udp/4001/quic-v1/webtransport",
"/ip4/0.0.0.0/udp/4002/webrtc-direct",
"/ip4/0.0.0.0/udp/4001/webrtc-direct",
"/ip6/::/udp/4001/quic-v1",
"/ip6/::/udp/4001/quic-v1/webtransport",
"/ip6/::/udp/4002/webrtc-direct",
"/ip6/::/udp/4001/webrtc-direct",
},
Announce: []string{},
AppendAnnounce: []string{},
Expand Down
2 changes: 1 addition & 1 deletion docs/changelogs/v0.30.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#### WebRTC-Direct Transport enabled by default

Kubo now ships with `/udp/4002/webrtc-direct` listener enabled by default.
Kubo now ships with `/udp/4001/webrtc-direct` listener enabled by default.

WebRTC Direct complements existing `/wss` (Secure WebSockets) and `/webtransport` transports. Unlike `/wss`, which requires a domain name and a CA-issued TLS certificate, WebRTC Direct works with IPs and can be enabled by default on all Kubo nodes.

Expand Down
7 changes: 2 additions & 5 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -2257,13 +2257,10 @@ certificates. This can be useful for browser nodes that do not yet support
[WebTransport](https://blog.libp2p.io/2022-12-19-libp2p-webtransport/),
which is still relatively new and has [known issues](https://github.com/libp2p/js-libp2p/issues/2572).

Enabling this transport allows Kubo node to act on `/udp/4002/webrtc-direct`
Enabling this transport allows Kubo node to act on `/udp/4001/webrtc-direct`
listeners defined in `Addresses.Swarm`, `Addresses.Announce` or
`Addresses.AppendAnnounce`.

> [!IMPORTANT]
> At the moment, WebRTC Direct doesn't support listening on the same port as a QUIC or WebTransport listener, and Kubo uses 4002 for it.
> [!NOTE]
> WebRTC Direct is browser-to-node. It cannot be used to connect a browser
> node to a node that is behind a NAT or firewall.
Expand All @@ -2277,7 +2274,7 @@ Default: Enabled
Type: `flag`

Listen Addresses:
- `/ip4/0.0.0.0/udp/4002/webrtc-direct` (default)
- `/ip4/0.0.0.0/udp/4001/webrtc-direct` (default)
- `/ip6/::/udp/4001/webrtc-direct` (default)

### `Swarm.Transports.Security`
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ require (
github.com/jbenet/goprocess v0.1.4
github.com/julienschmidt/httprouter v1.3.0
github.com/libp2p/go-doh-resolver v0.4.0
github.com/libp2p/go-libp2p v0.35.1-0.20240726083353-205f7be11544
github.com/libp2p/go-libp2p v0.35.1-0.20240730044139-27a709ccf94e
github.com/libp2p/go-libp2p-http v0.5.0
github.com/libp2p/go-libp2p-kad-dht v0.25.2
github.com/libp2p/go-libp2p-kbucket v0.6.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,8 @@ github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZ
github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs=
github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM=
github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro=
github.com/libp2p/go-libp2p v0.35.1-0.20240726083353-205f7be11544 h1:2ivyU6vXAsqOZ0+V54CibsXoxXJ43F8G4r+FfWEHx5Q=
github.com/libp2p/go-libp2p v0.35.1-0.20240726083353-205f7be11544/go.mod h1:M/fCHPPkWjectocXCOUua4Z2lSr2cjQNByVVuxWPwXI=
github.com/libp2p/go-libp2p v0.35.1-0.20240730044139-27a709ccf94e h1:LfhrFW3xMwH+37zbhLV9PIzX43mhXn/7sO/ZjkrrLR0=
github.com/libp2p/go-libp2p v0.35.1-0.20240730044139-27a709ccf94e/go.mod h1:M/fCHPPkWjectocXCOUua4Z2lSr2cjQNByVVuxWPwXI=
github.com/libp2p/go-libp2p-asn-util v0.4.1 h1:xqL7++IKD9TBFMgnLPZR6/6iYhawHKHl950SO9L6n94=
github.com/libp2p/go-libp2p-asn-util v0.4.1/go.mod h1:d/NI6XZ9qxw67b4e+NgpQexCIiFYJjErASrYW4PFDN8=
github.com/libp2p/go-libp2p-core v0.2.4/go.mod h1:STh4fdfa5vDYr0/SzYYeqnt+E6KfEV5VxfIrm0bcI0g=
Expand Down

0 comments on commit b3719e8

Please sign in to comment.