feat(cli): Improve config {set,get,reload} commands

- Adding support for lists of values per setting
- Allow removing settings

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
This commit is contained in:
Steffen Vogel
2023-08-11 11:34:20 +02:00
parent 98ce8ab557
commit 9626094c36
6 changed files with 481 additions and 301 deletions

View File

@@ -6,11 +6,14 @@ package main
import (
"context"
"fmt"
"strings"
"github.com/spf13/cobra"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
statusx "google.golang.org/grpc/status"
"github.com/stv0g/cunicu/pkg/proto"
rpcproto "github.com/stv0g/cunicu/pkg/proto/rpc"
@@ -28,7 +31,7 @@ func init() { //nolint:gochecknoinits
Use: "set key value",
Short: "Update the value of a configuration setting",
Run: set,
Args: cobra.ExactArgs(2),
Args: cobra.MinimumNArgs(1),
ValidArgsFunction: rpcValidArgs,
}
@@ -55,14 +58,22 @@ func init() { //nolint:gochecknoinits
}
func set(_ *cobra.Command, args []string) {
settings := map[string]string{
args[0]: args[1],
key := args[0]
values := args[1:]
var settingValue rpcproto.ConfigValue
if len(values) == 1 {
settingValue.Scalar = values[0]
} else if len(values) > 1 {
settingValue.List = values
}
if _, err := rpcClient.SetConfig(context.Background(), &rpcproto.SetConfigParams{
Settings: settings,
Settings: map[string]*rpcproto.ConfigValue{
key: &settingValue,
},
}); err != nil {
logger.Fatal("Failed to set configuration", zap.Error(err))
handleError(zap.FatalLevel, "Failed to set configuration", err)
}
}
@@ -75,21 +86,53 @@ func get(_ *cobra.Command, args []string) {
resp, err := rpcClient.GetConfig(context.Background(), params)
if err != nil {
logger.Fatal("Failed to set configuration", zap.Error(err))
logger.Fatal("Failed to get configuration", zap.Error(err))
}
keys := maps.Keys(resp.Settings)
slices.Sort(keys)
for _, key := range keys {
fmt.Printf("%s\t%s\n", key, resp.Settings[key])
val := resp.Settings[key]
if val == nil {
continue
}
if val.Scalar != "" {
fmt.Printf("%s\t%s\n", key, val.Scalar)
} else if len(val.List) > 0 {
fmt.Printf("%s\t%s\n", key, strings.Join(val.List, "\t"))
}
}
}
func reload(_ *cobra.Command, _ []string) error {
if _, err := rpcClient.ReloadConfig(context.Background(), &proto.Empty{}); err != nil {
return fmt.Errorf("failed RPC request: %w", err)
handleError(zap.FatalLevel, "Failed to reload configuration", err)
}
return nil
}
func handleError(lvl zapcore.Level, msg string, err error) {
var field zap.Field
if sts, ok := statusx.FromError(err); ok {
errs := []string{}
for _, detail := range sts.Details() {
if err, ok := detail.(*proto.Error); ok {
errs = append(errs, err.Message)
}
}
if len(errs) > 0 {
field = zap.Strings("errors", errs)
} else {
field = zap.String("error", sts.Message())
}
} else {
field = zap.Error(err)
}
logger.Log(lvl, msg, field)
}

View File

@@ -283,6 +283,53 @@ func (x *BuildInfos) GetDaemon() *BuildInfo {
return nil
}
type Error struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
}
func (x *Error) Reset() {
*x = Error{}
if protoimpl.UnsafeEnabled {
mi := &file_common_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Error) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Error) ProtoMessage() {}
func (x *Error) ProtoReflect() protoreflect.Message {
mi := &file_common_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Error.ProtoReflect.Descriptor instead.
func (*Error) Descriptor() ([]byte, []int) {
return file_common_proto_rawDescGZIP(), []int{4}
}
func (x *Error) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
var File_common_proto protoreflect.FileDescriptor
var file_common_proto_rawDesc = []byte{
@@ -312,10 +359,12 @@ var file_common_proto_rawDesc = []byte{
0x6e, 0x66, 0x6f, 0x52, 0x06, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x29, 0x0a, 0x06, 0x64,
0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x75,
0x6e, 0x69, 0x63, 0x75, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06,
0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x42, 0x23, 0x5a, 0x21, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x76, 0x30, 0x67, 0x2f, 0x63, 0x75, 0x6e, 0x69, 0x63,
0x75, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x22, 0x21, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12,
0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x23, 0x5a, 0x21, 0x67, 0x69, 0x74,
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x76, 0x30, 0x67, 0x2f, 0x63, 0x75,
0x6e, 0x69, 0x63, 0x75, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -330,12 +379,13 @@ func file_common_proto_rawDescGZIP() []byte {
return file_common_proto_rawDescData
}
var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_common_proto_goTypes = []interface{}{
(*Empty)(nil), // 0: cunicu.Empty
(*Timestamp)(nil), // 1: cunicu.Timestamp
(*BuildInfo)(nil), // 2: cunicu.BuildInfo
(*BuildInfos)(nil), // 3: cunicu.BuildInfos
(*Error)(nil), // 4: cunicu.Error
}
var file_common_proto_depIdxs = []int32{
1, // 0: cunicu.BuildInfo.date:type_name -> cunicu.Timestamp
@@ -402,6 +452,18 @@ func file_common_proto_init() {
return nil
}
}
file_common_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Error); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@@ -409,7 +471,7 @@ func file_common_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_common_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumMessages: 5,
NumExtensions: 0,
NumServices: 0,
},

View File

@@ -25,6 +25,61 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type ConfigValue struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Scalar string `protobuf:"bytes,1,opt,name=scalar,proto3" json:"scalar,omitempty"`
List []string `protobuf:"bytes,2,rep,name=list,proto3" json:"list,omitempty"`
}
func (x *ConfigValue) Reset() {
*x = ConfigValue{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_daemon_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ConfigValue) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ConfigValue) ProtoMessage() {}
func (x *ConfigValue) ProtoReflect() protoreflect.Message {
mi := &file_rpc_daemon_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ConfigValue.ProtoReflect.Descriptor instead.
func (*ConfigValue) Descriptor() ([]byte, []int) {
return file_rpc_daemon_proto_rawDescGZIP(), []int{0}
}
func (x *ConfigValue) GetScalar() string {
if x != nil {
return x.Scalar
}
return ""
}
func (x *ConfigValue) GetList() []string {
if x != nil {
return x.List
}
return nil
}
type GetStatusParams struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -37,7 +92,7 @@ type GetStatusParams struct {
func (x *GetStatusParams) Reset() {
*x = GetStatusParams{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_daemon_proto_msgTypes[0]
mi := &file_rpc_daemon_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -50,7 +105,7 @@ func (x *GetStatusParams) String() string {
func (*GetStatusParams) ProtoMessage() {}
func (x *GetStatusParams) ProtoReflect() protoreflect.Message {
mi := &file_rpc_daemon_proto_msgTypes[0]
mi := &file_rpc_daemon_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -63,7 +118,7 @@ func (x *GetStatusParams) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetStatusParams.ProtoReflect.Descriptor instead.
func (*GetStatusParams) Descriptor() ([]byte, []int) {
return file_rpc_daemon_proto_rawDescGZIP(), []int{0}
return file_rpc_daemon_proto_rawDescGZIP(), []int{1}
}
func (x *GetStatusParams) GetInterface() string {
@@ -91,7 +146,7 @@ type GetStatusResp struct {
func (x *GetStatusResp) Reset() {
*x = GetStatusResp{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_daemon_proto_msgTypes[1]
mi := &file_rpc_daemon_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -104,7 +159,7 @@ func (x *GetStatusResp) String() string {
func (*GetStatusResp) ProtoMessage() {}
func (x *GetStatusResp) ProtoReflect() protoreflect.Message {
mi := &file_rpc_daemon_proto_msgTypes[1]
mi := &file_rpc_daemon_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -117,7 +172,7 @@ func (x *GetStatusResp) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetStatusResp.ProtoReflect.Descriptor instead.
func (*GetStatusResp) Descriptor() ([]byte, []int) {
return file_rpc_daemon_proto_rawDescGZIP(), []int{1}
return file_rpc_daemon_proto_rawDescGZIP(), []int{2}
}
func (x *GetStatusResp) GetInterfaces() []*core.Interface {
@@ -132,13 +187,13 @@ type SetConfigParams struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Settings map[string]string `protobuf:"bytes,1,rep,name=settings,proto3" json:"settings,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
Settings map[string]*ConfigValue `protobuf:"bytes,1,rep,name=settings,proto3" json:"settings,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
}
func (x *SetConfigParams) Reset() {
*x = SetConfigParams{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_daemon_proto_msgTypes[2]
mi := &file_rpc_daemon_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -151,7 +206,7 @@ func (x *SetConfigParams) String() string {
func (*SetConfigParams) ProtoMessage() {}
func (x *SetConfigParams) ProtoReflect() protoreflect.Message {
mi := &file_rpc_daemon_proto_msgTypes[2]
mi := &file_rpc_daemon_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -164,10 +219,10 @@ func (x *SetConfigParams) ProtoReflect() protoreflect.Message {
// Deprecated: Use SetConfigParams.ProtoReflect.Descriptor instead.
func (*SetConfigParams) Descriptor() ([]byte, []int) {
return file_rpc_daemon_proto_rawDescGZIP(), []int{2}
return file_rpc_daemon_proto_rawDescGZIP(), []int{3}
}
func (x *SetConfigParams) GetSettings() map[string]string {
func (x *SetConfigParams) GetSettings() map[string]*ConfigValue {
if x != nil {
return x.Settings
}
@@ -185,7 +240,7 @@ type GetConfigParams struct {
func (x *GetConfigParams) Reset() {
*x = GetConfigParams{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_daemon_proto_msgTypes[3]
mi := &file_rpc_daemon_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -198,7 +253,7 @@ func (x *GetConfigParams) String() string {
func (*GetConfigParams) ProtoMessage() {}
func (x *GetConfigParams) ProtoReflect() protoreflect.Message {
mi := &file_rpc_daemon_proto_msgTypes[3]
mi := &file_rpc_daemon_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -211,7 +266,7 @@ func (x *GetConfigParams) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetConfigParams.ProtoReflect.Descriptor instead.
func (*GetConfigParams) Descriptor() ([]byte, []int) {
return file_rpc_daemon_proto_rawDescGZIP(), []int{3}
return file_rpc_daemon_proto_rawDescGZIP(), []int{4}
}
func (x *GetConfigParams) GetKeyFilter() string {
@@ -226,13 +281,13 @@ type GetConfigResp struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Settings map[string]string `protobuf:"bytes,1,rep,name=settings,proto3" json:"settings,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
Settings map[string]*ConfigValue `protobuf:"bytes,1,rep,name=settings,proto3" json:"settings,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
}
func (x *GetConfigResp) Reset() {
*x = GetConfigResp{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_daemon_proto_msgTypes[4]
mi := &file_rpc_daemon_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -245,7 +300,7 @@ func (x *GetConfigResp) String() string {
func (*GetConfigResp) ProtoMessage() {}
func (x *GetConfigResp) ProtoReflect() protoreflect.Message {
mi := &file_rpc_daemon_proto_msgTypes[4]
mi := &file_rpc_daemon_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -258,10 +313,10 @@ func (x *GetConfigResp) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetConfigResp.ProtoReflect.Descriptor instead.
func (*GetConfigResp) Descriptor() ([]byte, []int) {
return file_rpc_daemon_proto_rawDescGZIP(), []int{4}
return file_rpc_daemon_proto_rawDescGZIP(), []int{5}
}
func (x *GetConfigResp) GetSettings() map[string]string {
func (x *GetConfigResp) GetSettings() map[string]*ConfigValue {
if x != nil {
return x.Settings
}
@@ -281,7 +336,7 @@ type AddPeerParams struct {
func (x *AddPeerParams) Reset() {
*x = AddPeerParams{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_daemon_proto_msgTypes[5]
mi := &file_rpc_daemon_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -294,7 +349,7 @@ func (x *AddPeerParams) String() string {
func (*AddPeerParams) ProtoMessage() {}
func (x *AddPeerParams) ProtoReflect() protoreflect.Message {
mi := &file_rpc_daemon_proto_msgTypes[5]
mi := &file_rpc_daemon_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -307,7 +362,7 @@ func (x *AddPeerParams) ProtoReflect() protoreflect.Message {
// Deprecated: Use AddPeerParams.ProtoReflect.Descriptor instead.
func (*AddPeerParams) Descriptor() ([]byte, []int) {
return file_rpc_daemon_proto_rawDescGZIP(), []int{5}
return file_rpc_daemon_proto_rawDescGZIP(), []int{6}
}
func (x *AddPeerParams) GetInterface() string {
@@ -343,7 +398,7 @@ type AddPeerResp struct {
func (x *AddPeerResp) Reset() {
*x = AddPeerResp{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_daemon_proto_msgTypes[6]
mi := &file_rpc_daemon_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -356,7 +411,7 @@ func (x *AddPeerResp) String() string {
func (*AddPeerResp) ProtoMessage() {}
func (x *AddPeerResp) ProtoReflect() protoreflect.Message {
mi := &file_rpc_daemon_proto_msgTypes[6]
mi := &file_rpc_daemon_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -369,7 +424,7 @@ func (x *AddPeerResp) ProtoReflect() protoreflect.Message {
// Deprecated: Use AddPeerResp.ProtoReflect.Descriptor instead.
func (*AddPeerResp) Descriptor() ([]byte, []int) {
return file_rpc_daemon_proto_rawDescGZIP(), []int{6}
return file_rpc_daemon_proto_rawDescGZIP(), []int{7}
}
func (x *AddPeerResp) GetInvitation() *Invitation {
@@ -397,7 +452,7 @@ type ShutdownParams struct {
func (x *ShutdownParams) Reset() {
*x = ShutdownParams{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_daemon_proto_msgTypes[7]
mi := &file_rpc_daemon_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -410,7 +465,7 @@ func (x *ShutdownParams) String() string {
func (*ShutdownParams) ProtoMessage() {}
func (x *ShutdownParams) ProtoReflect() protoreflect.Message {
mi := &file_rpc_daemon_proto_msgTypes[7]
mi := &file_rpc_daemon_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -423,7 +478,7 @@ func (x *ShutdownParams) ProtoReflect() protoreflect.Message {
// Deprecated: Use ShutdownParams.ProtoReflect.Descriptor instead.
func (*ShutdownParams) Descriptor() ([]byte, []int) {
return file_rpc_daemon_proto_rawDescGZIP(), []int{7}
return file_rpc_daemon_proto_rawDescGZIP(), []int{8}
}
func (x *ShutdownParams) GetRestart() bool {
@@ -446,7 +501,7 @@ type GetCompletionParams struct {
func (x *GetCompletionParams) Reset() {
*x = GetCompletionParams{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_daemon_proto_msgTypes[8]
mi := &file_rpc_daemon_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -459,7 +514,7 @@ func (x *GetCompletionParams) String() string {
func (*GetCompletionParams) ProtoMessage() {}
func (x *GetCompletionParams) ProtoReflect() protoreflect.Message {
mi := &file_rpc_daemon_proto_msgTypes[8]
mi := &file_rpc_daemon_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -472,7 +527,7 @@ func (x *GetCompletionParams) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetCompletionParams.ProtoReflect.Descriptor instead.
func (*GetCompletionParams) Descriptor() ([]byte, []int) {
return file_rpc_daemon_proto_rawDescGZIP(), []int{8}
return file_rpc_daemon_proto_rawDescGZIP(), []int{9}
}
func (x *GetCompletionParams) GetCmd() []string {
@@ -508,7 +563,7 @@ type GetCompletionResp struct {
func (x *GetCompletionResp) Reset() {
*x = GetCompletionResp{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_daemon_proto_msgTypes[9]
mi := &file_rpc_daemon_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -521,7 +576,7 @@ func (x *GetCompletionResp) String() string {
func (*GetCompletionResp) ProtoMessage() {}
func (x *GetCompletionResp) ProtoReflect() protoreflect.Message {
mi := &file_rpc_daemon_proto_msgTypes[9]
mi := &file_rpc_daemon_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -534,7 +589,7 @@ func (x *GetCompletionResp) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetCompletionResp.ProtoReflect.Descriptor instead.
func (*GetCompletionResp) Descriptor() ([]byte, []int) {
return file_rpc_daemon_proto_rawDescGZIP(), []int{9}
return file_rpc_daemon_proto_rawDescGZIP(), []int{10}
}
func (x *GetCompletionResp) GetOptions() []string {
@@ -560,109 +615,115 @@ var file_rpc_daemon_proto_rawDesc = []byte{
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x1a, 0x0f, 0x72, 0x70, 0x63, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x72, 0x70, 0x63, 0x2f, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x43, 0x0a, 0x0f, 0x47, 0x65, 0x74,
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1c, 0x0a, 0x09,
0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x09, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x65,
0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x22, 0x47,
0x0a, 0x0d, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12,
0x36, 0x0a, 0x0a, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x63, 0x6f, 0x72,
0x65, 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x52, 0x0a, 0x69, 0x6e, 0x74,
0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x22, 0x95, 0x01, 0x0a, 0x0f, 0x53, 0x65, 0x74, 0x43,
0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x45, 0x0a, 0x08, 0x73,
0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e,
0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f,
0x6e, 0x66, 0x69, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69,
0x6e, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e,
0x67, 0x73, 0x1a, 0x3b, 0x0a, 0x0d, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x45, 0x6e,
0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22,
0x30, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50, 0x61, 0x72, 0x61,
0x6d, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6b, 0x65, 0x79, 0x46, 0x69, 0x6c, 0x74, 0x65,
0x72, 0x22, 0x91, 0x01, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52,
0x65, 0x73, 0x70, 0x12, 0x43, 0x0a, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18,
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x72,
0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70,
0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08,
0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x1a, 0x3b, 0x0a, 0x0d, 0x53, 0x65, 0x74, 0x74,
0x69, 0x6e, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x60, 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x50, 0x65, 0x65, 0x72,
0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66,
0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x72,
0x66, 0x61, 0x63, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b,
0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63,
0x4b, 0x65, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x7b, 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x50, 0x65,
0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x36, 0x0a, 0x0a, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x75, 0x6e,
0x69, 0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x52, 0x0a, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x34,
0x0a, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x16, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e,
0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x52, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x72,
0x66, 0x61, 0x63, 0x65, 0x22, 0x2a, 0x0a, 0x0e, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e,
0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x74, 0x61, 0x72,
0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74,
0x22, 0x5c, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69, 0x6f,
0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x01,
0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x67,
0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x12, 0x1f, 0x0a,
0x0b, 0x74, 0x6f, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0a, 0x74, 0x6f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x22, 0x43,
0x0a, 0x11, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x52,
0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01,
0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x14, 0x0a,
0x05, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x66, 0x6c,
0x61, 0x67, 0x73, 0x32, 0x8a, 0x05, 0x0a, 0x06, 0x44, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x12, 0x32,
0x0a, 0x0c, 0x47, 0x65, 0x74, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0d,
0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x11, 0x2e,
0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x6e, 0x66, 0x6f,
0x22, 0x00, 0x12, 0x34, 0x0a, 0x0c, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x45, 0x76, 0x65, 0x6e,
0x74, 0x73, 0x12, 0x0d, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x45, 0x6d, 0x70, 0x74,
0x79, 0x1a, 0x11, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x45,
0x76, 0x65, 0x6e, 0x74, 0x22, 0x00, 0x30, 0x01, 0x12, 0x28, 0x0a, 0x06, 0x55, 0x6e, 0x57, 0x61,
0x69, 0x74, 0x12, 0x0d, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x45, 0x6d, 0x70, 0x74,
0x79, 0x1a, 0x0d, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79,
0x22, 0x00, 0x12, 0x37, 0x0a, 0x08, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x1a,
0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x68, 0x75, 0x74,
0x64, 0x6f, 0x77, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x0d, 0x2e, 0x63, 0x75, 0x6e,
0x69, 0x63, 0x75, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x26, 0x0a, 0x04, 0x53,
0x79, 0x6e, 0x63, 0x12, 0x0d, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x45, 0x6d, 0x70,
0x74, 0x79, 0x1a, 0x0d, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x45, 0x6d, 0x70, 0x74,
0x79, 0x22, 0x00, 0x12, 0x45, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x12, 0x1b, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65,
0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x19, 0x2e,
0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x09, 0x53, 0x65,
0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1b, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75,
0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50, 0x61,
0x72, 0x61, 0x6d, 0x73, 0x1a, 0x0d, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x45, 0x6d,
0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x45, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66,
0x69, 0x67, 0x12, 0x1b, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e,
0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a,
0x19, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74,
0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x51, 0x0a, 0x0d,
0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x2e,
0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f,
0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1d,
0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43,
0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12,
0x2e, 0x0a, 0x0c, 0x52, 0x65, 0x6c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12,
0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x39, 0x0a, 0x0b, 0x43, 0x6f, 0x6e,
0x66, 0x69, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x61, 0x6c,
0x61, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x61, 0x6c, 0x61, 0x72,
0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04,
0x6c, 0x69, 0x73, 0x74, 0x22, 0x43, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75,
0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x72,
0x66, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x74, 0x65,
0x72, 0x66, 0x61, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x65, 0x65, 0x72, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0c, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x22, 0x47, 0x0a, 0x0d, 0x47, 0x65, 0x74,
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x36, 0x0a, 0x0a, 0x69, 0x6e,
0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16,
0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x6e, 0x74,
0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63,
0x65, 0x73, 0x22, 0xae, 0x01, 0x0a, 0x0f, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,
0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x45, 0x0a, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e,
0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63,
0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50,
0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x45, 0x6e,
0x74, 0x72, 0x79, 0x52, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x1a, 0x54, 0x0a,
0x0d, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10,
0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79,
0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x17, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6e,
0x66, 0x69, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a,
0x02, 0x38, 0x01, 0x22, 0x30, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,
0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, 0x66, 0x69,
0x6c, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6b, 0x65, 0x79, 0x46,
0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, 0xaa, 0x01, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e,
0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x43, 0x0a, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69,
0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x75, 0x6e, 0x69,
0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,
0x52, 0x65, 0x73, 0x70, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x45, 0x6e, 0x74,
0x72, 0x79, 0x52, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x1a, 0x54, 0x0a, 0x0d,
0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17,
0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x66,
0x69, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02,
0x38, 0x01, 0x22, 0x60, 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x50, 0x65, 0x65, 0x72, 0x50, 0x61, 0x72,
0x61, 0x6d, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63,
0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79,
0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x22, 0x7b, 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x50, 0x65, 0x65, 0x72, 0x52,
0x65, 0x73, 0x70, 0x12, 0x36, 0x0a, 0x0a, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75,
0x2e, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52,
0x0a, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x0a, 0x09, 0x69,
0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16,
0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x6e, 0x74,
0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x52, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63,
0x65, 0x22, 0x2a, 0x0a, 0x0e, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x50, 0x61, 0x72,
0x61, 0x6d, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01,
0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x22, 0x5c, 0x0a,
0x13, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61,
0x72, 0x61, 0x6d, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28,
0x09, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02,
0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f,
0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
0x0a, 0x74, 0x6f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x22, 0x43, 0x0a, 0x11, 0x47,
0x65, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70,
0x12, 0x18, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
0x09, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x6c,
0x61, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x66, 0x6c, 0x61, 0x67, 0x73,
0x32, 0x8a, 0x05, 0x0a, 0x06, 0x44, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x12, 0x32, 0x0a, 0x0c, 0x47,
0x65, 0x74, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0d, 0x2e, 0x63, 0x75,
0x6e, 0x69, 0x63, 0x75, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x11, 0x2e, 0x63, 0x75, 0x6e,
0x69, 0x63, 0x75, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x00, 0x12,
0x34, 0x0a, 0x0c, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12,
0x0d, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x11,
0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x45, 0x76, 0x65, 0x6e,
0x74, 0x22, 0x00, 0x30, 0x01, 0x12, 0x28, 0x0a, 0x06, 0x55, 0x6e, 0x57, 0x61, 0x69, 0x74, 0x12,
0x0d, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0d,
0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12,
0x3f, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x50, 0x65, 0x65, 0x72, 0x12, 0x19, 0x2e, 0x63, 0x75, 0x6e,
0x69, 0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x65, 0x65, 0x72, 0x50,
0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x17, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x72,
0x70, 0x63, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00,
0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73,
0x74, 0x76, 0x30, 0x67, 0x2f, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2f, 0x70, 0x6b, 0x67, 0x2f,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
0x37, 0x0a, 0x08, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x1a, 0x2e, 0x63, 0x75,
0x6e, 0x69, 0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77,
0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x0d, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75,
0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x26, 0x0a, 0x04, 0x53, 0x79, 0x6e, 0x63,
0x12, 0x0d, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a,
0x0d, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00,
0x12, 0x45, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x2e,
0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x19, 0x2e, 0x63, 0x75, 0x6e,
0x69, 0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75,
0x73, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x09, 0x53, 0x65, 0x74, 0x43, 0x6f,
0x6e, 0x66, 0x69, 0x67, 0x12, 0x1b, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x72, 0x70,
0x63, 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d,
0x73, 0x1a, 0x0d, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79,
0x22, 0x00, 0x12, 0x45, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12,
0x1b, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74,
0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x19, 0x2e, 0x63,
0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e,
0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x51, 0x0a, 0x0d, 0x47, 0x65, 0x74,
0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x2e, 0x63, 0x75, 0x6e,
0x69, 0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6c,
0x65, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1d, 0x2e, 0x63, 0x75,
0x6e, 0x69, 0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x70,
0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x2e, 0x0a, 0x0c,
0x52, 0x65, 0x6c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x0d, 0x2e, 0x63,
0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0d, 0x2e, 0x63, 0x75,
0x6e, 0x69, 0x63, 0x75, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x07,
0x41, 0x64, 0x64, 0x50, 0x65, 0x65, 0x72, 0x12, 0x19, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75,
0x2e, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x65, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61,
0x6d, 0x73, 0x1a, 0x17, 0x2e, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2e, 0x72, 0x70, 0x63, 0x2e,
0x41, 0x64, 0x64, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x42, 0x27, 0x5a,
0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x76, 0x30,
0x67, 0x2f, 0x63, 0x75, 0x6e, 0x69, 0x63, 0x75, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x2f, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -677,59 +738,62 @@ func file_rpc_daemon_proto_rawDescGZIP() []byte {
return file_rpc_daemon_proto_rawDescData
}
var file_rpc_daemon_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
var file_rpc_daemon_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_rpc_daemon_proto_goTypes = []interface{}{
(*GetStatusParams)(nil), // 0: cunicu.rpc.GetStatusParams
(*GetStatusResp)(nil), // 1: cunicu.rpc.GetStatusResp
(*SetConfigParams)(nil), // 2: cunicu.rpc.SetConfigParams
(*GetConfigParams)(nil), // 3: cunicu.rpc.GetConfigParams
(*GetConfigResp)(nil), // 4: cunicu.rpc.GetConfigResp
(*AddPeerParams)(nil), // 5: cunicu.rpc.AddPeerParams
(*AddPeerResp)(nil), // 6: cunicu.rpc.AddPeerResp
(*ShutdownParams)(nil), // 7: cunicu.rpc.ShutdownParams
(*GetCompletionParams)(nil), // 8: cunicu.rpc.GetCompletionParams
(*GetCompletionResp)(nil), // 9: cunicu.rpc.GetCompletionResp
nil, // 10: cunicu.rpc.SetConfigParams.SettingsEntry
nil, // 11: cunicu.rpc.GetConfigResp.SettingsEntry
(*core.Interface)(nil), // 12: cunicu.core.Interface
(*Invitation)(nil), // 13: cunicu.rpc.Invitation
(*proto.Empty)(nil), // 14: cunicu.Empty
(*proto.BuildInfo)(nil), // 15: cunicu.BuildInfo
(*Event)(nil), // 16: cunicu.rpc.Event
(*ConfigValue)(nil), // 0: cunicu.rpc.ConfigValue
(*GetStatusParams)(nil), // 1: cunicu.rpc.GetStatusParams
(*GetStatusResp)(nil), // 2: cunicu.rpc.GetStatusResp
(*SetConfigParams)(nil), // 3: cunicu.rpc.SetConfigParams
(*GetConfigParams)(nil), // 4: cunicu.rpc.GetConfigParams
(*GetConfigResp)(nil), // 5: cunicu.rpc.GetConfigResp
(*AddPeerParams)(nil), // 6: cunicu.rpc.AddPeerParams
(*AddPeerResp)(nil), // 7: cunicu.rpc.AddPeerResp
(*ShutdownParams)(nil), // 8: cunicu.rpc.ShutdownParams
(*GetCompletionParams)(nil), // 9: cunicu.rpc.GetCompletionParams
(*GetCompletionResp)(nil), // 10: cunicu.rpc.GetCompletionResp
nil, // 11: cunicu.rpc.SetConfigParams.SettingsEntry
nil, // 12: cunicu.rpc.GetConfigResp.SettingsEntry
(*core.Interface)(nil), // 13: cunicu.core.Interface
(*Invitation)(nil), // 14: cunicu.rpc.Invitation
(*proto.Empty)(nil), // 15: cunicu.Empty
(*proto.BuildInfo)(nil), // 16: cunicu.BuildInfo
(*Event)(nil), // 17: cunicu.rpc.Event
}
var file_rpc_daemon_proto_depIdxs = []int32{
12, // 0: cunicu.rpc.GetStatusResp.interfaces:type_name -> cunicu.core.Interface
10, // 1: cunicu.rpc.SetConfigParams.settings:type_name -> cunicu.rpc.SetConfigParams.SettingsEntry
11, // 2: cunicu.rpc.GetConfigResp.settings:type_name -> cunicu.rpc.GetConfigResp.SettingsEntry
13, // 3: cunicu.rpc.AddPeerResp.invitation:type_name -> cunicu.rpc.Invitation
12, // 4: cunicu.rpc.AddPeerResp.interface:type_name -> cunicu.core.Interface
14, // 5: cunicu.rpc.Daemon.GetBuildInfo:input_type -> cunicu.Empty
14, // 6: cunicu.rpc.Daemon.StreamEvents:input_type -> cunicu.Empty
14, // 7: cunicu.rpc.Daemon.UnWait:input_type -> cunicu.Empty
7, // 8: cunicu.rpc.Daemon.Shutdown:input_type -> cunicu.rpc.ShutdownParams
14, // 9: cunicu.rpc.Daemon.Sync:input_type -> cunicu.Empty
0, // 10: cunicu.rpc.Daemon.GetStatus:input_type -> cunicu.rpc.GetStatusParams
2, // 11: cunicu.rpc.Daemon.SetConfig:input_type -> cunicu.rpc.SetConfigParams
3, // 12: cunicu.rpc.Daemon.GetConfig:input_type -> cunicu.rpc.GetConfigParams
8, // 13: cunicu.rpc.Daemon.GetCompletion:input_type -> cunicu.rpc.GetCompletionParams
14, // 14: cunicu.rpc.Daemon.ReloadConfig:input_type -> cunicu.Empty
5, // 15: cunicu.rpc.Daemon.AddPeer:input_type -> cunicu.rpc.AddPeerParams
15, // 16: cunicu.rpc.Daemon.GetBuildInfo:output_type -> cunicu.BuildInfo
16, // 17: cunicu.rpc.Daemon.StreamEvents:output_type -> cunicu.rpc.Event
14, // 18: cunicu.rpc.Daemon.UnWait:output_type -> cunicu.Empty
14, // 19: cunicu.rpc.Daemon.Shutdown:output_type -> cunicu.Empty
14, // 20: cunicu.rpc.Daemon.Sync:output_type -> cunicu.Empty
1, // 21: cunicu.rpc.Daemon.GetStatus:output_type -> cunicu.rpc.GetStatusResp
14, // 22: cunicu.rpc.Daemon.SetConfig:output_type -> cunicu.Empty
4, // 23: cunicu.rpc.Daemon.GetConfig:output_type -> cunicu.rpc.GetConfigResp
9, // 24: cunicu.rpc.Daemon.GetCompletion:output_type -> cunicu.rpc.GetCompletionResp
14, // 25: cunicu.rpc.Daemon.ReloadConfig:output_type -> cunicu.Empty
6, // 26: cunicu.rpc.Daemon.AddPeer:output_type -> cunicu.rpc.AddPeerResp
16, // [16:27] is the sub-list for method output_type
5, // [5:16] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
13, // 0: cunicu.rpc.GetStatusResp.interfaces:type_name -> cunicu.core.Interface
11, // 1: cunicu.rpc.SetConfigParams.settings:type_name -> cunicu.rpc.SetConfigParams.SettingsEntry
12, // 2: cunicu.rpc.GetConfigResp.settings:type_name -> cunicu.rpc.GetConfigResp.SettingsEntry
14, // 3: cunicu.rpc.AddPeerResp.invitation:type_name -> cunicu.rpc.Invitation
13, // 4: cunicu.rpc.AddPeerResp.interface:type_name -> cunicu.core.Interface
0, // 5: cunicu.rpc.SetConfigParams.SettingsEntry.value:type_name -> cunicu.rpc.ConfigValue
0, // 6: cunicu.rpc.GetConfigResp.SettingsEntry.value:type_name -> cunicu.rpc.ConfigValue
15, // 7: cunicu.rpc.Daemon.GetBuildInfo:input_type -> cunicu.Empty
15, // 8: cunicu.rpc.Daemon.StreamEvents:input_type -> cunicu.Empty
15, // 9: cunicu.rpc.Daemon.UnWait:input_type -> cunicu.Empty
8, // 10: cunicu.rpc.Daemon.Shutdown:input_type -> cunicu.rpc.ShutdownParams
15, // 11: cunicu.rpc.Daemon.Sync:input_type -> cunicu.Empty
1, // 12: cunicu.rpc.Daemon.GetStatus:input_type -> cunicu.rpc.GetStatusParams
3, // 13: cunicu.rpc.Daemon.SetConfig:input_type -> cunicu.rpc.SetConfigParams
4, // 14: cunicu.rpc.Daemon.GetConfig:input_type -> cunicu.rpc.GetConfigParams
9, // 15: cunicu.rpc.Daemon.GetCompletion:input_type -> cunicu.rpc.GetCompletionParams
15, // 16: cunicu.rpc.Daemon.ReloadConfig:input_type -> cunicu.Empty
6, // 17: cunicu.rpc.Daemon.AddPeer:input_type -> cunicu.rpc.AddPeerParams
16, // 18: cunicu.rpc.Daemon.GetBuildInfo:output_type -> cunicu.BuildInfo
17, // 19: cunicu.rpc.Daemon.StreamEvents:output_type -> cunicu.rpc.Event
15, // 20: cunicu.rpc.Daemon.UnWait:output_type -> cunicu.Empty
15, // 21: cunicu.rpc.Daemon.Shutdown:output_type -> cunicu.Empty
15, // 22: cunicu.rpc.Daemon.Sync:output_type -> cunicu.Empty
2, // 23: cunicu.rpc.Daemon.GetStatus:output_type -> cunicu.rpc.GetStatusResp
15, // 24: cunicu.rpc.Daemon.SetConfig:output_type -> cunicu.Empty
5, // 25: cunicu.rpc.Daemon.GetConfig:output_type -> cunicu.rpc.GetConfigResp
10, // 26: cunicu.rpc.Daemon.GetCompletion:output_type -> cunicu.rpc.GetCompletionResp
15, // 27: cunicu.rpc.Daemon.ReloadConfig:output_type -> cunicu.Empty
7, // 28: cunicu.rpc.Daemon.AddPeer:output_type -> cunicu.rpc.AddPeerResp
18, // [18:29] is the sub-list for method output_type
7, // [7:18] is the sub-list for method input_type
7, // [7:7] is the sub-list for extension type_name
7, // [7:7] is the sub-list for extension extendee
0, // [0:7] is the sub-list for field type_name
}
func init() { file_rpc_daemon_proto_init() }
@@ -741,7 +805,7 @@ func file_rpc_daemon_proto_init() {
file_rpc_invitation_proto_init()
if !protoimpl.UnsafeEnabled {
file_rpc_daemon_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetStatusParams); i {
switch v := v.(*ConfigValue); i {
case 0:
return &v.state
case 1:
@@ -753,7 +817,7 @@ func file_rpc_daemon_proto_init() {
}
}
file_rpc_daemon_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetStatusResp); i {
switch v := v.(*GetStatusParams); i {
case 0:
return &v.state
case 1:
@@ -765,7 +829,7 @@ func file_rpc_daemon_proto_init() {
}
}
file_rpc_daemon_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SetConfigParams); i {
switch v := v.(*GetStatusResp); i {
case 0:
return &v.state
case 1:
@@ -777,7 +841,7 @@ func file_rpc_daemon_proto_init() {
}
}
file_rpc_daemon_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetConfigParams); i {
switch v := v.(*SetConfigParams); i {
case 0:
return &v.state
case 1:
@@ -789,7 +853,7 @@ func file_rpc_daemon_proto_init() {
}
}
file_rpc_daemon_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetConfigResp); i {
switch v := v.(*GetConfigParams); i {
case 0:
return &v.state
case 1:
@@ -801,7 +865,7 @@ func file_rpc_daemon_proto_init() {
}
}
file_rpc_daemon_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddPeerParams); i {
switch v := v.(*GetConfigResp); i {
case 0:
return &v.state
case 1:
@@ -813,7 +877,7 @@ func file_rpc_daemon_proto_init() {
}
}
file_rpc_daemon_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddPeerResp); i {
switch v := v.(*AddPeerParams); i {
case 0:
return &v.state
case 1:
@@ -825,7 +889,7 @@ func file_rpc_daemon_proto_init() {
}
}
file_rpc_daemon_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ShutdownParams); i {
switch v := v.(*AddPeerResp); i {
case 0:
return &v.state
case 1:
@@ -837,7 +901,7 @@ func file_rpc_daemon_proto_init() {
}
}
file_rpc_daemon_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetCompletionParams); i {
switch v := v.(*ShutdownParams); i {
case 0:
return &v.state
case 1:
@@ -849,6 +913,18 @@ func file_rpc_daemon_proto_init() {
}
}
file_rpc_daemon_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetCompletionParams); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rpc_daemon_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetCompletionResp); i {
case 0:
return &v.state
@@ -867,7 +943,7 @@ func file_rpc_daemon_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_rpc_daemon_proto_rawDesc,
NumEnums: 0,
NumMessages: 12,
NumMessages: 13,
NumExtensions: 0,
NumServices: 1,
},

View File

@@ -19,12 +19,12 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"github.com/mitchellh/mapstructure"
"github.com/spf13/cobra"
"github.com/stv0g/cunicu/pkg/buildinfo"
"github.com/stv0g/cunicu/pkg/crypto"
"github.com/stv0g/cunicu/pkg/daemon"
"github.com/stv0g/cunicu/pkg/daemon/feature/epdisc"
"github.com/stv0g/cunicu/pkg/log"
osx "github.com/stv0g/cunicu/pkg/os"
"github.com/stv0g/cunicu/pkg/proto"
coreproto "github.com/stv0g/cunicu/pkg/proto/core"
@@ -173,77 +173,42 @@ func (s *DaemonServer) GetStatus(_ context.Context, p *rpcproto.GetStatusParams)
}
func (s *DaemonServer) SetConfig(_ context.Context, p *rpcproto.SetConfigParams) (*proto.Empty, error) {
errs := []error{}
settings := map[string]any{}
numChanges := 0
for key, value := range p.Settings {
switch key {
case "log.rules":
rules := strings.Split(value, ",")
filter, err := log.ParseFilter(rules)
if err != nil {
errs = append(errs, err)
}
log.UpdateFilter(filter)
numChanges++
switch {
case value.Scalar != "":
settings[key] = value.Scalar
case len(value.List) > 0:
settings[key] = value.List
default:
if value == "" { // Unset value
settings[key] = nil
} else {
settings[key] = value
}
settings[key] = nil // Unset
}
}
changes, err := s.Config.Update(settings)
if err != nil {
errs = append(errs, err)
}
numChanges += len(changes)
if numChanges == 0 {
errs = append(errs, errNoSettingChanged)
}
if len(errs) > 0 {
errstrs := []string{}
for _, err := range errs {
errstrs = append(errstrs, err.Error())
}
return nil, status.Error(codes.InvalidArgument, strings.Join(errstrs, ", "))
}
if err := s.Config.SaveRuntime(); err != nil {
return nil, status.Errorf(codes.InvalidArgument, "Failed to save runtime configuration: %s", err)
if changes, err := s.Config.Update(settings); err != nil {
return nil, decodeError(err)
} else if len(changes) == 0 {
return nil, status.Error(codes.InvalidArgument, errNoSettingChanged.Error())
}
return &proto.Empty{}, nil
}
func (s *DaemonServer) GetConfig(_ context.Context, p *rpcproto.GetConfigParams) (*rpcproto.GetConfigResp, error) {
settings := map[string]string{}
match := func(key string) bool {
return p.KeyFilter == "" || strings.HasPrefix(key, p.KeyFilter)
}
settings := map[string]*rpcproto.ConfigValue{}
for key, value := range s.Config.All() {
if match(key) {
str, err := settingToString(value)
if err != nil {
return nil, status.Errorf(codes.Internal, "Failed to marshal: %s", err)
}
settings[key] = str
if p.KeyFilter != "" && !strings.HasPrefix(key, p.KeyFilter) {
continue
}
}
if match("log.rules") {
settings["log.rules"] = log.CurrentFilter().String()
str, err := settingToValue(value)
if err != nil {
return nil, status.Errorf(codes.Internal, "Failed to marshal: %s", err)
}
settings[key] = str
}
return &rpcproto.GetConfigResp{
@@ -255,11 +220,13 @@ func (s *DaemonServer) GetCompletion(_ context.Context, params *rpcproto.GetComp
var options []string
var flags cobra.ShellCompDirective
if len(params.Cmd) < 2 || params.Cmd[0] != "cunicu" {
switch {
case len(params.Cmd) < 2 || params.Cmd[0] != "cunicu":
flags = cobra.ShellCompDirectiveError
} else if params.Cmd[1] == "config" {
options, flags = s.getConfigCompletion(params.Cmd[2], params.Args, params.ToComplete)
} else {
case params.Cmd[1] == "config":
flags = cobra.ShellCompDirectiveNoFileComp
options = s.getConfigCompletion(params.Cmd[2], params.Args, params.ToComplete)
default:
flags = cobra.ShellCompDirectiveNoFileComp
}
@@ -269,11 +236,11 @@ func (s *DaemonServer) GetCompletion(_ context.Context, params *rpcproto.GetComp
}, nil
}
func (s *DaemonServer) getConfigCompletion(cmd string, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
func (s *DaemonServer) getConfigCompletion(cmd string, args []string, toComplete string) []string {
var options []string
if isValueCompletion := len(args) > 0; isValueCompletion {
if cmd != "set" {
return nil, cobra.ShellCompDirectiveNoFileComp
return nil
}
if meta := s.Config.Meta.Lookup(args[0]); meta != nil {
@@ -289,12 +256,12 @@ func (s *DaemonServer) getConfigCompletion(cmd string, args []string, toComplete
})
}
return options, cobra.ShellCompDirectiveNoFileComp
return options
}
func (s *DaemonServer) ReloadConfig(_ context.Context, _ *proto.Empty) (*proto.Empty, error) {
if _, err := s.Config.Reload(); err != nil {
return nil, status.Errorf(codes.InvalidArgument, "failed to reload configuration: %s", err)
if _, err := s.Config.ReloadAllSources(); err != nil {
return nil, decodeError(err)
}
return &proto.Empty{}, nil
@@ -404,33 +371,56 @@ func (s *DaemonServer) OnPeerStateChanged(p *daemon.Peer, newState, prevState da
})
}
func settingToString(value any) (string, error) {
v := reflect.ValueOf(value)
switch {
case v.Kind() == reflect.Slice:
s := []string{}
for i := 0; i < v.Len(); i++ {
e := v.Index(i)
in := e.Interface()
if tm, ok := in.(encoding.TextMarshaler); ok {
b, err := tm.MarshalText()
if err != nil {
return "", err
}
s = append(s, string(b))
} else {
s = append(s, fmt.Sprint(in))
}
func serializeToString(in any) (string, error) {
if tm, ok := in.(encoding.TextMarshaler); ok {
b, err := tm.MarshalText()
if err != nil {
return "", err
}
return strings.Join(s, ","), nil
case value == nil:
return "", nil
default:
return fmt.Sprintf("%v", value), nil
return string(b), nil
}
return fmt.Sprint(in), nil
}
func settingToValue(val any) (*rpcproto.ConfigValue, error) {
cval := &rpcproto.ConfigValue{}
if val == nil {
return cval, nil
} else if rval := reflect.ValueOf(val); rval.Kind() == reflect.Slice {
for i := 0; i < rval.Len(); i++ {
e := rval.Index(i)
s, err := serializeToString(e.Interface())
if err != nil {
return nil, err
}
cval.List = append(cval.List, s)
}
} else {
cval.Scalar = fmt.Sprint(val)
}
return cval, nil
}
func decodeError(err error) error {
var msErr *mapstructure.Error
if errors.As(err, &msErr) {
sts := status.New(codes.InvalidArgument, "Failed to decode")
for _, err := range msErr.Errors {
sts, _ = sts.WithDetails(&proto.Error{
Message: err,
})
}
return sts.Err()
}
return status.Error(codes.InvalidArgument, err.Error())
}

View File

@@ -29,4 +29,8 @@ message BuildInfo {
message BuildInfos {
BuildInfo client = 1;
BuildInfo daemon = 2;
}
message Error {
string message = 1;
}

View File

@@ -11,6 +11,11 @@ import "common.proto";
import "rpc/event.proto";
import "rpc/invitation.proto";
message ConfigValue {
string scalar = 1;
repeated string list = 2;
}
message GetStatusParams {
string interface = 1;
bytes peer = 2;
@@ -21,7 +26,7 @@ message GetStatusResp {
}
message SetConfigParams {
map<string, string> settings = 1;
map<string, ConfigValue> settings = 1;
}
message GetConfigParams {
@@ -29,7 +34,7 @@ message GetConfigParams {
}
message GetConfigResp {
map<string, string> settings = 1;
map<string, ConfigValue> settings = 1;
}
message AddPeerParams {