Skip to content
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

autorelay support for circuitv2 relays #1198

Merged
merged 16 commits into from
Sep 25, 2021
Merged

Conversation

vyzo
Copy link
Contributor

@vyzo vyzo commented Sep 23, 2021

Changes:

  • Move the autorelay code to p2p/host/autorelay
  • Move the host wrapper to the autorelay package.
  • Add support for circuitv2 relays

Next steps: refactor the relay discovery logic to support the Flare strategy of an army of relays; this can happen in a subsequent pr, and we can even wait for deployment before we do it.
For now, user must configure relays statically.

p2p/host/autorelay/autorelay.go Outdated Show resolved Hide resolved
p2p/host/autorelay/autorelay.go Outdated Show resolved Hide resolved
p2p/host/autorelay/autorelay.go Outdated Show resolved Hide resolved
p2p/host/autorelay/autorelay.go Outdated Show resolved Hide resolved
p2p/host/autorelay/autorelay.go Outdated Show resolved Hide resolved
p2p/host/autorelay/autorelay.go Outdated Show resolved Hide resolved
p2p/host/autorelay/autorelay.go Outdated Show resolved Hide resolved
p2p/host/autorelay/autorelay.go Outdated Show resolved Hide resolved
@vyzo
Copy link
Contributor Author

vyzo commented Sep 24, 2021

@marten-seemann ready for another round of review.

Copy link
Contributor

@marten-seemann marten-seemann left a comment

Choose a reason for hiding this comment

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

Thanks for the quick turnaround. Here's some additional stuff I noticed.

p2p/host/autorelay/autorelay.go Show resolved Hide resolved
if now.Add(rsvpExpirationSlack).Before(rsvp.Expiration) {
continue
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I must have missed this in my earlier review, but do we need a check to garbage collect expired reservations?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so, we'll try to refresh them. Do you see any way to create garbage here?

Copy link
Contributor

Choose a reason for hiding this comment

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

You're right, we delete the reservation if refreshing fails.

p2p/host/autorelay/autorelay.go Outdated Show resolved Hide resolved
}

select {
case <-ready:
Copy link
Contributor

Choose a reason for hiding this comment

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

This will leave all but the first go routine blocked on their IdentifyWait, doesn't it? Maybe this would a good use case for https://pkg.go.dev/golang.org/x/sync/errgroup#WithContext?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, the channel is buffered for len(conns), so we should be fine.

Copy link
Contributor

@marten-seemann marten-seemann left a comment

Choose a reason for hiding this comment

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

LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants