feat(frpAct): add Windows/Systemd/Init.d service boot control. BUT WINDOWS STILL HAS BUGS AND LINUX HAS NOT BEEN TESTED.

This commit is contained in:
2026-03-24 23:23:34 +08:00
parent e335ce4da6
commit 802a726464
6 changed files with 994 additions and 92 deletions
+19 -22
View File
@@ -122,12 +122,11 @@ func CreateProxyHandler(w http.ResponseWriter, r *http.Request) {
}
SendSuccessResponse(w, "Proxy created successfully", map[string]interface{}{
"instanceName": instance.Name,
"instanceID": instance.ID,
"configPath": instance.ConfigPath,
"proxyName": proxyInfo.Name,
"instanceID": instance.ID,
"configPath": instance.ConfigPath,
"proxyName": proxyInfo.Name,
})
postLog.Info(fmt.Sprintf("[CreateProxyHandler] Proxy %s created successfully for instance %s", proxyInfo.Name, instance.Name))
postLog.Info(fmt.Sprintf("[CreateProxyHandler] Proxy %s created successfully for instance %d", proxyInfo.Name, instance.ID))
}
func addFrpcProxy(configContent string, info FrpcProxyInfo) (string, error) {
@@ -137,8 +136,8 @@ func addFrpcProxy(configContent string, info FrpcProxyInfo) (string, error) {
}
proxy := map[string]interface{}{
"name": info.Name,
"type": info.Type,
"name": info.Name,
"type": info.Type,
"localIP": info.LocalIP,
"localPort": info.LocalPort,
"remotePort": info.RemotePort,
@@ -243,12 +242,11 @@ func DeleteProxyHandler(w http.ResponseWriter, r *http.Request) {
}
SendSuccessResponse(w, "Proxy deleted successfully", map[string]interface{}{
"instanceName": instance.Name,
"instanceID": instance.ID,
"configPath": instance.ConfigPath,
"proxyName": proxyName,
"instanceID": instance.ID,
"configPath": instance.ConfigPath,
"proxyName": proxyName,
})
postLog.Info(fmt.Sprintf("[DeleteProxyHandler] Proxy %s deleted successfully from instance %s", proxyName, instance.Name))
postLog.Info(fmt.Sprintf("[DeleteProxyHandler] Proxy %s deleted successfully from instance %d", proxyName, instance.ID))
}
func removeFrpcProxy(configContent string, proxyName string) (string, error) {
@@ -335,20 +333,19 @@ func ListProxiesHandler(w http.ResponseWriter, r *http.Request) {
proxyList := make([]map[string]interface{}, len(config.Proxies))
for i, proxy := range config.Proxies {
proxyData := map[string]interface{}{
"name": proxy["name"],
"type": proxy["type"],
"localIP": proxy["localIP"],
"localPort": proxy["localPort"],
"remotePort": proxy["remotePort"],
"name": proxy["name"],
"type": proxy["type"],
"localIP": proxy["localIP"],
"localPort": proxy["localPort"],
"remotePort": proxy["remotePort"],
}
proxyList[i] = proxyData
}
SendSuccessResponse(w, "Proxies listed successfully", map[string]interface{}{
"instanceID": instance.ID,
"instanceName": instance.Name,
"proxyCount": len(proxyList),
"proxies": proxyList,
"instanceID": instance.ID,
"proxyCount": len(proxyList),
"proxies": proxyList,
})
postLog.Info(fmt.Sprintf("[ListProxiesHandler] Retrieved %d proxies for instance %s", len(proxyList), instance.Name))
postLog.Info(fmt.Sprintf("[ListProxiesHandler] Retrieved %d proxies for instance %d", len(proxyList), instance.ID))
}