Skip to content

Commit

Permalink
addressservice: extract out addressing logic from basichost
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sukunrt committed Dec 1, 2024
1 parent 2b114a2 commit d54166d
Show file tree
Hide file tree
Showing 5 changed files with 613 additions and 489 deletions.
7 changes: 6 additions & 1 deletion fx_options_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package libp2p

import (
"fmt"
"testing"

"github.com/libp2p/go-libp2p/core/event"
Expand All @@ -16,8 +17,12 @@ func TestGetPeerID(t *testing.T) {
host, err := New(
WithFxOption(fx.Populate(&id)),
)
fmt.Println(host)
require.NoError(t, err)
defer host.Close()
defer func() {
fmt.Println("closing")
host.Close()
}()

require.Equal(t, host.ID(), id)

Expand Down
1 change: 1 addition & 0 deletions libp2p_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ func TestHostAddrsFactoryAddsCerthashes(t *testing.T) {
require.NoError(t, err)
require.Eventually(t, func() bool {
addrs := h.Addrs()
fmt.Println(addrs)
for _, a := range addrs {
first, last := ma.SplitFunc(a, func(c ma.Component) bool {
return c.Protocol().Code == ma.P_CERTHASH
Expand Down
Loading

0 comments on commit d54166d

Please sign in to comment.