mirror of
https://github.com/DeBrosOfficial/network.git
synced 2025-12-12 22:38:50 +00:00
feat: enhance IPFS and Cluster integration in setup
- Added automatic setup for IPFS and IPFS Cluster during the network setup process. - Implemented initialization of IPFS repositories and Cluster configurations for each node. - Enhanced Makefile to support starting IPFS and Cluster daemons with improved logging. - Introduced a new documentation guide for IPFS Cluster setup, detailing configuration and verification steps. - Updated changelog to reflect the new features and improvements.
This commit is contained in:
parent
d00290d278
commit
fbdfa23c77
@ -286,7 +286,7 @@ func initFullStack(force bool) {
|
||||
fmt.Printf("✅ Generated bootstrap identity: %s (Peer ID: %s)\n", bootstrapIdentityPath, bootstrapInfo.PeerID.String())
|
||||
|
||||
// Construct bootstrap multiaddr
|
||||
bootstrapMultiaddr := fmt.Sprintf("/ip4/localhost/tcp/4001/p2p/%s", bootstrapInfo.PeerID.String())
|
||||
bootstrapMultiaddr := fmt.Sprintf("/ip4/127.0.0.1/tcp/4001/p2p/%s", bootstrapInfo.PeerID.String())
|
||||
fmt.Printf(" Bootstrap multiaddr: %s\n", bootstrapMultiaddr)
|
||||
|
||||
// Generate configs for all nodes...
|
||||
|
||||
@ -11,7 +11,7 @@ func TestDefaultBootstrapPeersNonEmpty(t *testing.T) {
|
||||
old := os.Getenv("DEBROS_BOOTSTRAP_PEERS")
|
||||
t.Cleanup(func() { os.Setenv("DEBROS_BOOTSTRAP_PEERS", old) })
|
||||
// Set a valid bootstrap peer
|
||||
validPeer := "/ip4/localhost/tcp/4001/p2p/12D3KooWHbcFcrGPXKUrHcxvd8MXEeUzRYyvY8fQcpEBxncSUwhj"
|
||||
validPeer := "/ip4/127.0.0.1/tcp/4001/p2p/12D3KooWHbcFcrGPXKUrHcxvd8MXEeUzRYyvY8fQcpEBxncSUwhj"
|
||||
_ = os.Setenv("DEBROS_BOOTSTRAP_PEERS", validPeer)
|
||||
peers := DefaultBootstrapPeers()
|
||||
if len(peers) == 0 {
|
||||
@ -50,8 +50,11 @@ func TestNormalizeEndpoints(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEndpointFromMultiaddr(t *testing.T) {
|
||||
ma, _ := multiaddr.NewMultiaddr("/ip4/localhost/tcp/4001")
|
||||
if ep := endpointFromMultiaddr(ma, 5001); ep != "http://localhost:5001" {
|
||||
ma, err := multiaddr.NewMultiaddr("/ip4/127.0.0.1/tcp/4001")
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create multiaddr: %v", err)
|
||||
}
|
||||
if ep := endpointFromMultiaddr(ma, 5001); ep != "http://127.0.0.1:5001" {
|
||||
t.Fatalf("unexpected endpoint: %s", ep)
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ import (
|
||||
|
||||
// validConfigForType returns a valid config for the given node type
|
||||
func validConfigForType(nodeType string) *Config {
|
||||
validPeer := "/ip4/localhost/tcp/4001/p2p/12D3KooWHbcFcrGPXKUrHcxvd8MXEeUzRYyvY8fQcpEBxncSUwhj"
|
||||
validPeer := "/ip4/127.0.0.1/tcp/4001/p2p/12D3KooWHbcFcrGPXKUrHcxvd8MXEeUzRYyvY8fQcpEBxncSUwhj"
|
||||
cfg := &Config{
|
||||
Node: NodeConfig{
|
||||
Type: nodeType,
|
||||
@ -205,7 +205,7 @@ func TestValidateRQLiteJoinAddress(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestValidateBootstrapPeers(t *testing.T) {
|
||||
validPeer := "/ip4/localhost/tcp/4001/p2p/12D3KooWHbcFcrGPXKUrHcxvd8MXEeUzRYyvY8fQcpEBxncSUwhj"
|
||||
validPeer := "/ip4/127.0.0.1/tcp/4001/p2p/12D3KooWHbcFcrGPXKUrHcxvd8MXEeUzRYyvY8fQcpEBxncSUwhj"
|
||||
tests := []struct {
|
||||
name string
|
||||
nodeType string
|
||||
@ -217,9 +217,9 @@ func TestValidateBootstrapPeers(t *testing.T) {
|
||||
{"bootstrap with peer", "bootstrap", []string{validPeer}, false},
|
||||
{"bootstrap without peer", "bootstrap", []string{}, false},
|
||||
{"invalid multiaddr", "node", []string{"invalid"}, true},
|
||||
{"missing p2p", "node", []string{"/ip4/localhost/tcp/4001"}, true},
|
||||
{"missing p2p", "node", []string{"/ip4/127.0.0.1/tcp/4001"}, true},
|
||||
{"duplicate peer", "node", []string{validPeer, validPeer}, true},
|
||||
{"invalid port", "node", []string{"/ip4/localhost/tcp/99999/p2p/12D3KooWHbcFcrGPXKUrHcxvd8MXEeUzRYyvY8fQcpEBxncSUwhj"}, true},
|
||||
{"invalid port", "node", []string{"/ip4/127.0.0.1/tcp/99999/p2p/12D3KooWHbcFcrGPXKUrHcxvd8MXEeUzRYyvY8fQcpEBxncSUwhj"}, true},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
@ -397,7 +397,7 @@ func TestValidateCompleteConfig(t *testing.T) {
|
||||
},
|
||||
Discovery: DiscoveryConfig{
|
||||
BootstrapPeers: []string{
|
||||
"/ip4/localhost/tcp/4001/p2p/12D3KooWHbcFcrGPXKUrHcxvd8MXEeUzRYyvY8fQcpEBxncSUwhj",
|
||||
"/ip4/127.0.0.1/tcp/4001/p2p/12D3KooWHbcFcrGPXKUrHcxvd8MXEeUzRYyvY8fQcpEBxncSUwhj",
|
||||
},
|
||||
DiscoveryInterval: 15 * time.Second,
|
||||
BootstrapPort: 4001,
|
||||
|
||||
@ -234,7 +234,7 @@ func isPrivateOrLocalHost(host string) bool {
|
||||
}
|
||||
|
||||
// Check for localhost variants
|
||||
if host == "localhost" || host == "localhost" || host == "::1" {
|
||||
if host == "localhost" || host == "::1" {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@ -371,7 +371,7 @@ func discoverOlricServers(networkClient client.NetworkClient, logger *zap.Logger
|
||||
}
|
||||
|
||||
// Skip localhost loopback addresses (we'll use localhost:3320 as fallback)
|
||||
if ip == "localhost" || ip == "::1" || ip == "localhost" {
|
||||
if ip == "localhost" || ip == "::1" {
|
||||
continue
|
||||
}
|
||||
|
||||
@ -402,7 +402,7 @@ func discoverOlricServers(networkClient client.NetworkClient, logger *zap.Logger
|
||||
}
|
||||
|
||||
// Skip localhost
|
||||
if ip == "localhost" || ip == "::1" || ip == "localhost" {
|
||||
if ip == "localhost" || ip == "::1" {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@ -177,13 +177,13 @@ func TestHashBootstrapConnections(t *testing.T) {
|
||||
}
|
||||
|
||||
// Create two hosts (A and B) listening on localhost TCP
|
||||
hA, err := libp2p.New(libp2p.ListenAddrStrings("/ip4/localhost/tcp/0"))
|
||||
hA, err := libp2p.New(libp2p.ListenAddrStrings("/ip4/127.0.0.1/tcp/0"))
|
||||
if err != nil {
|
||||
t.Fatalf("libp2p.New (A): %v", err)
|
||||
}
|
||||
defer hA.Close()
|
||||
|
||||
hB, err := libp2p.New(libp2p.ListenAddrStrings("/ip4/localhost/tcp/0"))
|
||||
hB, err := libp2p.New(libp2p.ListenAddrStrings("/ip4/127.0.0.1/tcp/0"))
|
||||
if err != nil {
|
||||
t.Fatalf("libp2p.New (B): %v", err)
|
||||
}
|
||||
@ -244,19 +244,19 @@ func TestHashBootstrapConnections(t *testing.T) {
|
||||
}
|
||||
|
||||
// Create three hosts (A, B, C) listening on localhost TCP
|
||||
hA, err := libp2p.New(libp2p.ListenAddrStrings("/ip4/localhost/tcp/0"))
|
||||
hA, err := libp2p.New(libp2p.ListenAddrStrings("/ip4/127.0.0.1/tcp/0"))
|
||||
if err != nil {
|
||||
t.Fatalf("libp2p.New (A): %v", err)
|
||||
}
|
||||
defer hA.Close()
|
||||
|
||||
hB, err := libp2p.New(libp2p.ListenAddrStrings("/ip4/localhost/tcp/0"))
|
||||
hB, err := libp2p.New(libp2p.ListenAddrStrings("/ip4/127.0.0.1/tcp/0"))
|
||||
if err != nil {
|
||||
t.Fatalf("libp2p.New (B): %v", err)
|
||||
}
|
||||
defer hB.Close()
|
||||
|
||||
hC, err := libp2p.New(libp2p.ListenAddrStrings("/ip4/localhost/tcp/0"))
|
||||
hC, err := libp2p.New(libp2p.ListenAddrStrings("/ip4/127.0.0.1/tcp/0"))
|
||||
if err != nil {
|
||||
t.Fatalf("libp2p.New (C): %v", err)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user