mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
26 lines
524 B
Go
26 lines
524 B
Go
package goStrongswanVici
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
// Initiate is used to initiate an SA. This is the
|
|
// equivalent of `swanctl --initiate -c childname`
|
|
func (c *ClientConn) Initiate(child string, ike string) (err error) {
|
|
inMap := map[string]interface{}{}
|
|
if child != "" {
|
|
inMap["child"] = child
|
|
}
|
|
if ike != "" {
|
|
inMap["ike"] = ike
|
|
}
|
|
msg, err := c.Request("initiate", inMap)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if msg["success"] != "yes" {
|
|
return fmt.Errorf("unsuccessful Initiate: %v", msg["errmsg"])
|
|
}
|
|
return nil
|
|
}
|