refactor(router): remove all useless route

Remove dynamic path handling in favor of explicit route registration
Update README.md with improved table formatting and updated TODO list
This commit is contained in:
2026-03-19 16:50:41 +08:00
parent 702ecb7de4
commit 67757be231
3 changed files with 12 additions and 50 deletions
+9 -7
View File
@@ -28,12 +28,12 @@ Create a `config.json` file in the project root:
}
```
| Field | Description | Default |
|-------|-------------|---------|
| listenAddr | Server listening address | 0.0.0.0 |
| listenPort | Server listening port | 8080 |
| frpcPath | Path to frpc executable | /usr/bin/frpc |
| instancePath | Path to store instance config files | ./configs |
| Field | Description | Default |
| ------------ | ----------------------------------- | ------------- |
| listenAddr | Server listening address | 0.0.0.0 |
| listenPort | Server listening port | 8080 |
| frpcPath | Path to frpc executable | /usr/bin/frpc |
| instancePath | Path to store instance config files | ./configs |
## Build
@@ -42,6 +42,7 @@ go build -o super-frpc.exe
```
For Linux:
```bash
GOOS=linux GOARCH=amd64 go build -o super-frpc
```
@@ -61,8 +62,9 @@ For detailed API documentation, please see [docs/api.md](docs/api.md)
- [x] Add Windows boot service support
- [x] Add session list API
- [x] Add session management API
- [ ] Add codes per file documentation
- [ ] Add user config modify API
- [ ] Add frpc instance running status management API
- [ ] Add frpc instance log display API
## License
BIN
View File
Binary file not shown.
+3 -43
View File
@@ -2,7 +2,7 @@ package main
import (
"net/http"
"strings"
"super-frpc/postLog"
)
@@ -26,47 +26,7 @@ func setupRoutes() {
http.HandleFunc("/sessionMgr/remove", RemoveSessionHandler)
http.HandleFunc("/frpcAct/instanceMgr/create", CreateInstanceHandler)
http.HandleFunc("/frpcAct/instanceMgr/delete", DeleteInstanceHandler)
http.HandleFunc("/frpcAct/instanceMgr/modify", ModifyInstanceHandler)
http.HandleFunc("/frpcAct/instanceMgr/list", ListInstancesHandler)
http.HandleFunc("/frpcAct/instanceMgr/", func(w http.ResponseWriter, r *http.Request) {
path := r.URL.Path
if len(path) < len("/frpcAct/instanceMgr/") { // Check if path is at least as long as the base path
SendErrorResponse(w, http.StatusNotFound, "invalid path")
return
}
remainingPath := path[len("/frpcAct/instanceMgr/"):] // Get the remaining path after the base path
if r.Method == http.MethodGet { // Handle `/list` and `/list/<instanceName>` by GET request
if remainingPath == "list" {
ListInstancesHandler(w, r)
return
}
instanceName := strings.Trim(remainingPath, "/") // Get the instance name from the remaining path
if instanceName != "" {
ListInstancesHandler(w, r)
return
}
}
if r.Method == http.MethodPost { // Handle `/create`, `/delete`, and `/modify/<field>` by POST request
if remainingPath == "create" {
CreateInstanceHandler(w, r)
return
}
if remainingPath == "delete" {
DeleteInstanceHandler(w, r)
return
}
if remainingPath == "modify" { // Handle `/modify` by POST request
ModifyInstanceHandler(w, r)
return
}
}
SendErrorResponse(w, http.StatusNotFound, "endpoint not found") // Send error response if no endpoint is found
})
}