This document describes the architectural transition and the current technical stack of CatNet Scanner, evolving from a legacy C implementation to a modern Go/Web stack.
CatNet Scanner uses Wails, which bridges a native Go backend with a modern web frontend. This architecture delivers the performance of a systems language (Go) combined with the UI flexibility of Web technologies (React).
graph LR
A[React/Vite UI] <-->|IPC / Wails Runtime| B[Go Backend]
B --> C[ICMP / Syscalls / Net API]
C --> D[Network Infrastructure]
func Ping(ip string, timeoutMs int) bool- Sends a native ICMP ping. On Windows, it delegates to the OS
pingexecutable with hidden windows to bypass the Raw Socket administrative constraint.
- Sends a native ICMP ping. On Windows, it delegates to the OS
func ReverseDNS(ip string) string- Resolves a hostname from an IP address.
func GetMAC(ip string) string- Fetches the MAC address of an IP in the local subnet. Uses native Windows
iphlpapi.dllandSendARPvia Syscalls for high performance.
- Fetches the MAC address of an IP in the local subnet. Uses native Windows
func ScanPorts(ip string, ports []int, timeoutMs int) []int- Concurrently probes specified TCP ports using
net.DialTimeout.
- Concurrently probes specified TCP ports using
type DeviceInfo- Fields: IP, IsAlive, Hostname, MAC, OpenPortsCount, OpenPorts.
func StartScan(...)- Orchestrates a parallel scan using Go channels and WaitGroups (
MaxThreadsgoroutines). It emits progress and results back to the frontend synchronously via callbacks.
- Orchestrates a parallel scan using Go channels and WaitGroups (
func StopScan()- Cancels the context for the ongoing parallel scan.
func ParseRange(input string) ([]string, error)- Parses CIDR notations (
192.168.1.0/24) and dash-separated ranges (192.168.1.1-254). Generates a flat slice of target IPs.
- Parses CIDR notations (
The backend does not expose a standard REST API. Instead, Wails generates direct JavaScript bindings for Go methods inside the App struct (e.g., StartScan, StopScan, ParseRange, ExportCSV).
- Event-driven updates (
runtime.EventsEmit) push realtime scan events directly to the React state. - The frontend consumes events like
scan_started,scan_progress, andscan_resultto update the Data Table and Progress Bar synchronously. - The
ExportCSVfunction triggers the nativeSaveFileDialogand writes the results locally without requiring browser hacks.
O diretório legacy_c/ contém a implementação original em C/Raylib do CatNet Scanner. Este código não é mais compilado pelo sistema de build atual e está mantido apenas para referência histórica. Consultar a branch legacy/c-raylib para histórico de commits.