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

addrsmanager: extract out addressing logic from basichost #3075

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

sukunrt
Copy link
Member

@sukunrt sukunrt commented Dec 1, 2024

The goal is to keep modifying it and removing the dependency on basichost by relying on events. At that point, we can expose this as a separate service usable by both basic and blank hosts

Part of #2229

NOTE: There's no fuzzing here. I am thinking of fuzzing the external facing components like observed address manager etc, as opposed to fuzzing something here. @MarcoPolo Do you think we should be defensive and parse return values form each of those components here and filter for nil etc?

@sukunrt sukunrt force-pushed the sukun/address-service-1 branch from d54166d to 3dbd24d Compare December 1, 2024 13:38
@sukunrt sukunrt force-pushed the sukun/address-service-1 branch 5 times, most recently from 5896f14 to a9e6585 Compare December 2, 2024 14:29
@sukunrt sukunrt force-pushed the sukun/autorelay-event branch from 2b114a2 to 762a43e Compare December 3, 2024 08:39
The goal is to keep modifying it and removing the dependency
on basichost by relying on events. At that point, we can
expose this as a separate service usable by both basic
and blank hosts
@sukunrt sukunrt force-pushed the sukun/address-service-1 branch from a9e6585 to e3367f1 Compare December 3, 2024 08:45
@sukunrt sukunrt force-pushed the sukun/address-service-1 branch 4 times, most recently from d77303e to e45fe9e Compare December 3, 2024 16:59
@sukunrt sukunrt requested a review from MarcoPolo December 3, 2024 17:03
sukunrt added a commit that referenced this pull request Dec 8, 2024
closes: #3057
rest of the work is in: #3075

Co-authored-by: wlynxg <[email protected]>
sukunrt added a commit that referenced this pull request Dec 8, 2024
closes: #3057
rest of the work is in: #3075

Co-authored-by: wlynxg <[email protected]>
@p-shahi p-shahi mentioned this pull request Dec 16, 2024
26 tasks
@p-shahi p-shahi mentioned this pull request Dec 26, 2024
20 tasks
@sukunrt sukunrt force-pushed the sukun/address-service-1 branch from e45fe9e to 5fcce02 Compare December 30, 2024 15:49
sukunrt added a commit that referenced this pull request Dec 30, 2024
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.
sukunrt added a commit that referenced this pull request Dec 30, 2024
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.
@sukunrt sukunrt force-pushed the sukun/autorelay-event branch 3 times, most recently from 58eceee to d27d90e Compare February 7, 2025 18:06
This was pretty expensive

before:
```
goos: linux
goarch: amd64
pkg: github.com/libp2p/go-libp2p
cpu: AMD Ryzen 7 7840U w/ Radeon  780M Graphics
BenchmarkAllAddrs-16               16737            122245 ns/op           21240 B/op        218 allocs/op
```
after:
```
goos: linux
goarch: amd64
pkg: github.com/libp2p/go-libp2p
cpu: AMD Ryzen 7 7840U w/ Radeon  780M Graphics
BenchmarkAllAddrs-16            11103236               105.7 ns/op           192 B/op          1 allocs/op
```
sukunrt added a commit that referenced this pull request Feb 19, 2025
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.
@sukunrt sukunrt force-pushed the sukun/address-service-1 branch from f5e3777 to a5c5d2a Compare February 20, 2025 11:47
@sukunrt sukunrt changed the base branch from sukun/autorelay-event to master February 20, 2025 11:49
@sukunrt sukunrt force-pushed the sukun/address-service-1 branch from c5d38c1 to 16a95f3 Compare February 20, 2025 12:15
@sukunrt sukunrt marked this pull request as draft February 20, 2025 12:20
@sukunrt sukunrt force-pushed the sukun/address-service-1 branch 3 times, most recently from 6af4cd8 to 88725a1 Compare February 20, 2025 14:14
@sukunrt sukunrt force-pushed the sukun/address-service-1 branch from 88725a1 to 9905a33 Compare February 22, 2025 14:38
@sukunrt sukunrt requested a review from MarcoPolo February 22, 2025 15:05
@sukunrt sukunrt marked this pull request as ready for review February 22, 2025 15:05
@sukunrt sukunrt force-pushed the sukun/address-service-1 branch from d06ff0c to f232cfe Compare February 22, 2025 15:23
@sukunrt sukunrt changed the title addressservice: extract out addressing logic from basichost addrsmanager: extract out addressing logic from basichost Feb 22, 2025
Copy link
Collaborator

@MarcoPolo MarcoPolo left a comment

Choose a reason for hiding this comment

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

A couple small things, but looks good

for _, addr := range resolved {
dst = append(dst, a.observedAddrsManager.ObservedAddrsFor(addr)...)
}
return dst
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we unique this? Do we expect duplicated from the unspecified and resolved addrs?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's done eventually in the main loop. Limited the observed addrs to 5 per listen address.

@MarcoPolo
Copy link
Collaborator

@MarcoPolo Do you think we should be defensive and parse return values form each of those components here and filter for nil etc?

Can you expand a bit on what you mean here please?

@sukunrt
Copy link
Member Author

sukunrt commented Feb 27, 2025

Can you expand a bit on what you mean here please?

I'm not filtering the return value from observed addrs manager and nat manager for nils.

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