Skip to content

Commit

Permalink
Merge pull request #135 from mfreeman451/updates/support_multi_networ…
Browse files Browse the repository at this point in the history
…k_scanner

Updates/support multi network scanner
  • Loading branch information
mfreeman451 authored Jan 29, 2025
2 parents 85689a6 + 95f83bd commit 5d1c75c
Show file tree
Hide file tree
Showing 15 changed files with 424 additions and 174 deletions.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,45 +31,45 @@ ServiceRadar can be installed via direct downloads from GitHub releases.
Install these components on your monitored host:
```bash
# Download and install core components
curl -LO https://github.com/mfreeman451/serviceradar/releases/download/1.0.3/serviceradar-agent_1.0.9.deb \
-O https://github.com/mfreeman451/serviceradar/releases/download/1.0.3/serviceradar-poller_1.0.9.deb
curl -LO https://github.com/mfreeman451/serviceradar/releases/download/1.0.3/serviceradar-agent_1.0.10.deb \
-O https://github.com/mfreeman451/serviceradar/releases/download/1.0.3/serviceradar-poller_1.0.10.deb

sudo dpkg -i serviceradar-agent_1.0.9.deb serviceradar-poller_1.0.9.deb
sudo dpkg -i serviceradar-agent_1.0.10.deb serviceradar-poller_1.0.10.deb
```

On a separate machine (recommended) or the same host:
```bash
# Download and install cloud service
curl -LO https://github.com/mfreeman451/serviceradar/releases/download/1.0.3/serviceradar-cloud_1.0.9.deb
sudo dpkg -i serviceradar-cloud_1.0.9.deb
curl -LO https://github.com/mfreeman451/serviceradar/releases/download/1.0.3/serviceradar-cloud_1.0.10.deb
sudo dpkg -i serviceradar-cloud_1.0.10.deb
```

#### Optional: Dusk Node Monitoring
If you're running a [Dusk](https://dusk.network/) node and want specialized monitoring:
```bash
curl -LO https://github.com/mfreeman451/serviceradar/releases/download/1.0.9/serviceradar-dusk-checker_1.0.9.deb
sudo dpkg -i serviceradar-dusk-checker_1.0.9.deb
curl -LO https://github.com/mfreeman451/serviceradar/releases/download/1.0.10/serviceradar-dusk-checker_1.0.10.deb
sudo dpkg -i serviceradar-dusk-checker_1.0.10.deb
```

#### Distributed Setup
For larger deployments where components run on different hosts:

1. On monitored hosts:
```bash
curl -LO https://github.com/mfreeman451/serviceradar/releases/download/1.0.9/serviceradar-agent_1.0.9.deb
sudo dpkg -i serviceradar-agent_1.0.9.deb
curl -LO https://github.com/mfreeman451/serviceradar/releases/download/1.0.10/serviceradar-agent_1.0.10.deb
sudo dpkg -i serviceradar-agent_1.0.10.deb
```

2. On monitoring host:
```bash
curl -LO https://github.com/mfreeman451/serviceradar/releases/download/1.0.3/serviceradar-poller_1.0.9.deb
sudo dpkg -i serviceradar-poller_1.0.9.deb
curl -LO https://github.com/mfreeman451/serviceradar/releases/download/1.0.3/serviceradar-poller_1.0.10.deb
sudo dpkg -i serviceradar-poller_1.0.10.deb
```

3. On cloud host:
```bash
curl -LO https://github.com/mfreeman451/serviceradar/releases/download/1.0.3/serviceradar-cloud_1.0.9.deb
sudo dpkg -i serviceradar-cloud_1.0.9.deb
curl -LO https://github.com/mfreeman451/serviceradar/releases/download/1.0.3/serviceradar-cloud_1.0.10.deb
sudo dpkg -i serviceradar-cloud_1.0.10.deb
```

## Architecture
Expand Down Expand Up @@ -171,19 +171,19 @@ cd serviceradar

1. **Agent Installation** (on monitored hosts):
```bash
sudo dpkg -i serviceradar-dusk-checker_1.0.9.deb # For Dusk nodes
sudo dpkg -i serviceradar-dusk-checker_1.0.10.deb # For Dusk nodes
# or
sudo dpkg -i serviceradar-agent_1.0.9.deb # For other hosts
sudo dpkg -i serviceradar-agent_1.0.10.deb # For other hosts
```

2. **Poller Installation** (on any host in your network):
```bash
sudo dpkg -i serviceradar-poller_1.0.9.deb
sudo dpkg -i serviceradar-poller_1.0.10.deb
```

3. **Cloud Installation** (on a reliable host):
```bash
sudo dpkg -i serviceradar-cloud_1.0.9.deb
sudo dpkg -i serviceradar-cloud_1.0.10.deb
```

## Configuration
Expand Down
2 changes: 1 addition & 1 deletion buildAll.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

VERSION=${VERSION:-1.0.9}
VERSION=${VERSION:-1.0.10}


./setup-deb-poller.sh
Expand Down
2 changes: 2 additions & 0 deletions buildCloud.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash
set -e

export VERSION=${VERSION}

# Build the builder image
docker build -t serviceradar-builder -f Dockerfile.build .

Expand Down
39 changes: 39 additions & 0 deletions pkg/agent/ipv4_sorter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package agent

import (
"net"
)

// IPSorter is a type for sorting IP addresses.
type IPSorter []string

func (s IPSorter) Len() int { return len(s) }

func (s IPSorter) Swap(i, j int) { s[i], s[j] = s[j], s[i] }

func (s IPSorter) Less(i, j int) bool {
ip1 := net.ParseIP(s[i])
ip2 := net.ParseIP(s[j])

// Handle nil cases (invalid IPs) by falling back to string comparison
if ip1 == nil || ip2 == nil {
return s[i] < s[j]
}

// Convert to 4-byte representation for IPv4
ip1 = ip1.To4()
ip2 = ip2.To4()

if ip1 == nil || ip2 == nil {
return s[i] < s[j]
}

// Compare each byte
for i := 0; i < 4; i++ {
if ip1[i] != ip2[i] {
return ip1[i] < ip2[i]
}
}

return false
}
Loading

0 comments on commit 5d1c75c

Please sign in to comment.