improve URL test responsiveness

This commit is contained in:
Nova 2025-05-16 05:24:38 +03:30
parent 6d6794b77e
commit e073faf6ed
8 changed files with 320 additions and 110 deletions

View File

@ -1241,6 +1241,50 @@ func (x *QuerySpeedTestResponse) GetIsRunning() bool {
return false
}
type QueryURLTestResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Results []*URLTestResp `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *QueryURLTestResponse) Reset() {
*x = QueryURLTestResponse{}
mi := &file_libcore_proto_msgTypes[21]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *QueryURLTestResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*QueryURLTestResponse) ProtoMessage() {}
func (x *QueryURLTestResponse) ProtoReflect() protoreflect.Message {
mi := &file_libcore_proto_msgTypes[21]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use QueryURLTestResponse.ProtoReflect.Descriptor instead.
func (*QueryURLTestResponse) Descriptor() ([]byte, []int) {
return file_libcore_proto_rawDescGZIP(), []int{21}
}
func (x *QueryURLTestResponse) GetResults() []*URLTestResp {
if x != nil {
return x.Results
}
return nil
}
var File_libcore_proto protoreflect.FileDescriptor
var file_libcore_proto_rawDesc = string([]byte{
@ -1398,73 +1442,81 @@ var file_libcore_proto_rawDesc = string([]byte{
0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x70, 0x65, 0x65, 0x64, 0x54, 0x65, 0x73,
0x74, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12,
0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20,
0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x32, 0xfa,
0x07, 0x0a, 0x0e, 0x4c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x12, 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,
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, 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,
0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x22, 0x46,
0x0a, 0x14, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x52, 0x4c, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74,
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72,
0x65, 0x2e, 0x55, 0x52, 0x4c, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x52, 0x07, 0x72,
0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x32, 0xbc, 0x08, 0x0a, 0x0e, 0x4c, 0x69, 0x62, 0x63, 0x6f,
0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 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, 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, 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, 0x40, 0x0a, 0x0c, 0x51, 0x75, 0x65, 0x72, 0x79,
0x55, 0x52, 0x4c, 0x54, 0x65, 0x73, 0x74, 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, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x52, 0x4c, 0x54, 0x65, 0x73,
0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 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, 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, 0x12,
0x40, 0x0a, 0x0c, 0x49, 0x73, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x64, 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, 0x49, 0x73, 0x50,
0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x42, 0x0a, 0x09, 0x53, 0x70, 0x65, 0x65, 0x64, 0x54, 0x65, 0x73, 0x74, 0x12, 0x19,
0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x70, 0x65, 0x65, 0x64, 0x54, 0x65,
0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6c, 0x69, 0x62, 0x63,
0x6f, 0x72, 0x65, 0x2e, 0x53, 0x70, 0x65, 0x65, 0x64, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x70,
0x65, 0x65, 0x64, 0x54, 0x65, 0x73, 0x74, 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72,
0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x1f, 0x2e, 0x6c, 0x69, 0x62,
0x63, 0x6f, 0x72, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x70, 0x65, 0x65, 0x64, 0x54,
0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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,
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, 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, 0x12, 0x40, 0x0a, 0x0c, 0x49, 0x73, 0x50,
0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x64, 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, 0x49, 0x73, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65,
0x67, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x09, 0x53,
0x70, 0x65, 0x65, 0x64, 0x54, 0x65, 0x73, 0x74, 0x12, 0x19, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f,
0x72, 0x65, 0x2e, 0x53, 0x70, 0x65, 0x65, 0x64, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x70,
0x65, 0x65, 0x64, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x44, 0x0a, 0x0e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x70, 0x65, 0x65, 0x64, 0x54, 0x65, 0x73,
0x74, 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74,
0x79, 0x52, 0x65, 0x71, 0x1a, 0x1f, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x51,
0x75, 0x65, 0x72, 0x79, 0x53, 0x70, 0x65, 0x65, 0x64, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 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 (
@ -1479,7 +1531,7 @@ func file_libcore_proto_rawDescGZIP() []byte {
return file_libcore_proto_rawDescData
}
var file_libcore_proto_msgTypes = make([]protoimpl.MessageInfo, 23)
var file_libcore_proto_msgTypes = make([]protoimpl.MessageInfo, 24)
var file_libcore_proto_goTypes = []any{
(*EmptyReq)(nil), // 0: libcore.EmptyReq
(*EmptyResp)(nil), // 1: libcore.EmptyResp
@ -1502,53 +1554,57 @@ var file_libcore_proto_goTypes = []any{
(*SpeedTestResult)(nil), // 18: libcore.SpeedTestResult
(*SpeedTestResponse)(nil), // 19: libcore.SpeedTestResponse
(*QuerySpeedTestResponse)(nil), // 20: libcore.QuerySpeedTestResponse
nil, // 21: libcore.QueryStatsResp.UpsEntry
nil, // 22: libcore.QueryStatsResp.DownsEntry
(*QueryURLTestResponse)(nil), // 21: libcore.QueryURLTestResponse
nil, // 22: libcore.QueryStatsResp.UpsEntry
nil, // 23: libcore.QueryStatsResp.DownsEntry
}
var file_libcore_proto_depIdxs = []int32{
4, // 0: libcore.TestResp.results:type_name -> libcore.URLTestResp
21, // 1: libcore.QueryStatsResp.ups:type_name -> libcore.QueryStatsResp.UpsEntry
22, // 2: libcore.QueryStatsResp.downs:type_name -> libcore.QueryStatsResp.DownsEntry
22, // 1: libcore.QueryStatsResp.ups:type_name -> libcore.QueryStatsResp.UpsEntry
23, // 2: libcore.QueryStatsResp.downs:type_name -> libcore.QueryStatsResp.DownsEntry
9, // 3: libcore.ListConnectionsResp.connections:type_name -> libcore.ConnectionMetaData
18, // 4: libcore.SpeedTestResponse.results:type_name -> libcore.SpeedTestResult
18, // 5: libcore.QuerySpeedTestResponse.result:type_name -> libcore.SpeedTestResult
0, // 6: libcore.LibcoreService.Exit:input_type -> libcore.EmptyReq
3, // 7: libcore.LibcoreService.Start:input_type -> libcore.LoadConfigReq
0, // 8: libcore.LibcoreService.Stop:input_type -> libcore.EmptyReq
3, // 9: libcore.LibcoreService.CheckConfig:input_type -> libcore.LoadConfigReq
5, // 10: libcore.LibcoreService.Test:input_type -> libcore.TestReq
0, // 11: libcore.LibcoreService.StopTest:input_type -> libcore.EmptyReq
0, // 12: libcore.LibcoreService.QueryStats:input_type -> libcore.EmptyReq
0, // 13: libcore.LibcoreService.ListConnections:input_type -> libcore.EmptyReq
12, // 14: libcore.LibcoreService.GetGeoIPList:input_type -> libcore.GeoListRequest
12, // 15: libcore.LibcoreService.GetGeoSiteList:input_type -> libcore.GeoListRequest
13, // 16: libcore.LibcoreService.CompileGeoIPToSrs:input_type -> libcore.CompileGeoIPToSrsRequest
14, // 17: libcore.LibcoreService.CompileGeoSiteToSrs:input_type -> libcore.CompileGeoSiteToSrsRequest
15, // 18: libcore.LibcoreService.SetSystemDNS:input_type -> libcore.SetSystemDNSRequest
0, // 19: libcore.LibcoreService.IsPrivileged:input_type -> libcore.EmptyReq
17, // 20: libcore.LibcoreService.SpeedTest:input_type -> libcore.SpeedTestRequest
0, // 21: libcore.LibcoreService.QuerySpeedTest:input_type -> libcore.EmptyReq
1, // 22: libcore.LibcoreService.Exit:output_type -> libcore.EmptyResp
2, // 23: libcore.LibcoreService.Start:output_type -> libcore.ErrorResp
2, // 24: libcore.LibcoreService.Stop:output_type -> libcore.ErrorResp
2, // 25: libcore.LibcoreService.CheckConfig:output_type -> libcore.ErrorResp
6, // 26: libcore.LibcoreService.Test:output_type -> libcore.TestResp
1, // 27: libcore.LibcoreService.StopTest:output_type -> libcore.EmptyResp
7, // 28: libcore.LibcoreService.QueryStats:output_type -> libcore.QueryStatsResp
8, // 29: libcore.LibcoreService.ListConnections:output_type -> libcore.ListConnectionsResp
10, // 30: libcore.LibcoreService.GetGeoIPList:output_type -> libcore.GetGeoIPListResponse
11, // 31: libcore.LibcoreService.GetGeoSiteList:output_type -> libcore.GetGeoSiteListResponse
1, // 32: libcore.LibcoreService.CompileGeoIPToSrs:output_type -> libcore.EmptyResp
1, // 33: libcore.LibcoreService.CompileGeoSiteToSrs:output_type -> libcore.EmptyResp
1, // 34: libcore.LibcoreService.SetSystemDNS:output_type -> libcore.EmptyResp
16, // 35: libcore.LibcoreService.IsPrivileged:output_type -> libcore.IsPrivilegedResponse
19, // 36: libcore.LibcoreService.SpeedTest:output_type -> libcore.SpeedTestResponse
20, // 37: libcore.LibcoreService.QuerySpeedTest:output_type -> libcore.QuerySpeedTestResponse
22, // [22:38] is the sub-list for method output_type
6, // [6:22] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
6, // [6:6] is the sub-list for extension extendee
0, // [0:6] is the sub-list for field type_name
4, // 6: libcore.QueryURLTestResponse.results:type_name -> libcore.URLTestResp
0, // 7: libcore.LibcoreService.Exit:input_type -> libcore.EmptyReq
3, // 8: libcore.LibcoreService.Start:input_type -> libcore.LoadConfigReq
0, // 9: libcore.LibcoreService.Stop:input_type -> libcore.EmptyReq
3, // 10: libcore.LibcoreService.CheckConfig:input_type -> libcore.LoadConfigReq
5, // 11: libcore.LibcoreService.Test:input_type -> libcore.TestReq
0, // 12: libcore.LibcoreService.StopTest:input_type -> libcore.EmptyReq
0, // 13: libcore.LibcoreService.QueryURLTest:input_type -> libcore.EmptyReq
0, // 14: libcore.LibcoreService.QueryStats:input_type -> libcore.EmptyReq
0, // 15: libcore.LibcoreService.ListConnections:input_type -> libcore.EmptyReq
12, // 16: libcore.LibcoreService.GetGeoIPList:input_type -> libcore.GeoListRequest
12, // 17: libcore.LibcoreService.GetGeoSiteList:input_type -> libcore.GeoListRequest
13, // 18: libcore.LibcoreService.CompileGeoIPToSrs:input_type -> libcore.CompileGeoIPToSrsRequest
14, // 19: libcore.LibcoreService.CompileGeoSiteToSrs:input_type -> libcore.CompileGeoSiteToSrsRequest
15, // 20: libcore.LibcoreService.SetSystemDNS:input_type -> libcore.SetSystemDNSRequest
0, // 21: libcore.LibcoreService.IsPrivileged:input_type -> libcore.EmptyReq
17, // 22: libcore.LibcoreService.SpeedTest:input_type -> libcore.SpeedTestRequest
0, // 23: libcore.LibcoreService.QuerySpeedTest:input_type -> libcore.EmptyReq
1, // 24: libcore.LibcoreService.Exit:output_type -> libcore.EmptyResp
2, // 25: libcore.LibcoreService.Start:output_type -> libcore.ErrorResp
2, // 26: libcore.LibcoreService.Stop:output_type -> libcore.ErrorResp
2, // 27: libcore.LibcoreService.CheckConfig:output_type -> libcore.ErrorResp
6, // 28: libcore.LibcoreService.Test:output_type -> libcore.TestResp
1, // 29: libcore.LibcoreService.StopTest:output_type -> libcore.EmptyResp
21, // 30: libcore.LibcoreService.QueryURLTest:output_type -> libcore.QueryURLTestResponse
7, // 31: libcore.LibcoreService.QueryStats:output_type -> libcore.QueryStatsResp
8, // 32: libcore.LibcoreService.ListConnections:output_type -> libcore.ListConnectionsResp
10, // 33: libcore.LibcoreService.GetGeoIPList:output_type -> libcore.GetGeoIPListResponse
11, // 34: libcore.LibcoreService.GetGeoSiteList:output_type -> libcore.GetGeoSiteListResponse
1, // 35: libcore.LibcoreService.CompileGeoIPToSrs:output_type -> libcore.EmptyResp
1, // 36: libcore.LibcoreService.CompileGeoSiteToSrs:output_type -> libcore.EmptyResp
1, // 37: libcore.LibcoreService.SetSystemDNS:output_type -> libcore.EmptyResp
16, // 38: libcore.LibcoreService.IsPrivileged:output_type -> libcore.IsPrivilegedResponse
19, // 39: libcore.LibcoreService.SpeedTest:output_type -> libcore.SpeedTestResponse
20, // 40: libcore.LibcoreService.QuerySpeedTest:output_type -> libcore.QuerySpeedTestResponse
24, // [24:41] is the sub-list for method output_type
7, // [7:24] 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_libcore_proto_init() }
@ -1562,7 +1618,7 @@ func file_libcore_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_libcore_proto_rawDesc), len(file_libcore_proto_rawDesc)),
NumEnums: 0,
NumMessages: 23,
NumMessages: 24,
NumExtensions: 0,
NumServices: 1,
},

View File

@ -11,6 +11,7 @@ service LibcoreService {
rpc CheckConfig(LoadConfigReq) returns (ErrorResp);
rpc Test(TestReq) returns (TestResp);
rpc StopTest(EmptyReq) returns (EmptyResp);
rpc QueryURLTest(EmptyReq) returns (QueryURLTestResponse);
rpc QueryStats(EmptyReq) returns (QueryStatsResp);
rpc ListConnections(EmptyReq) returns (ListConnectionsResp);
//
@ -144,4 +145,8 @@ message SpeedTestResponse {
message QuerySpeedTestResponse {
SpeedTestResult result = 1;
bool is_running = 2;
}
message QueryURLTestResponse {
repeated URLTestResp results = 1;
}

View File

@ -25,6 +25,7 @@ const (
LibcoreService_CheckConfig_FullMethodName = "/libcore.LibcoreService/CheckConfig"
LibcoreService_Test_FullMethodName = "/libcore.LibcoreService/Test"
LibcoreService_StopTest_FullMethodName = "/libcore.LibcoreService/StopTest"
LibcoreService_QueryURLTest_FullMethodName = "/libcore.LibcoreService/QueryURLTest"
LibcoreService_QueryStats_FullMethodName = "/libcore.LibcoreService/QueryStats"
LibcoreService_ListConnections_FullMethodName = "/libcore.LibcoreService/ListConnections"
LibcoreService_GetGeoIPList_FullMethodName = "/libcore.LibcoreService/GetGeoIPList"
@ -47,6 +48,7 @@ type LibcoreServiceClient interface {
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)
QueryURLTest(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*QueryURLTestResponse, error)
QueryStats(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*QueryStatsResp, error)
ListConnections(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*ListConnectionsResp, error)
GetGeoIPList(ctx context.Context, in *GeoListRequest, opts ...grpc.CallOption) (*GetGeoIPListResponse, error)
@ -127,6 +129,16 @@ func (c *libcoreServiceClient) StopTest(ctx context.Context, in *EmptyReq, opts
return out, nil
}
func (c *libcoreServiceClient) QueryURLTest(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*QueryURLTestResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryURLTestResponse)
err := c.cc.Invoke(ctx, LibcoreService_QueryURLTest_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *libcoreServiceClient) QueryStats(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*QueryStatsResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryStatsResp)
@ -237,6 +249,7 @@ type LibcoreServiceServer interface {
CheckConfig(context.Context, *LoadConfigReq) (*ErrorResp, error)
Test(context.Context, *TestReq) (*TestResp, error)
StopTest(context.Context, *EmptyReq) (*EmptyResp, error)
QueryURLTest(context.Context, *EmptyReq) (*QueryURLTestResponse, error)
QueryStats(context.Context, *EmptyReq) (*QueryStatsResp, error)
ListConnections(context.Context, *EmptyReq) (*ListConnectionsResp, error)
GetGeoIPList(context.Context, *GeoListRequest) (*GetGeoIPListResponse, error)
@ -275,6 +288,9 @@ func (UnimplementedLibcoreServiceServer) Test(context.Context, *TestReq) (*TestR
func (UnimplementedLibcoreServiceServer) StopTest(context.Context, *EmptyReq) (*EmptyResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method StopTest not implemented")
}
func (UnimplementedLibcoreServiceServer) QueryURLTest(context.Context, *EmptyReq) (*QueryURLTestResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method QueryURLTest not implemented")
}
func (UnimplementedLibcoreServiceServer) QueryStats(context.Context, *EmptyReq) (*QueryStatsResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method QueryStats not implemented")
}
@ -434,6 +450,24 @@ func _LibcoreService_StopTest_Handler(srv interface{}, ctx context.Context, dec
return interceptor(ctx, in, info, handler)
}
func _LibcoreService_QueryURLTest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(EmptyReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LibcoreServiceServer).QueryURLTest(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LibcoreService_QueryURLTest_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LibcoreServiceServer).QueryURLTest(ctx, req.(*EmptyReq))
}
return interceptor(ctx, in, info, handler)
}
func _LibcoreService_QueryStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(EmptyReq)
if err := dec(in); err != nil {
@ -645,6 +679,10 @@ var LibcoreService_ServiceDesc = grpc.ServiceDesc{
MethodName: "StopTest",
Handler: _LibcoreService_StopTest_Handler,
},
{
MethodName: "QueryURLTest",
Handler: _LibcoreService_QueryURLTest_Handler,
},
{
MethodName: "QueryStats",
Handler: _LibcoreService_QueryStats_Handler,

View File

@ -201,6 +201,23 @@ func (s *server) StopTest(ctx context.Context, in *gen.EmptyReq) (*gen.EmptyResp
return &gen.EmptyResp{}, nil
}
func (s *server) QueryURLTest(ctx context.Context, in *gen.EmptyReq) (*gen.QueryURLTestResponse, error) {
results := URLReporter.Results()
resp := &gen.QueryURLTestResponse{}
for _, r := range results {
errStr := ""
if r.Error != nil {
errStr = r.Error.Error()
}
resp.Results = append(resp.Results, &gen.URLTestResp{
OutboundTag: r.Tag,
LatencyMs: int32(r.Duration.Milliseconds()),
Error: errStr,
})
}
return resp, nil
}
func (s *server) QueryStats(ctx context.Context, _ *gen.EmptyReq) (*gen.QueryStatsResp, error) {
resp := &gen.QueryStatsResp{
Ups: make(map[string]int64),

View File

@ -19,15 +19,36 @@ import (
var testCtx context.Context
var cancelTests context.CancelFunc
var SpTQuerier SpeedTestResultQuerier
var URLReporter URLTestReporter
const URLTestTimeout = 3 * time.Second
const MaxConcurrentTests = 100
type URLTestResult struct {
Duration time.Duration
Tag string
Error error
}
type URLTestReporter struct {
results []*URLTestResult
mu sync.Mutex
}
func (u *URLTestReporter) AddResult(result *URLTestResult) {
u.mu.Lock()
defer u.mu.Unlock()
u.results = append(u.results, result)
}
func (u *URLTestReporter) Results() []*URLTestResult {
u.mu.Lock()
defer u.mu.Unlock()
res := u.results
u.results = nil
return res
}
type SpeedTestResult struct {
Tag string
DlSpeed string
@ -102,10 +123,13 @@ func BatchURLTest(ctx context.Context, i *boxbox.Box, outboundTags []string, url
duration, err = urlTest(ctx, client, url)
}
resAccess.Lock()
resMap[t] = &URLTestResult{
u := &URLTestResult{
Duration: duration,
Tag: t,
Error: err,
}
resMap[t] = u
URLReporter.AddResult(u)
resAccess.Unlock()
<-limiter
}(tag)

View File

@ -28,6 +28,8 @@ namespace NekoGui_rpc {
void StopTests(bool *rpcOK);
libcore::QueryURLTestResponse QueryURLTest(bool *rpcOK);
QStringList GetGeoList(bool *rpcOK, GeoRuleSetType mode, const QString& basePath);
QString CompileGeoSet(bool *rpcOK, GeoRuleSetType mode, std::string category, const QString& basePath);

View File

@ -264,6 +264,21 @@ namespace NekoGui_rpc {
}
}
libcore::QueryURLTestResponse Client::QueryURLTest(bool *rpcOK)
{
libcore::EmptyReq request;
libcore::QueryURLTestResponse resp;
auto status = make_grpc_channel()->Call("QueryURLTest", request, &resp);
if (status == QNetworkReply::NoError) {
*rpcOK = true;
return resp;
} else {
NOT_OK
return resp;
}
}
QStringList Client::GetGeoList(bool *rpcOK, GeoRuleSetType mode, const QString& basePath) {
switch (mode) {
case GeoRuleSetType::ip: {

View File

@ -44,8 +44,61 @@ void MainWindow::runURLTest(const QString& config, bool useDefault, const QStrin
req.set_use_default_outbound(useDefault);
req.set_max_concurrency(NekoGui::dataStore->test_concurrent);
auto done = new QMutex;
done->lock();
runOnNewThread([=]
{
bool ok;
while (true)
{
QThread::msleep(1500);
if (done->try_lock()) break;
auto resp = defaultClient->QueryURLTest(&ok);
if (!ok || resp.results().empty())
{
continue;
}
bool needRefresh = false;
for (const auto& res : resp.results())
{
int entid = -1;
if (!tag2entID.empty()) {
entid = tag2entID.count(QString(res.outbound_tag().c_str())) == 0 ? -1 : tag2entID[QString(res.outbound_tag().c_str())];
}
if (entid == -1) {
continue;
}
auto ent = NekoGui::profileManager->GetProfile(entid);
if (ent == nullptr) {
continue;
}
if (res.error().empty()) {
ent->latency = res.latency_ms();
} else {
if (QString(res.error().c_str()).contains("test aborted") ||
QString(res.error().c_str()).contains("context canceled")) ent->latency=0;
else {
ent->latency = -1;
MW_show_log(tr("[%1] test error: %2").arg(ent->bean->DisplayTypeAndName(), res.error().c_str()));
}
}
ent->Save();
needRefresh = true;
}
if (needRefresh)
{
runOnUiThread([=]{
refresh_proxy_list();
});
}
}
done->unlock();
delete done;
});
bool rpcOK;
auto result = defaultClient->Test(&rpcOK, req);
done->unlock();
//
if (!rpcOK) return;