|
1 | | -# can-finder |
2 | | -Find CAN devices in the network |
| 1 | +# CAN Finder Project Description |
| 2 | + |
| 3 | +[中文文档](./README_zhCN.md) |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +**CAN Finder** is a network device auto-discovery and management tool specifically designed for LinkerHand devices. The tool listens for UDP broadcasts from devices, displays their essential information in real-time, such as device name, IP address, MAC address, model, and version information, and pushes updates to the frontend via the WebSocket protocol. |
| 8 | + |
| 9 | +## Features |
| 10 | + |
| 11 | +* **Real-Time Device Discovery**: Listens to UDP broadcast data to discover CAN devices in real-time. |
| 12 | +* **Web Interface Display**: Provides an intuitive web interface to show detailed device information, including first discovery time and last active time. |
| 13 | +* **WebSocket Communication**: Uses WebSocket to update device status in real-time without manual refresh. |
| 14 | + |
| 15 | +## System Architecture |
| 16 | + |
| 17 | +CAN Finder consists of two main components: |
| 18 | + |
| 19 | +1. **Backend Service**: Written in Go, using the Gin web framework to provide HTTP services, WebSocket services, and UDP broadcast listening. |
| 20 | +2. **Frontend Display Page**: Built with native HTML and JavaScript, communicating with the backend in real-time through WebSockets. |
| 21 | + |
| 22 | +## Technology Stack |
| 23 | + |
| 24 | +* Go Language |
| 25 | +* Gin Framework |
| 26 | +* WebSocket (Gorilla) |
| 27 | +* HTML and JavaScript |
| 28 | +* UDP Broadcast Protocol |
| 29 | + |
| 30 | +## Usage |
| 31 | + |
| 32 | +### Installation and Execution |
| 33 | + |
| 34 | +```shell |
| 35 | +go build -o can-finder |
| 36 | +./can-finder --http-port 6200 --udp-port 9999 |
| 37 | +``` |
| 38 | + |
| 39 | +### Accessing the Web Interface |
| 40 | + |
| 41 | +After starting the service, access it through a browser at: |
| 42 | + |
| 43 | +``` |
| 44 | +http://localhost:6200 |
| 45 | +``` |
| 46 | + |
| 47 | +This will allow real-time monitoring of CAN device discovery. |
| 48 | + |
| 49 | +## Project Structure |
| 50 | + |
| 51 | +``` |
| 52 | +can-finder/ |
| 53 | +├── main.go # Backend core program, handling UDP broadcasts and HTTP/WebSocket requests |
| 54 | +└── public |
| 55 | + └── index.html # Frontend display page |
| 56 | +``` |
| 57 | + |
| 58 | +## Configuration Details |
| 59 | + |
| 60 | +* Default HTTP server listening port: `6200` (modifiable via command-line parameters) |
| 61 | +* Default UDP broadcast listening port: `9999` (modifiable via command-line parameters) |
| 62 | + |
| 63 | +## Example Webpage Display |
| 64 | + |
| 65 | +The frontend display page updates device information in real-time, including: |
| 66 | + |
| 67 | +* Device Name |
| 68 | +* IP Address |
| 69 | +* MAC Address |
| 70 | +* Device Model |
| 71 | +* Software Version (linked to GitHub Release page) |
| 72 | +* First Discovery Time |
| 73 | +* Last Active Time |
| 74 | + |
| 75 | +## Error Handling and Logging |
| 76 | + |
| 77 | +The backend service provides detailed logs to quickly diagnose device discovery and communication issues. |
| 78 | + |
| 79 | +## Dependencies |
| 80 | + |
| 81 | +* github.com/gin-gonic/gin |
| 82 | +* github.com/gorilla/websocket |
| 83 | +* github.com/soulteary/gin-static |
| 84 | + |
| 85 | +Use `go mod tidy` for automatic dependency management. |
| 86 | + |
| 87 | +## License |
| 88 | + |
| 89 | +This project uses the GPL-3.0 license. |
| 90 | + |
| 91 | +--- |
| 92 | + |
| 93 | +Contributions are welcome! Feel free to submit code, raise issues, or open pull requests to help us continuously optimize and enhance CAN Finder! |
0 commit comments