2019-09-06 18:20:31 +00:00
|
|
|
package goStrongswanVici
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
type TerminateRequest struct {
|
|
|
|
Child string `json:"child,omitempty"`
|
|
|
|
Ike string `json:"ike,omitempty"`
|
|
|
|
Child_id string `json:"child-id,omitempty"`
|
|
|
|
Ike_id string `json:"ike-id,omitempty"`
|
2021-08-17 09:27:54 +00:00
|
|
|
Force string `json:"force,omitempty"`
|
2019-09-06 18:20:31 +00:00
|
|
|
Timeout string `json:"timeout,omitempty"`
|
|
|
|
Loglevel string `json:"loglevel,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// To be simple, kill a client that is connecting to this server. A client is a sa.
|
|
|
|
//Terminates an SA while streaming control-log events.
|
|
|
|
func (c *ClientConn) Terminate(r *TerminateRequest) (err error) {
|
|
|
|
err = handlePanic(func() (err error) {
|
|
|
|
reqMap := &map[string]interface{}{}
|
|
|
|
ConvertToGeneral(r, reqMap)
|
|
|
|
msg, err := c.Request("terminate", *reqMap)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if msg["success"] != "yes" {
|
|
|
|
return fmt.Errorf("[Terminate] %s", msg["errmsg"])
|
|
|
|
}
|
|
|
|
return
|
|
|
|
})
|
|
|
|
return
|
|
|
|
}
|