mirror of
https://github.com/luscis/openlan.git
synced 2025-12-24 11:10:54 +08:00
fea: support add client for openvpn.
This commit is contained in:
@@ -16,7 +16,7 @@ func (h IPSec) Router(router *mux.Router) {
|
||||
router.HandleFunc("/api/network/ipsec/tunnel", h.Get).Methods("GET")
|
||||
router.HandleFunc("/api/network/ipsec/tunnel", h.Post).Methods("POST")
|
||||
router.HandleFunc("/api/network/ipsec/tunnel", h.Delete).Methods("DELETE")
|
||||
router.HandleFunc("/api/network/ipsec/tunnel/restart", h.Restart).Methods("PUT")
|
||||
router.HandleFunc("/api/network/ipsec/tunnel/restart", h.Start).Methods("PUT")
|
||||
}
|
||||
|
||||
func (h IPSec) Get(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -60,7 +60,7 @@ func (h IPSec) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
ResponseMsg(w, 0, "")
|
||||
}
|
||||
|
||||
func (h IPSec) Restart(w http.ResponseWriter, r *http.Request) {
|
||||
func (h IPSec) Start(w http.ResponseWriter, r *http.Request) {
|
||||
tun := &schema.IPSecTunnel{}
|
||||
if err := GetData(r, tun); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||
@@ -70,6 +70,6 @@ func (h IPSec) Restart(w http.ResponseWriter, r *http.Request) {
|
||||
http.Error(w, "network is nil", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
Call.secer.RestartTunnel(*tun)
|
||||
Call.secer.StartTunnel(*tun)
|
||||
ResponseMsg(w, 0, "")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user