-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
swarm_test: support more transports for GenSwarm #3130
base: master
Are you sure you want to change the base?
Conversation
214f779
to
cc8e5fa
Compare
This adds support for `/webtransport` andn `/webrtc-direct` to GenSwarm. Ideally, we should rewrite this to have the same semantics, opt into transports not opt out, as `libp2p.New`. But I need webtransport and webrtc support to write address inference tests for #3075 Depending on how disruptive this is to users, we can decide on whether to merge or drop this.
cc8e5fa
to
29f2fa4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one question, but otherwise looks good.
@@ -191,6 +209,75 @@ func GenSwarm(t testing.TB, opts ...Option) *swarm.Swarm { | |||
if err := s.Listen(ma.StringCast("/ip4/127.0.0.1/udp/0/quic-v1")); err != nil { | |||
t.Fatal(err) | |||
} | |||
for _, a := range s.ListenAddresses() { | |||
if _, err := a.ValueForProtocol(ma.P_QUIC_V1); err == nil { | |||
quicListenAddr = a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not obvious to me why you want to share this address with all the other transports. Can you explain? Also what happens if ListenAddresses
contains a different address for WebTransport?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. We should replicate how the basic host works which just listens on port 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intention was to be maximially similar to how people use this in production. That can be handled separately.
This adds support for
/webtransport
and/webrtc-direct
to GenSwarm.Ideally, we should rewrite this to have the same semantics, opt into transports not opt out, as
libp2p.New
. But I need webtransport and webrtc support to write address inference tests for #3075Depending on how disruptive this is to users, we can decide on whether to merge or drop this.