2024-09-04 19:24:45 +00:00
|
|
|
// Code generated by gowrap. DO NOT EDIT.
|
|
|
|
// template: jsonrpc2/client_gen.tpl
|
|
|
|
// gowrap: http://github.com/hexdigest/gowrap
|
|
|
|
|
|
|
|
package daemon
|
|
|
|
|
|
|
|
//go:generate gowrap gen -p isle/daemon -i RPC -t jsonrpc2/client_gen.tpl -o client.go -l ""
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2024-09-07 11:52:32 +00:00
|
|
|
"isle/bootstrap"
|
2024-10-23 18:18:11 +00:00
|
|
|
"isle/daemon/daecommon"
|
2024-09-04 19:24:45 +00:00
|
|
|
"isle/daemon/jsonrpc2"
|
2024-09-09 14:34:00 +00:00
|
|
|
"isle/daemon/network"
|
2024-09-04 19:24:45 +00:00
|
|
|
"isle/nebula"
|
|
|
|
)
|
|
|
|
|
|
|
|
type rpcClient struct {
|
|
|
|
client jsonrpc2.Client
|
|
|
|
}
|
|
|
|
|
|
|
|
// RPCFromClient wraps a Client so that it implements the
|
|
|
|
// RPC interface.
|
|
|
|
func RPCFromClient(client jsonrpc2.Client) RPC {
|
|
|
|
return &rpcClient{client}
|
|
|
|
}
|
|
|
|
|
2024-09-09 14:34:00 +00:00
|
|
|
func (c *rpcClient) CreateHost(ctx context.Context, h1 nebula.HostName, c2 network.CreateHostOpts) (j1 network.JoiningBootstrap, err error) {
|
2024-09-04 20:25:38 +00:00
|
|
|
err = c.client.Call(
|
|
|
|
ctx,
|
2024-09-07 11:52:32 +00:00
|
|
|
&j1,
|
2024-09-04 20:25:38 +00:00
|
|
|
"CreateHost",
|
2024-09-07 11:52:32 +00:00
|
|
|
h1,
|
|
|
|
c2,
|
2024-09-04 20:25:38 +00:00
|
|
|
)
|
2024-09-04 19:24:45 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-09-07 11:52:32 +00:00
|
|
|
func (c *rpcClient) CreateNebulaCertificate(ctx context.Context, h1 nebula.HostName, e1 nebula.EncryptingPublicKey) (c2 nebula.Certificate, err error) {
|
2024-09-04 20:25:38 +00:00
|
|
|
err = c.client.Call(
|
|
|
|
ctx,
|
|
|
|
&c2,
|
|
|
|
"CreateNebulaCertificate",
|
2024-09-07 11:52:32 +00:00
|
|
|
h1,
|
|
|
|
e1,
|
2024-09-04 20:25:38 +00:00
|
|
|
)
|
2024-09-04 19:24:45 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-09-05 15:28:10 +00:00
|
|
|
func (c *rpcClient) CreateNetwork(ctx context.Context, name string, domain string, ipNet nebula.IPNet, hostName nebula.HostName) (err error) {
|
2024-09-04 20:25:38 +00:00
|
|
|
err = c.client.Call(
|
|
|
|
ctx,
|
2024-09-05 15:28:10 +00:00
|
|
|
nil,
|
2024-09-04 20:25:38 +00:00
|
|
|
"CreateNetwork",
|
|
|
|
name,
|
|
|
|
domain,
|
|
|
|
ipNet,
|
|
|
|
hostName,
|
|
|
|
)
|
2024-09-04 19:24:45 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-10-23 18:18:11 +00:00
|
|
|
func (c *rpcClient) GetConfig(ctx context.Context) (n1 daecommon.NetworkConfig, err error) {
|
|
|
|
err = c.client.Call(
|
|
|
|
ctx,
|
|
|
|
&n1,
|
|
|
|
"GetConfig",
|
|
|
|
)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-09-09 14:34:00 +00:00
|
|
|
func (c *rpcClient) GetGarageClientParams(ctx context.Context) (g1 network.GarageClientParams, err error) {
|
2024-09-04 20:25:38 +00:00
|
|
|
err = c.client.Call(
|
|
|
|
ctx,
|
|
|
|
&g1,
|
|
|
|
"GetGarageClientParams",
|
|
|
|
)
|
2024-09-04 19:24:45 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-09-07 11:52:32 +00:00
|
|
|
func (c *rpcClient) GetHosts(ctx context.Context) (ha1 []bootstrap.Host, err error) {
|
2024-09-04 20:25:38 +00:00
|
|
|
err = c.client.Call(
|
|
|
|
ctx,
|
2024-09-07 11:52:32 +00:00
|
|
|
&ha1,
|
2024-09-04 20:25:38 +00:00
|
|
|
"GetHosts",
|
|
|
|
)
|
2024-09-04 19:24:45 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-09-04 20:25:38 +00:00
|
|
|
func (c *rpcClient) GetNebulaCAPublicCredentials(ctx context.Context) (c2 nebula.CAPublicCredentials, err error) {
|
|
|
|
err = c.client.Call(
|
|
|
|
ctx,
|
|
|
|
&c2,
|
|
|
|
"GetNebulaCAPublicCredentials",
|
|
|
|
)
|
2024-09-04 19:24:45 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-09-24 09:03:18 +00:00
|
|
|
func (c *rpcClient) GetNetworks(ctx context.Context) (ca1 []bootstrap.CreationParams, err error) {
|
|
|
|
err = c.client.Call(
|
|
|
|
ctx,
|
|
|
|
&ca1,
|
|
|
|
"GetNetworks",
|
|
|
|
)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-09-09 14:34:00 +00:00
|
|
|
func (c *rpcClient) JoinNetwork(ctx context.Context, j1 network.JoiningBootstrap) (err error) {
|
2024-09-04 20:25:38 +00:00
|
|
|
err = c.client.Call(
|
|
|
|
ctx,
|
2024-09-05 15:28:10 +00:00
|
|
|
nil,
|
2024-09-04 20:25:38 +00:00
|
|
|
"JoinNetwork",
|
2024-09-07 11:52:32 +00:00
|
|
|
j1,
|
2024-09-04 20:25:38 +00:00
|
|
|
)
|
2024-09-04 19:24:45 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-09-05 15:28:10 +00:00
|
|
|
func (c *rpcClient) RemoveHost(ctx context.Context, hostName nebula.HostName) (err error) {
|
2024-09-04 20:25:38 +00:00
|
|
|
err = c.client.Call(
|
|
|
|
ctx,
|
2024-09-05 15:28:10 +00:00
|
|
|
nil,
|
2024-09-04 20:25:38 +00:00
|
|
|
"RemoveHost",
|
2024-09-04 20:46:38 +00:00
|
|
|
hostName,
|
2024-09-04 20:25:38 +00:00
|
|
|
)
|
2024-09-04 19:24:45 +00:00
|
|
|
return
|
|
|
|
}
|