-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: correct list of addresses for delegated routing (#9920)
- Loading branch information
Showing
4 changed files
with
67 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package libp2p | ||
|
||
import ( | ||
"testing" | ||
|
||
config "github.com/ipfs/kubo/config" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestHttpAddrsFromConfig(t *testing.T) { | ||
require.Equal(t, []string{"/ip4/0.0.0.0/tcp/4001", "/ip4/0.0.0.0/udp/4001/quic"}, | ||
httpAddrsFromConfig(config.Addresses{ | ||
Swarm: []string{"/ip4/0.0.0.0/tcp/4001", "/ip4/0.0.0.0/udp/4001/quic"}, | ||
}), "Swarm addrs should be taken by default") | ||
|
||
require.Equal(t, []string{"/ip4/192.168.0.1/tcp/4001"}, | ||
httpAddrsFromConfig(config.Addresses{ | ||
Swarm: []string{"/ip4/0.0.0.0/tcp/4001", "/ip4/0.0.0.0/udp/4001/quic"}, | ||
Announce: []string{"/ip4/192.168.0.1/tcp/4001"}, | ||
}), "Announce addrs should override Swarm if specified") | ||
|
||
require.Equal(t, []string{"/ip4/0.0.0.0/udp/4001/quic"}, | ||
httpAddrsFromConfig(config.Addresses{ | ||
Swarm: []string{"/ip4/0.0.0.0/tcp/4001", "/ip4/0.0.0.0/udp/4001/quic"}, | ||
NoAnnounce: []string{"/ip4/0.0.0.0/tcp/4001"}, | ||
}), "Swarm addrs should not contain NoAnnounce addrs") | ||
|
||
require.Equal(t, []string{"/ip4/192.168.0.1/tcp/4001", "/ip4/192.168.0.2/tcp/4001"}, | ||
httpAddrsFromConfig(config.Addresses{ | ||
Swarm: []string{"/ip4/0.0.0.0/tcp/4001", "/ip4/0.0.0.0/udp/4001/quic"}, | ||
Announce: []string{"/ip4/192.168.0.1/tcp/4001"}, | ||
AppendAnnounce: []string{"/ip4/192.168.0.2/tcp/4001"}, | ||
}), "AppendAnnounce addrs should be included if specified") | ||
} |