mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
681058bb40
Signed-off-by: Manuel Buil <mbuil@suse.com>
37 lines
796 B
Go
37 lines
796 B
Go
package goStrongswanVici
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
type Pool struct {
|
|
PoolMapping map[string]interface{} `json:"pools"`
|
|
}
|
|
|
|
type PoolMapping struct {
|
|
Addrs string `json:"addrs"`
|
|
DNS []string `json:"dns,omitempty"`
|
|
NBNS []string `json:"nbns,omitempty"`
|
|
ApplicationVersion []string `json:"7,omitempty"`
|
|
InternalIPv6Prefix []string `json:"18,omitempty"`
|
|
}
|
|
|
|
func (c *ClientConn) LoadPool(ph Pool) error {
|
|
requestMap := map[string]interface{}{}
|
|
|
|
err := ConvertToGeneral(ph.PoolMapping, &requestMap)
|
|
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
return fmt.Errorf("error creating request: %v", err)
|
|
}
|
|
|
|
msg, err := c.Request("load-pool", requestMap)
|
|
|
|
if msg["success"] != "yes" {
|
|
return fmt.Errorf("unsuccessful LoadPool: %v", msg["errmsg"])
|
|
}
|
|
|
|
return nil
|
|
}
|