diff --git a/core/server/gen/libcore.pb.go b/core/server/gen/libcore.pb.go index 46e5512..de8e0d8 100644 --- a/core/server/gen/libcore.pb.go +++ b/core/server/gen/libcore.pb.go @@ -1357,69 +1357,72 @@ var file_libcore_proto_rawDesc = []byte{ 0x5f, 0x64, 0x68, 0x63, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x44, 0x68, 0x63, 0x70, 0x2a, 0x27, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x10, 0x00, 0x12, 0x0c, - 0x0a, 0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x10, 0x01, 0x32, 0xbc, 0x07, 0x0a, + 0x0a, 0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x10, 0x01, 0x32, 0xe9, 0x07, 0x0a, 0x0e, 0x4c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x2f, 0x0a, 0x04, 0x45, 0x78, 0x69, 0x74, 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, + 0x2d, 0x0a, 0x04, 0x45, 0x78, 0x69, 0x74, 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62, - 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, - 0x12, 0x33, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x12, 0x2e, 0x6c, 0x69, 0x62, - 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x13, - 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x16, - 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, - 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x2f, 0x0a, 0x04, - 0x53, 0x74, 0x6f, 0x70, 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x2d, 0x0a, - 0x04, 0x54, 0x65, 0x73, 0x74, 0x12, 0x10, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, - 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x31, 0x0a, 0x08, - 0x53, 0x74, 0x6f, 0x70, 0x54, 0x65, 0x73, 0x74, 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x6c, 0x69, - 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, - 0x3a, 0x0a, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x11, 0x2e, - 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, - 0x1a, 0x17, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x44, 0x0a, 0x0f, 0x4c, - 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x11, + 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x31, + 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, + 0x72, 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x13, 0x2e, 0x6c, + 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x12, 0x33, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x16, 0x2e, 0x6c, 0x69, 0x62, + 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, + 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x72, 0x72, + 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2d, 0x0a, 0x04, 0x53, 0x74, 0x6f, 0x70, 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, - 0x71, 0x1a, 0x1c, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, - 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22, - 0x00, 0x12, 0x46, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x4c, 0x69, 0x73, - 0x74, 0x12, 0x17, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x65, 0x6f, 0x4c, - 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6c, 0x69, 0x62, - 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x4c, 0x69, 0x73, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x0e, 0x47, 0x65, 0x74, - 0x47, 0x65, 0x6f, 0x53, 0x69, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x17, 0x2e, 0x6c, 0x69, - 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x65, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, - 0x65, 0x74, 0x47, 0x65, 0x6f, 0x53, 0x69, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x11, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, - 0x47, 0x65, 0x6f, 0x49, 0x50, 0x54, 0x6f, 0x53, 0x72, 0x73, 0x12, 0x21, 0x2e, 0x6c, 0x69, 0x62, - 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x47, 0x65, 0x6f, 0x49, - 0x50, 0x54, 0x6f, 0x53, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, - 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, - 0x70, 0x12, 0x4e, 0x0a, 0x13, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x47, 0x65, 0x6f, 0x53, - 0x69, 0x74, 0x65, 0x54, 0x6f, 0x53, 0x72, 0x73, 0x12, 0x23, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x47, 0x65, 0x6f, 0x53, 0x69, 0x74, - 0x65, 0x54, 0x6f, 0x53, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, - 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, - 0x70, 0x12, 0x44, 0x0a, 0x0e, 0x53, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72, - 0x6f, 0x78, 0x79, 0x12, 0x1e, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x65, - 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x40, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x53, 0x79, - 0x73, 0x74, 0x65, 0x6d, 0x44, 0x4e, 0x53, 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x1d, 0x2e, 0x6c, 0x69, 0x62, - 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x44, 0x4e, - 0x53, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0c, 0x53, 0x65, 0x74, - 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x44, 0x4e, 0x53, 0x12, 0x1c, 0x2e, 0x6c, 0x69, 0x62, 0x63, - 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x44, 0x4e, 0x53, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x42, 0x11, 0x5a, 0x0f, 0x67, - 0x72, 0x70, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x6e, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x71, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x72, 0x72, 0x6f, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x39, 0x0a, 0x0b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x12, 0x16, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4c, + 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x6c, + 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x2b, 0x0a, 0x04, 0x54, 0x65, 0x73, 0x74, 0x12, 0x10, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, + 0x72, 0x65, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x11, 0x2e, 0x6c, 0x69, 0x62, + 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x31, 0x0a, + 0x08, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x65, 0x73, 0x74, 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, + 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x6c, + 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x38, 0x0a, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x11, + 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, + 0x71, 0x1a, 0x17, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x42, 0x0a, 0x0f, 0x4c, 0x69, + 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x11, 0x2e, + 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, + 0x1a, 0x1c, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x46, + 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x17, + 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x65, 0x6f, 0x4c, 0x69, 0x73, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, + 0x65, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x47, 0x65, 0x6f, + 0x53, 0x69, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x17, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, + 0x72, 0x65, 0x2e, 0x47, 0x65, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1f, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x47, + 0x65, 0x6f, 0x53, 0x69, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x11, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x47, 0x65, 0x6f, + 0x49, 0x50, 0x54, 0x6f, 0x53, 0x72, 0x73, 0x12, 0x21, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, + 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x54, 0x6f, + 0x53, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62, + 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x4e, + 0x0a, 0x13, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x47, 0x65, 0x6f, 0x53, 0x69, 0x74, 0x65, + 0x54, 0x6f, 0x53, 0x72, 0x73, 0x12, 0x23, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, + 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x47, 0x65, 0x6f, 0x53, 0x69, 0x74, 0x65, 0x54, 0x6f, + 0x53, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62, + 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x44, + 0x0a, 0x0e, 0x53, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72, 0x6f, 0x78, 0x79, + 0x12, 0x1e, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x74, 0x53, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x40, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x44, 0x4e, 0x53, 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x1d, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, + 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x44, 0x4e, 0x53, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0c, 0x53, 0x65, 0x74, 0x53, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x44, 0x4e, 0x53, 0x12, 0x1c, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, + 0x2e, 0x53, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x44, 0x4e, 0x53, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x72, 0x70, 0x63, + 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -1471,34 +1474,36 @@ var file_libcore_proto_depIdxs = []int32{ 9, // 6: libcore.LibcoreService.Update:input_type -> libcore.UpdateReq 4, // 7: libcore.LibcoreService.Start:input_type -> libcore.LoadConfigReq 1, // 8: libcore.LibcoreService.Stop:input_type -> libcore.EmptyReq - 6, // 9: libcore.LibcoreService.Test:input_type -> libcore.TestReq - 1, // 10: libcore.LibcoreService.StopTest:input_type -> libcore.EmptyReq - 1, // 11: libcore.LibcoreService.QueryStats:input_type -> libcore.EmptyReq - 1, // 12: libcore.LibcoreService.ListConnections:input_type -> libcore.EmptyReq - 15, // 13: libcore.LibcoreService.GetGeoIPList:input_type -> libcore.GeoListRequest - 15, // 14: libcore.LibcoreService.GetGeoSiteList:input_type -> libcore.GeoListRequest - 16, // 15: libcore.LibcoreService.CompileGeoIPToSrs:input_type -> libcore.CompileGeoIPToSrsRequest - 17, // 16: libcore.LibcoreService.CompileGeoSiteToSrs:input_type -> libcore.CompileGeoSiteToSrsRequest - 18, // 17: libcore.LibcoreService.SetSystemProxy:input_type -> libcore.SetSystemProxyRequest - 1, // 18: libcore.LibcoreService.GetSystemDNS:input_type -> libcore.EmptyReq - 19, // 19: libcore.LibcoreService.SetSystemDNS:input_type -> libcore.SetSystemDNSRequest - 2, // 20: libcore.LibcoreService.Exit:output_type -> libcore.EmptyResp - 10, // 21: libcore.LibcoreService.Update:output_type -> libcore.UpdateResp - 3, // 22: libcore.LibcoreService.Start:output_type -> libcore.ErrorResp - 3, // 23: libcore.LibcoreService.Stop:output_type -> libcore.ErrorResp - 7, // 24: libcore.LibcoreService.Test:output_type -> libcore.TestResp - 2, // 25: libcore.LibcoreService.StopTest:output_type -> libcore.EmptyResp - 8, // 26: libcore.LibcoreService.QueryStats:output_type -> libcore.QueryStatsResp - 11, // 27: libcore.LibcoreService.ListConnections:output_type -> libcore.ListConnectionsResp - 13, // 28: libcore.LibcoreService.GetGeoIPList:output_type -> libcore.GetGeoIPListResponse - 14, // 29: libcore.LibcoreService.GetGeoSiteList:output_type -> libcore.GetGeoSiteListResponse - 2, // 30: libcore.LibcoreService.CompileGeoIPToSrs:output_type -> libcore.EmptyResp - 2, // 31: libcore.LibcoreService.CompileGeoSiteToSrs:output_type -> libcore.EmptyResp - 2, // 32: libcore.LibcoreService.SetSystemProxy:output_type -> libcore.EmptyResp - 20, // 33: libcore.LibcoreService.GetSystemDNS:output_type -> libcore.GetSystemDNSResponse - 2, // 34: libcore.LibcoreService.SetSystemDNS:output_type -> libcore.EmptyResp - 20, // [20:35] is the sub-list for method output_type - 5, // [5:20] is the sub-list for method input_type + 4, // 9: libcore.LibcoreService.CheckConfig:input_type -> libcore.LoadConfigReq + 6, // 10: libcore.LibcoreService.Test:input_type -> libcore.TestReq + 1, // 11: libcore.LibcoreService.StopTest:input_type -> libcore.EmptyReq + 1, // 12: libcore.LibcoreService.QueryStats:input_type -> libcore.EmptyReq + 1, // 13: libcore.LibcoreService.ListConnections:input_type -> libcore.EmptyReq + 15, // 14: libcore.LibcoreService.GetGeoIPList:input_type -> libcore.GeoListRequest + 15, // 15: libcore.LibcoreService.GetGeoSiteList:input_type -> libcore.GeoListRequest + 16, // 16: libcore.LibcoreService.CompileGeoIPToSrs:input_type -> libcore.CompileGeoIPToSrsRequest + 17, // 17: libcore.LibcoreService.CompileGeoSiteToSrs:input_type -> libcore.CompileGeoSiteToSrsRequest + 18, // 18: libcore.LibcoreService.SetSystemProxy:input_type -> libcore.SetSystemProxyRequest + 1, // 19: libcore.LibcoreService.GetSystemDNS:input_type -> libcore.EmptyReq + 19, // 20: libcore.LibcoreService.SetSystemDNS:input_type -> libcore.SetSystemDNSRequest + 2, // 21: libcore.LibcoreService.Exit:output_type -> libcore.EmptyResp + 10, // 22: libcore.LibcoreService.Update:output_type -> libcore.UpdateResp + 3, // 23: libcore.LibcoreService.Start:output_type -> libcore.ErrorResp + 3, // 24: libcore.LibcoreService.Stop:output_type -> libcore.ErrorResp + 3, // 25: libcore.LibcoreService.CheckConfig:output_type -> libcore.ErrorResp + 7, // 26: libcore.LibcoreService.Test:output_type -> libcore.TestResp + 2, // 27: libcore.LibcoreService.StopTest:output_type -> libcore.EmptyResp + 8, // 28: libcore.LibcoreService.QueryStats:output_type -> libcore.QueryStatsResp + 11, // 29: libcore.LibcoreService.ListConnections:output_type -> libcore.ListConnectionsResp + 13, // 30: libcore.LibcoreService.GetGeoIPList:output_type -> libcore.GetGeoIPListResponse + 14, // 31: libcore.LibcoreService.GetGeoSiteList:output_type -> libcore.GetGeoSiteListResponse + 2, // 32: libcore.LibcoreService.CompileGeoIPToSrs:output_type -> libcore.EmptyResp + 2, // 33: libcore.LibcoreService.CompileGeoSiteToSrs:output_type -> libcore.EmptyResp + 2, // 34: libcore.LibcoreService.SetSystemProxy:output_type -> libcore.EmptyResp + 20, // 35: libcore.LibcoreService.GetSystemDNS:output_type -> libcore.GetSystemDNSResponse + 2, // 36: libcore.LibcoreService.SetSystemDNS:output_type -> libcore.EmptyResp + 21, // [21:37] is the sub-list for method output_type + 5, // [5:21] 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 diff --git a/core/server/gen/libcore.proto b/core/server/gen/libcore.proto index cfc7040..e0b7186 100644 --- a/core/server/gen/libcore.proto +++ b/core/server/gen/libcore.proto @@ -4,15 +4,16 @@ package libcore; option go_package = "grpc_server/gen"; service LibcoreService { - rpc Exit(EmptyReq) returns (EmptyResp) {} - rpc Update(UpdateReq) returns (UpdateResp) {} + rpc Exit(EmptyReq) returns (EmptyResp); + rpc Update(UpdateReq) returns (UpdateResp); // - rpc Start(LoadConfigReq) returns (ErrorResp) {} - rpc Stop(EmptyReq) returns (ErrorResp) {} - rpc Test(TestReq) returns (TestResp) {} + rpc Start(LoadConfigReq) returns (ErrorResp); + rpc Stop(EmptyReq) returns (ErrorResp); + rpc CheckConfig(LoadConfigReq) returns (ErrorResp); + rpc Test(TestReq) returns (TestResp); rpc StopTest(EmptyReq) returns (EmptyResp); - rpc QueryStats(EmptyReq) returns (QueryStatsResp) {} - rpc ListConnections(EmptyReq) returns (ListConnectionsResp) {} + rpc QueryStats(EmptyReq) returns (QueryStatsResp); + rpc ListConnections(EmptyReq) returns (ListConnectionsResp); // rpc GetGeoIPList(GeoListRequest) returns (GetGeoIPListResponse); rpc GetGeoSiteList(GeoListRequest) returns (GetGeoSiteListResponse); diff --git a/core/server/gen/libcore_grpc.pb.go b/core/server/gen/libcore_grpc.pb.go index 812515e..a741845 100644 --- a/core/server/gen/libcore_grpc.pb.go +++ b/core/server/gen/libcore_grpc.pb.go @@ -23,6 +23,7 @@ const ( LibcoreService_Update_FullMethodName = "/libcore.LibcoreService/Update" LibcoreService_Start_FullMethodName = "/libcore.LibcoreService/Start" LibcoreService_Stop_FullMethodName = "/libcore.LibcoreService/Stop" + LibcoreService_CheckConfig_FullMethodName = "/libcore.LibcoreService/CheckConfig" LibcoreService_Test_FullMethodName = "/libcore.LibcoreService/Test" LibcoreService_StopTest_FullMethodName = "/libcore.LibcoreService/StopTest" LibcoreService_QueryStats_FullMethodName = "/libcore.LibcoreService/QueryStats" @@ -44,6 +45,7 @@ type LibcoreServiceClient interface { Update(ctx context.Context, in *UpdateReq, opts ...grpc.CallOption) (*UpdateResp, error) Start(ctx context.Context, in *LoadConfigReq, opts ...grpc.CallOption) (*ErrorResp, error) Stop(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*ErrorResp, error) + CheckConfig(ctx context.Context, in *LoadConfigReq, opts ...grpc.CallOption) (*ErrorResp, error) Test(ctx context.Context, in *TestReq, opts ...grpc.CallOption) (*TestResp, error) StopTest(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*EmptyResp, error) QueryStats(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*QueryStatsResp, error) @@ -105,6 +107,16 @@ func (c *libcoreServiceClient) Stop(ctx context.Context, in *EmptyReq, opts ...g return out, nil } +func (c *libcoreServiceClient) CheckConfig(ctx context.Context, in *LoadConfigReq, opts ...grpc.CallOption) (*ErrorResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ErrorResp) + err := c.cc.Invoke(ctx, LibcoreService_CheckConfig_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *libcoreServiceClient) Test(ctx context.Context, in *TestReq, opts ...grpc.CallOption) (*TestResp, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(TestResp) @@ -223,6 +235,7 @@ type LibcoreServiceServer interface { Update(context.Context, *UpdateReq) (*UpdateResp, error) Start(context.Context, *LoadConfigReq) (*ErrorResp, error) Stop(context.Context, *EmptyReq) (*ErrorResp, error) + CheckConfig(context.Context, *LoadConfigReq) (*ErrorResp, error) Test(context.Context, *TestReq) (*TestResp, error) StopTest(context.Context, *EmptyReq) (*EmptyResp, error) QueryStats(context.Context, *EmptyReq) (*QueryStatsResp, error) @@ -256,6 +269,9 @@ func (UnimplementedLibcoreServiceServer) Start(context.Context, *LoadConfigReq) func (UnimplementedLibcoreServiceServer) Stop(context.Context, *EmptyReq) (*ErrorResp, error) { return nil, status.Errorf(codes.Unimplemented, "method Stop not implemented") } +func (UnimplementedLibcoreServiceServer) CheckConfig(context.Context, *LoadConfigReq) (*ErrorResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method CheckConfig not implemented") +} func (UnimplementedLibcoreServiceServer) Test(context.Context, *TestReq) (*TestResp, error) { return nil, status.Errorf(codes.Unimplemented, "method Test not implemented") } @@ -382,6 +398,24 @@ func _LibcoreService_Stop_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _LibcoreService_CheckConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LoadConfigReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LibcoreServiceServer).CheckConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: LibcoreService_CheckConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LibcoreServiceServer).CheckConfig(ctx, req.(*LoadConfigReq)) + } + return interceptor(ctx, in, info, handler) +} + func _LibcoreService_Test_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(TestReq) if err := dec(in); err != nil { @@ -603,6 +637,10 @@ var LibcoreService_ServiceDesc = grpc.ServiceDesc{ MethodName: "Stop", Handler: _LibcoreService_Stop_Handler, }, + { + MethodName: "CheckConfig", + Handler: _LibcoreService_CheckConfig_Handler, + }, { MethodName: "Test", Handler: _LibcoreService_Test_Handler, diff --git a/core/server/internal/boxmain/cmd_check.go b/core/server/internal/boxmain/cmd_check.go index 523180f..c34d7df 100644 --- a/core/server/internal/boxmain/cmd_check.go +++ b/core/server/internal/boxmain/cmd_check.go @@ -2,35 +2,19 @@ package boxmain import ( "context" + "github.com/sagernet/sing-box/include" - "github.com/sagernet/sing-box/log" "nekobox_core/internal/boxbox" - - "github.com/spf13/cobra" ) -var commandCheck = &cobra.Command{ - Use: "check", - Short: "Check configuration", - Run: func(cmd *cobra.Command, args []string) { - err := check() - if err != nil { - log.Fatal(err) - } - }, - Args: cobra.NoArgs, -} - -func init() { - mainCommand.AddCommand(commandCheck) -} - -func check() error { - options, err := parseConfig(nil) +func Check(content []byte) error { + ctx := context.Background() + ctx = boxbox.Context(ctx, include.InboundRegistry(), include.OutboundRegistry(), include.EndpointRegistry()) + options, err := parseConfig(ctx, content) if err != nil { return err } - ctx, cancel := context.WithCancel(context.Background()) + ctx, cancel := context.WithCancel(ctx) instance, err := boxbox.New(boxbox.Options{ Context: ctx, Options: *options, diff --git a/core/server/internal/boxmain/cmd_run.go b/core/server/internal/boxmain/cmd_run.go index 60318c9..5bd6da9 100644 --- a/core/server/internal/boxmain/cmd_run.go +++ b/core/server/internal/boxmain/cmd_run.go @@ -39,11 +39,11 @@ type OptionsEntry struct { options option.Options } -func parseConfig(configContent []byte) (*option.Options, error) { +func parseConfig(ctx context.Context, configContent []byte) (*option.Options, error) { var ( err error ) - options, err := json.UnmarshalExtendedContext[option.Options](globalCtx, configContent) + options, err := json.UnmarshalExtendedContext[option.Options](ctx, configContent) if err != nil { return nil, E.Cause(err, "decode config at ", string(configContent)) } @@ -53,7 +53,7 @@ func parseConfig(configContent []byte) (*option.Options, error) { func Create(configContent []byte) (*boxbox.Box, context.CancelFunc, error) { globalCtx = context.Background() globalCtx = boxbox.Context(globalCtx, include.InboundRegistry(), include.OutboundRegistry(), include.EndpointRegistry()) - options, err := parseConfig(configContent) + options, err := parseConfig(globalCtx, configContent) if err != nil { return nil, nil, err } @@ -98,7 +98,7 @@ func Create(configContent []byte) (*boxbox.Box, context.CancelFunc, error) { func run() error { osSignals := make(chan os.Signal, 1) - signal.Notify(osSignals, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP) + signal.Notify(osSignals, os.Interrupt, syscall.SIGTERM) defer signal.Stop(osSignals) for { instance, cancel, err := Create([]byte{}) @@ -108,13 +108,6 @@ func run() error { runtimeDebug.FreeOSMemory() for { osSignal := <-osSignals - if osSignal == syscall.SIGHUP { - err = check() - if err != nil { - log.Error(E.Cause(err, "reload service")) - continue - } - } cancel() closeCtx, closed := context.WithCancel(context.Background()) go closeMonitor(closeCtx) diff --git a/core/server/server.go b/core/server/server.go index b9c501e..203911f 100644 --- a/core/server/server.go +++ b/core/server/server.go @@ -103,6 +103,16 @@ func (s *server) Stop(ctx context.Context, in *gen.EmptyReq) (out *gen.ErrorResp return } +func (s *server) CheckConfig(ctx context.Context, in *gen.LoadConfigReq) (*gen.ErrorResp, error) { + err := boxmain.Check([]byte(in.CoreConfig)) + if err != nil { + return &gen.ErrorResp{ + Error: err.Error(), + }, nil + } + return &gen.ErrorResp{}, nil +} + func (s *server) Test(ctx context.Context, in *gen.TestReq) (*gen.TestResp, error) { var testInstance *boxbox.Box var cancel context.CancelFunc diff --git a/include/api/gRPC.h b/include/api/gRPC.h index fdfd9e8..d7b5a09 100644 --- a/include/api/gRPC.h +++ b/include/api/gRPC.h @@ -44,6 +44,8 @@ namespace NekoGui_rpc { libcore::ListConnectionsResp ListConnections(bool *rpcOK) const; + QString CheckConfig(bool *rpcOK, const QString& config) const; + private: std::function()> make_grpc_channel; std::unique_ptr default_grpc_channel; diff --git a/include/configs/ConfigBuilder.hpp b/include/configs/ConfigBuilder.hpp index c76b7ee..a6a74d0 100644 --- a/include/configs/ConfigBuilder.hpp +++ b/include/configs/ConfigBuilder.hpp @@ -41,7 +41,9 @@ namespace NekoGui { QJsonArray endpoints; }; - std::shared_ptr BuildTestConfig(QList> profiles); + bool IsValid(const std::shared_ptr &ent); + + std::shared_ptr BuildTestConfig(const QList>& profiles); std::shared_ptr BuildConfig(const std::shared_ptr &ent, bool forTest, bool forExport, int chainID = 0); diff --git a/include/configs/proxy/AbstractBean.hpp b/include/configs/proxy/AbstractBean.hpp index 2600a00..b46b369 100644 --- a/include/configs/proxy/AbstractBean.hpp +++ b/include/configs/proxy/AbstractBean.hpp @@ -45,9 +45,6 @@ namespace NekoGui_fmt { virtual QString DisplayType() { return {}; }; virtual QString DisplayTypeAndName(); - - virtual bool IsValid(); - // virtual CoreObjOutboundBuildResult BuildCoreObjSingBox() { return {}; }; diff --git a/include/configs/proxy/TrojanVLESSBean.hpp b/include/configs/proxy/TrojanVLESSBean.hpp index 68d3e79..2e49d0a 100644 --- a/include/configs/proxy/TrojanVLESSBean.hpp +++ b/include/configs/proxy/TrojanVLESSBean.hpp @@ -23,11 +23,6 @@ namespace NekoGui_fmt { _add(new configItem("stream", dynamic_cast(stream.get()), itemType::jsonStore)); }; - bool IsValid() { - if (stream == nullptr) return true; - return stream->isValid(); - } - QString DisplayType() override { return proxy_type == proxy_VLESS ? "VLESS" : "Trojan"; }; CoreObjOutboundBuildResult BuildCoreObjSingBox() override; diff --git a/include/configs/proxy/V2RayStreamSettings.hpp b/include/configs/proxy/V2RayStreamSettings.hpp index dc09060..1d149d6 100644 --- a/include/configs/proxy/V2RayStreamSettings.hpp +++ b/include/configs/proxy/V2RayStreamSettings.hpp @@ -99,13 +99,6 @@ namespace NekoGui_fmt { *ok = true; return res; } - - inline bool isValid() - { - bool isNetworkValid = Preset::SingBox::V2RAYTransports.contains(network); - bool isRealityValid = security != "reality" || !QByteArray::fromBase64(reality_pbk.toUtf8(), QByteArray::AbortOnBase64DecodingErrors).isEmpty(); - return isNetworkValid && isRealityValid; - } }; inline V2rayStreamSettings *GetStreamSettings(AbstractBean *bean) { diff --git a/include/configs/proxy/VMessBean.hpp b/include/configs/proxy/VMessBean.hpp index 8513dec..cfaa232 100644 --- a/include/configs/proxy/VMessBean.hpp +++ b/include/configs/proxy/VMessBean.hpp @@ -20,11 +20,6 @@ namespace NekoGui_fmt { _add(new configItem("stream", dynamic_cast(stream.get()), itemType::jsonStore)); }; - bool IsValid() { - if (stream == nullptr) return true; - return stream->isValid(); - } - QString DisplayType() override { return "VMess"; }; CoreObjOutboundBuildResult BuildCoreObjSingBox() override; diff --git a/src/api/gRPC.cpp b/src/api/gRPC.cpp index c5fabcc..d7bf37a 100644 --- a/src/api/gRPC.cpp +++ b/src/api/gRPC.cpp @@ -419,5 +419,22 @@ namespace NekoGui_rpc { } } + QString Client::CheckConfig(bool* rpcOK, const QString& config) const + { + libcore::LoadConfigReq req; + libcore::ErrorResp resp; + req.set_core_config(config.toStdString()); + auto status = default_grpc_channel->Call("CheckConfig", req, &resp); + if (status == QNetworkReply::NoError) + { + *rpcOK = true; + return {resp.error().c_str()}; + } else + { + NOT_OK + return qt_error_string(status); + } + + } } // namespace NekoGui_rpc diff --git a/src/configs/ConfigBuilder.cpp b/src/configs/ConfigBuilder.cpp index f468539..f5a60bd 100644 --- a/src/configs/ConfigBuilder.cpp +++ b/src/configs/ConfigBuilder.cpp @@ -66,7 +66,53 @@ namespace NekoGui { return result; } - std::shared_ptr BuildTestConfig(QList> profiles) { + bool IsValid(const std::shared_ptr& ent) + { + if (ent->type == "chain") + { + for (int eId : ent->ChainBean()->list) + { + auto e = profileManager->GetProfile(eId); + if (e == nullptr) + { + MW_show_log("Null ent in validator"); + return false; + } + if (!IsValid(e)) + { + MW_show_log("Invalid ent in chain: ID=" + QString::number(eId)); + return false; + } + } + return true; + } + QJsonObject conf; + if (ent->type == "custom" && ent->CustomBean()->core == "internal-full") + { + conf = QString2QJsonObject(ent->CustomBean()->config_simple); + } else + { + auto out = ent->bean->BuildCoreObjSingBox(); + auto outArr = QJsonArray{out.outbound}; + conf = { + {"outbounds", outArr}, + }; + } + bool ok; + auto resp = NekoGui_rpc::defaultClient->CheckConfig(&ok, QJsonObject2QString(conf, true)); + if (!ok) + { + MW_show_log("Failed to contact the Core: " + resp); + return false; + } + if (resp.isEmpty()) return true; + // else + MW_show_log("Invalid ent " + ent->bean->name + ": " + resp); + return false; + } + + + std::shared_ptr BuildTestConfig(const QList>& profiles) { auto results = std::make_shared(); QJsonArray outboundArray = { @@ -80,7 +126,7 @@ namespace NekoGui { QJsonArray directDomainArray; for (const auto &item: profiles) { - if (!item->bean->IsValid()) { + if (!IsValid(item)) { MW_show_log("Skipping invalid config: " + item->bean->name); item->latency = -1; continue; diff --git a/src/configs/proxy/AbstractBean.cpp b/src/configs/proxy/AbstractBean.cpp index ae1efc1..de166a1 100644 --- a/src/configs/proxy/AbstractBean.cpp +++ b/src/configs/proxy/AbstractBean.cpp @@ -44,10 +44,6 @@ namespace NekoGui_fmt { return QString("[%1] %2").arg(DisplayType(), DisplayName()); } - bool AbstractBean::IsValid() { - return true; - } - void AbstractBean::ResolveDomainToIP(const std::function &onFinished) { bool noResolve = false; if (dynamic_cast(this) != nullptr) noResolve = true; diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index e0c886b..9bd5ff5 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -1646,7 +1646,7 @@ void MainWindow::on_menu_remove_invalid_triggered() { auto currentGroup = NekoGui::profileManager->GetGroup(NekoGui::dataStore->current_group); if (currentGroup == nullptr) return; for (const auto &profile : currentGroup->Profiles()) { - if (!profile->bean->IsValid()) out_del += profile; + if (!IsValid(profile)) out_del += profile; } int remove_display_count = 0;