mirror of
https://github.com/MengMengCode/CLICD.git
synced 2026-08-05 05:36:07 +08:00
22 lines
685 B
Go
22 lines
685 B
Go
package api
|
|
|
|
import "net/http"
|
|
|
|
func HandleIPv6Status(w http.ResponseWriter, r *http.Request) {
|
|
if r.Method != http.MethodGet {
|
|
jsonResponse(w, http.StatusMethodNotAllowed, APIResponse{Success: false, Message: "Method not allowed"})
|
|
return
|
|
}
|
|
status := lxcManager.DetectIPv6Status()
|
|
jsonResponse(w, http.StatusOK, APIResponse{Success: true, Data: status})
|
|
}
|
|
|
|
func assignIPv6(w http.ResponseWriter, r *http.Request, id int) {
|
|
c, err := assignIPv6ByRuntime(id)
|
|
if err != nil {
|
|
jsonResponse(w, http.StatusBadRequest, APIResponse{Success: false, Message: err.Error()})
|
|
return
|
|
}
|
|
jsonResponse(w, http.StatusOK, APIResponse{Success: true, Message: "IPv6 assigned", Data: c})
|
|
}
|