mirror of
https://github.com/DeBrosOfficial/network.git
synced 2025-12-15 01:28:50 +00:00
fixes
This commit is contained in:
parent
0388c3a766
commit
f991d55676
@ -136,6 +136,10 @@ func (pc *PortChecker) CheckAll() ([]int, error) {
|
|||||||
|
|
||||||
// isPortAvailable checks if a TCP port is available for binding
|
// isPortAvailable checks if a TCP port is available for binding
|
||||||
func isPortAvailable(port int) bool {
|
func isPortAvailable(port int) bool {
|
||||||
|
// Port 0 is reserved and means "assign any available port"
|
||||||
|
if port == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
ln, err := net.Listen("tcp", fmt.Sprintf("127.0.0.1:%d", port))
|
ln, err := net.Listen("tcp", fmt.Sprintf("127.0.0.1:%d", port))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
|
|||||||
@ -17,7 +17,7 @@ func TestPortChecker(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check that required port counts match expectations
|
// Check that required port counts match expectations
|
||||||
expectedPortCount := 18 // Based on RequiredPorts
|
expectedPortCount := 22 // Based on RequiredPorts
|
||||||
if len(checker.ports) != expectedPortCount {
|
if len(checker.ports) != expectedPortCount {
|
||||||
t.Errorf("Expected %d ports, got %d", expectedPortCount, len(checker.ports))
|
t.Errorf("Expected %d ports, got %d", expectedPortCount, len(checker.ports))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ func TestRenderBootstrapConfig(t *testing.T) {
|
|||||||
RQLiteHTTPPort: 5001,
|
RQLiteHTTPPort: 5001,
|
||||||
RQLiteRaftPort: 7001,
|
RQLiteRaftPort: 7001,
|
||||||
ClusterAPIPort: 9094,
|
ClusterAPIPort: 9094,
|
||||||
IPFSAPIPORT: 5001,
|
IPFSAPIPort: 5001,
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := RenderBootstrapConfig(data)
|
result, err := RenderBootstrapConfig(data)
|
||||||
@ -50,7 +50,7 @@ func TestRenderNodeConfig(t *testing.T) {
|
|||||||
RQLiteJoinAddress: "localhost:5001",
|
RQLiteJoinAddress: "localhost:5001",
|
||||||
BootstrapPeers: []string{bootstrapMultiaddr},
|
BootstrapPeers: []string{bootstrapMultiaddr},
|
||||||
ClusterAPIPort: 9104,
|
ClusterAPIPort: 9104,
|
||||||
IPFSAPIPORT: 5002,
|
IPFSAPIPort: 5002,
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := RenderNodeConfig(data)
|
result, err := RenderNodeConfig(data)
|
||||||
@ -84,7 +84,7 @@ func TestRenderGatewayConfig(t *testing.T) {
|
|||||||
BootstrapPeers: []string{bootstrapMultiaddr},
|
BootstrapPeers: []string{bootstrapMultiaddr},
|
||||||
OlricServers: []string{"127.0.0.1:3320"},
|
OlricServers: []string{"127.0.0.1:3320"},
|
||||||
ClusterAPIPort: 9094,
|
ClusterAPIPort: 9094,
|
||||||
IPFSAPIPORT: 5001,
|
IPFSAPIPort: 5001,
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := RenderGatewayConfig(data)
|
result, err := RenderGatewayConfig(data)
|
||||||
@ -150,7 +150,7 @@ func TestRenderWithMultipleBootstrapPeers(t *testing.T) {
|
|||||||
RQLiteJoinAddress: "localhost:5001",
|
RQLiteJoinAddress: "localhost:5001",
|
||||||
BootstrapPeers: peers,
|
BootstrapPeers: peers,
|
||||||
ClusterAPIPort: 9104,
|
ClusterAPIPort: 9104,
|
||||||
IPFSAPIPORT: 5002,
|
IPFSAPIPort: 5002,
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := RenderNodeConfig(data)
|
result, err := RenderNodeConfig(data)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user