-
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
quicreuse: make it possible to use an application-constructed quic.Transport #3122
Conversation
We shouldn't create the listener entry. This happens once the libp2p QUIC transport starts listening.
1f91bbf
to
8db5f55
Compare
p2p/transport/quicreuse/connmgr.go
Outdated
refCountedTr := &refcountedTransport{ | ||
QUICTransport: tr, | ||
packetConn: conn, | ||
isExternal: true, |
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.
Does the actual owner of this transport want to know when libp2p will be done with it? My guess is yes.
Any preference for how this looks? We could accept a callback or we could return a done channel. Either way, we'd signal done when we otherwise would have closed this transport (in the case of a non "external" transport). This allows the actual owner to know when it is safe to free the transport.
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.
I'm not sure there's a lot of value in that. The only reason why libp2p would be done with this transport is when the host is closed, which is something that the owner of the transport initiated himself (by calling Host.Close
). Or am I missing something?
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.
That's fair, but I think it would be a bit simpler if this package doesn't have to consider a Host
for managing the lifecycle of this resource. Users could still simply ignore this signal and free after they've closed the host.
Without this, you may be closing the transport before the connmgr is actually done with it.
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.
done in d8cc67d. Has the nice side-effect of removing the conditional branches around isExternal
.
404c3a5
to
cee8044
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.
Excited to see this used. Please report back
It would be nice if the application was able to construct its own
quic.Transport
, and have that transport used by libp2p.This would allow an application:
tls.Config
on theListen
call, andAccept
(a subset of) QUIC connections returned by the listenerThis would make it possible to run a vanilla HTTP/3 server behind a NAT / firewall and use libp2p's NAT hole punching mechanism to create the NAT bindings.