unloadConn.go 425 B

123456789101112131415161718192021222324
  1. package goStrongswanVici
  2. import (
  3. "fmt"
  4. )
  5. type UnloadConnRequest struct {
  6. Name string `json:"name"`
  7. }
  8. func (c *ClientConn) UnloadConn(r *UnloadConnRequest) error {
  9. reqMap := &map[string]interface{}{}
  10. ConvertToGeneral(r, reqMap)
  11. msg, err := c.Request("unload-conn", *reqMap)
  12. if err != nil {
  13. return err
  14. }
  15. if msg["success"] != "yes" {
  16. return fmt.Errorf("[Unload-Connection] %s", msg["errmsg"])
  17. }
  18. return nil
  19. }