k3s/vendor/github.com/bronze1man/goStrongswanVici/unloadConn.go

25 lines
425 B
Go
Raw Normal View History

2019-09-06 18:20:31 +00:00
package goStrongswanVici
import (
"fmt"
)
type UnloadConnRequest struct {
Name string `json:"name"`
}
func (c *ClientConn) UnloadConn(r *UnloadConnRequest) error {
reqMap := &map[string]interface{}{}
ConvertToGeneral(r, reqMap)
msg, err := c.Request("unload-conn", *reqMap)
if err != nil {
return err
}
if msg["success"] != "yes" {
return fmt.Errorf("[Unload-Connection] %s", msg["errmsg"])
}
return nil
}