add speedtest api and core functionallity

This commit is contained in:
Nova 2025-05-05 17:44:57 +03:30
parent f181a6af40
commit da859cb26f
9 changed files with 729 additions and 97 deletions

View File

@ -913,6 +913,254 @@ func (x *IsPrivilegedResponse) GetHasPrivilege() bool {
return false
}
type SpeedTestRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Config string `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"`
OutboundTags []string `protobuf:"bytes,2,rep,name=outbound_tags,json=outboundTags,proto3" json:"outbound_tags,omitempty"`
TestCurrent bool `protobuf:"varint,3,opt,name=test_current,json=testCurrent,proto3" json:"test_current,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SpeedTestRequest) Reset() {
*x = SpeedTestRequest{}
mi := &file_libcore_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SpeedTestRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SpeedTestRequest) ProtoMessage() {}
func (x *SpeedTestRequest) ProtoReflect() protoreflect.Message {
mi := &file_libcore_proto_msgTypes[17]
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 SpeedTestRequest.ProtoReflect.Descriptor instead.
func (*SpeedTestRequest) Descriptor() ([]byte, []int) {
return file_libcore_proto_rawDescGZIP(), []int{17}
}
func (x *SpeedTestRequest) GetConfig() string {
if x != nil {
return x.Config
}
return ""
}
func (x *SpeedTestRequest) GetOutboundTags() []string {
if x != nil {
return x.OutboundTags
}
return nil
}
func (x *SpeedTestRequest) GetTestCurrent() bool {
if x != nil {
return x.TestCurrent
}
return false
}
type SpeedTestResult struct {
state protoimpl.MessageState `protogen:"open.v1"`
DlSpeed string `protobuf:"bytes,1,opt,name=dl_speed,json=dlSpeed,proto3" json:"dl_speed,omitempty"`
UlSpeed string `protobuf:"bytes,2,opt,name=ul_speed,json=ulSpeed,proto3" json:"ul_speed,omitempty"`
Latency int32 `protobuf:"varint,3,opt,name=latency,proto3" json:"latency,omitempty"`
OutboundTag string `protobuf:"bytes,4,opt,name=outbound_tag,json=outboundTag,proto3" json:"outbound_tag,omitempty"`
Error string `protobuf:"bytes,5,opt,name=error,proto3" json:"error,omitempty"`
ServerName string `protobuf:"bytes,6,opt,name=server_name,json=serverName,proto3" json:"server_name,omitempty"`
ServerCountry string `protobuf:"bytes,7,opt,name=server_country,json=serverCountry,proto3" json:"server_country,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SpeedTestResult) Reset() {
*x = SpeedTestResult{}
mi := &file_libcore_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SpeedTestResult) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SpeedTestResult) ProtoMessage() {}
func (x *SpeedTestResult) ProtoReflect() protoreflect.Message {
mi := &file_libcore_proto_msgTypes[18]
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 SpeedTestResult.ProtoReflect.Descriptor instead.
func (*SpeedTestResult) Descriptor() ([]byte, []int) {
return file_libcore_proto_rawDescGZIP(), []int{18}
}
func (x *SpeedTestResult) GetDlSpeed() string {
if x != nil {
return x.DlSpeed
}
return ""
}
func (x *SpeedTestResult) GetUlSpeed() string {
if x != nil {
return x.UlSpeed
}
return ""
}
func (x *SpeedTestResult) GetLatency() int32 {
if x != nil {
return x.Latency
}
return 0
}
func (x *SpeedTestResult) GetOutboundTag() string {
if x != nil {
return x.OutboundTag
}
return ""
}
func (x *SpeedTestResult) GetError() string {
if x != nil {
return x.Error
}
return ""
}
func (x *SpeedTestResult) GetServerName() string {
if x != nil {
return x.ServerName
}
return ""
}
func (x *SpeedTestResult) GetServerCountry() string {
if x != nil {
return x.ServerCountry
}
return ""
}
type SpeedTestResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Results []*SpeedTestResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SpeedTestResponse) Reset() {
*x = SpeedTestResponse{}
mi := &file_libcore_proto_msgTypes[19]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SpeedTestResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SpeedTestResponse) ProtoMessage() {}
func (x *SpeedTestResponse) ProtoReflect() protoreflect.Message {
mi := &file_libcore_proto_msgTypes[19]
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 SpeedTestResponse.ProtoReflect.Descriptor instead.
func (*SpeedTestResponse) Descriptor() ([]byte, []int) {
return file_libcore_proto_rawDescGZIP(), []int{19}
}
func (x *SpeedTestResponse) GetResults() []*SpeedTestResult {
if x != nil {
return x.Results
}
return nil
}
type QuerySpeedTestResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Result *SpeedTestResult `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"`
IsRunning bool `protobuf:"varint,2,opt,name=is_running,json=isRunning,proto3" json:"is_running,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *QuerySpeedTestResponse) Reset() {
*x = QuerySpeedTestResponse{}
mi := &file_libcore_proto_msgTypes[20]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *QuerySpeedTestResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*QuerySpeedTestResponse) ProtoMessage() {}
func (x *QuerySpeedTestResponse) ProtoReflect() protoreflect.Message {
mi := &file_libcore_proto_msgTypes[20]
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 QuerySpeedTestResponse.ProtoReflect.Descriptor instead.
func (*QuerySpeedTestResponse) Descriptor() ([]byte, []int) {
return file_libcore_proto_rawDescGZIP(), []int{20}
}
func (x *QuerySpeedTestResponse) GetResult() *SpeedTestResult {
if x != nil {
return x.Result
}
return nil
}
func (x *QuerySpeedTestResponse) GetIsRunning() bool {
if x != nil {
return x.IsRunning
}
return false
}
var File_libcore_proto protoreflect.FileDescriptor
var file_libcore_proto_rawDesc = string([]byte{
@ -1011,64 +1259,105 @@ var file_libcore_proto_rawDesc = string([]byte{
0x14, 0x49, 0x73, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x64, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x68, 0x61, 0x73, 0x5f, 0x70, 0x72, 0x69,
0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x68, 0x61,
0x73, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x32, 0xf0, 0x06, 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, 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, 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,
0x73, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x22, 0x72, 0x0a, 0x10, 0x53, 0x70,
0x65, 0x65, 0x64, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16,
0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x23, 0x0a, 0x0d, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75,
0x6e, 0x64, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x6f,
0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x54, 0x61, 0x67, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x74,
0x65, 0x73, 0x74, 0x5f, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28,
0x08, 0x52, 0x0b, 0x74, 0x65, 0x73, 0x74, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x22, 0xe2,
0x01, 0x0a, 0x0f, 0x53, 0x70, 0x65, 0x65, 0x64, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x75,
0x6c, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x64, 0x6c, 0x5f, 0x73, 0x70, 0x65, 0x65, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x6c, 0x53, 0x70, 0x65, 0x65, 0x64, 0x12, 0x19, 0x0a,
0x08, 0x75, 0x6c, 0x5f, 0x73, 0x70, 0x65, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x07, 0x75, 0x6c, 0x53, 0x70, 0x65, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x61, 0x74, 0x65,
0x6e, 0x63, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x61, 0x74, 0x65, 0x6e,
0x63, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x74,
0x61, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75,
0x6e, 0x64, 0x54, 0x61, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x05,
0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x73,
0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x25, 0x0a, 0x0e,
0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x07,
0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e,
0x74, 0x72, 0x79, 0x22, 0x47, 0x0a, 0x11, 0x53, 0x70, 0x65, 0x65, 0x64, 0x54, 0x65, 0x73, 0x74,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75,
0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, 0x69, 0x62, 0x63,
0x6f, 0x72, 0x65, 0x2e, 0x53, 0x70, 0x65, 0x65, 0x64, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73,
0x75, 0x6c, 0x74, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x22, 0x69, 0x0a, 0x16,
0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x70, 0x65, 0x65, 0x64, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 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, 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 (
@ -1083,7 +1372,7 @@ func file_libcore_proto_rawDescGZIP() []byte {
return file_libcore_proto_rawDescData
}
var file_libcore_proto_msgTypes = make([]protoimpl.MessageInfo, 19)
var file_libcore_proto_msgTypes = make([]protoimpl.MessageInfo, 23)
var file_libcore_proto_goTypes = []any{
(*EmptyReq)(nil), // 0: libcore.EmptyReq
(*EmptyResp)(nil), // 1: libcore.EmptyResp
@ -1102,47 +1391,57 @@ var file_libcore_proto_goTypes = []any{
(*CompileGeoSiteToSrsRequest)(nil), // 14: libcore.CompileGeoSiteToSrsRequest
(*SetSystemDNSRequest)(nil), // 15: libcore.SetSystemDNSRequest
(*IsPrivilegedResponse)(nil), // 16: libcore.IsPrivilegedResponse
nil, // 17: libcore.QueryStatsResp.UpsEntry
nil, // 18: libcore.QueryStatsResp.DownsEntry
(*SpeedTestRequest)(nil), // 17: libcore.SpeedTestRequest
(*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
}
var file_libcore_proto_depIdxs = []int32{
4, // 0: libcore.TestResp.results:type_name -> libcore.URLTestResp
17, // 1: libcore.QueryStatsResp.ups:type_name -> libcore.QueryStatsResp.UpsEntry
18, // 2: libcore.QueryStatsResp.downs:type_name -> libcore.QueryStatsResp.DownsEntry
21, // 1: libcore.QueryStatsResp.ups:type_name -> libcore.QueryStatsResp.UpsEntry
22, // 2: libcore.QueryStatsResp.downs:type_name -> libcore.QueryStatsResp.DownsEntry
9, // 3: libcore.ListConnectionsResp.connections:type_name -> libcore.ConnectionMetaData
0, // 4: libcore.LibcoreService.Exit:input_type -> libcore.EmptyReq
3, // 5: libcore.LibcoreService.Start:input_type -> libcore.LoadConfigReq
0, // 6: libcore.LibcoreService.Stop:input_type -> libcore.EmptyReq
3, // 7: libcore.LibcoreService.CheckConfig:input_type -> libcore.LoadConfigReq
5, // 8: libcore.LibcoreService.Test:input_type -> libcore.TestReq
0, // 9: libcore.LibcoreService.StopTest:input_type -> libcore.EmptyReq
0, // 10: libcore.LibcoreService.QueryStats:input_type -> libcore.EmptyReq
0, // 11: libcore.LibcoreService.ListConnections:input_type -> libcore.EmptyReq
12, // 12: libcore.LibcoreService.GetGeoIPList:input_type -> libcore.GeoListRequest
12, // 13: libcore.LibcoreService.GetGeoSiteList:input_type -> libcore.GeoListRequest
13, // 14: libcore.LibcoreService.CompileGeoIPToSrs:input_type -> libcore.CompileGeoIPToSrsRequest
14, // 15: libcore.LibcoreService.CompileGeoSiteToSrs:input_type -> libcore.CompileGeoSiteToSrsRequest
15, // 16: libcore.LibcoreService.SetSystemDNS:input_type -> libcore.SetSystemDNSRequest
0, // 17: libcore.LibcoreService.IsPrivileged:input_type -> libcore.EmptyReq
1, // 18: libcore.LibcoreService.Exit:output_type -> libcore.EmptyResp
2, // 19: libcore.LibcoreService.Start:output_type -> libcore.ErrorResp
2, // 20: libcore.LibcoreService.Stop:output_type -> libcore.ErrorResp
2, // 21: libcore.LibcoreService.CheckConfig:output_type -> libcore.ErrorResp
6, // 22: libcore.LibcoreService.Test:output_type -> libcore.TestResp
1, // 23: libcore.LibcoreService.StopTest:output_type -> libcore.EmptyResp
7, // 24: libcore.LibcoreService.QueryStats:output_type -> libcore.QueryStatsResp
8, // 25: libcore.LibcoreService.ListConnections:output_type -> libcore.ListConnectionsResp
10, // 26: libcore.LibcoreService.GetGeoIPList:output_type -> libcore.GetGeoIPListResponse
11, // 27: libcore.LibcoreService.GetGeoSiteList:output_type -> libcore.GetGeoSiteListResponse
1, // 28: libcore.LibcoreService.CompileGeoIPToSrs:output_type -> libcore.EmptyResp
1, // 29: libcore.LibcoreService.CompileGeoSiteToSrs:output_type -> libcore.EmptyResp
1, // 30: libcore.LibcoreService.SetSystemDNS:output_type -> libcore.EmptyResp
16, // 31: libcore.LibcoreService.IsPrivileged:output_type -> libcore.IsPrivilegedResponse
18, // [18:32] is the sub-list for method output_type
4, // [4:18] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
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
}
func init() { file_libcore_proto_init() }
@ -1156,7 +1455,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: 19,
NumMessages: 23,
NumExtensions: 0,
NumServices: 1,
},

View File

@ -22,6 +22,9 @@ service LibcoreService {
rpc SetSystemDNS(SetSystemDNSRequest) returns (EmptyResp);
//
rpc IsPrivileged(EmptyReq) returns (IsPrivilegedResponse);
//
rpc SpeedTest(SpeedTestRequest) returns(SpeedTestResponse);
rpc QuerySpeedTest(EmptyReq) returns(QuerySpeedTestResponse);
}
message EmptyReq {}
@ -107,3 +110,28 @@ message SetSystemDNSRequest {
message IsPrivilegedResponse {
bool has_privilege = 1;
}
message SpeedTestRequest {
string config = 1;
repeated string outbound_tags = 2;
bool test_current = 3;
}
message SpeedTestResult {
string dl_speed = 1;
string ul_speed = 2;
int32 latency = 3;
string outbound_tag = 4;
string error = 5;
string server_name = 6;
string server_country = 7;
}
message SpeedTestResponse {
repeated SpeedTestResult results = 1;
}
message QuerySpeedTestResponse {
SpeedTestResult result = 1;
bool is_running = 2;
}

View File

@ -33,6 +33,8 @@ const (
LibcoreService_CompileGeoSiteToSrs_FullMethodName = "/libcore.LibcoreService/CompileGeoSiteToSrs"
LibcoreService_SetSystemDNS_FullMethodName = "/libcore.LibcoreService/SetSystemDNS"
LibcoreService_IsPrivileged_FullMethodName = "/libcore.LibcoreService/IsPrivileged"
LibcoreService_SpeedTest_FullMethodName = "/libcore.LibcoreService/SpeedTest"
LibcoreService_QuerySpeedTest_FullMethodName = "/libcore.LibcoreService/QuerySpeedTest"
)
// LibcoreServiceClient is the client API for LibcoreService service.
@ -53,6 +55,8 @@ type LibcoreServiceClient interface {
CompileGeoSiteToSrs(ctx context.Context, in *CompileGeoSiteToSrsRequest, opts ...grpc.CallOption) (*EmptyResp, error)
SetSystemDNS(ctx context.Context, in *SetSystemDNSRequest, opts ...grpc.CallOption) (*EmptyResp, error)
IsPrivileged(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*IsPrivilegedResponse, error)
SpeedTest(ctx context.Context, in *SpeedTestRequest, opts ...grpc.CallOption) (*SpeedTestResponse, error)
QuerySpeedTest(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*QuerySpeedTestResponse, error)
}
type libcoreServiceClient struct {
@ -203,6 +207,26 @@ func (c *libcoreServiceClient) IsPrivileged(ctx context.Context, in *EmptyReq, o
return out, nil
}
func (c *libcoreServiceClient) SpeedTest(ctx context.Context, in *SpeedTestRequest, opts ...grpc.CallOption) (*SpeedTestResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SpeedTestResponse)
err := c.cc.Invoke(ctx, LibcoreService_SpeedTest_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *libcoreServiceClient) QuerySpeedTest(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*QuerySpeedTestResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QuerySpeedTestResponse)
err := c.cc.Invoke(ctx, LibcoreService_QuerySpeedTest_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// LibcoreServiceServer is the server API for LibcoreService service.
// All implementations must embed UnimplementedLibcoreServiceServer
// for forward compatibility.
@ -221,6 +245,8 @@ type LibcoreServiceServer interface {
CompileGeoSiteToSrs(context.Context, *CompileGeoSiteToSrsRequest) (*EmptyResp, error)
SetSystemDNS(context.Context, *SetSystemDNSRequest) (*EmptyResp, error)
IsPrivileged(context.Context, *EmptyReq) (*IsPrivilegedResponse, error)
SpeedTest(context.Context, *SpeedTestRequest) (*SpeedTestResponse, error)
QuerySpeedTest(context.Context, *EmptyReq) (*QuerySpeedTestResponse, error)
mustEmbedUnimplementedLibcoreServiceServer()
}
@ -273,6 +299,12 @@ func (UnimplementedLibcoreServiceServer) SetSystemDNS(context.Context, *SetSyste
func (UnimplementedLibcoreServiceServer) IsPrivileged(context.Context, *EmptyReq) (*IsPrivilegedResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method IsPrivileged not implemented")
}
func (UnimplementedLibcoreServiceServer) SpeedTest(context.Context, *SpeedTestRequest) (*SpeedTestResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SpeedTest not implemented")
}
func (UnimplementedLibcoreServiceServer) QuerySpeedTest(context.Context, *EmptyReq) (*QuerySpeedTestResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method QuerySpeedTest not implemented")
}
func (UnimplementedLibcoreServiceServer) mustEmbedUnimplementedLibcoreServiceServer() {}
func (UnimplementedLibcoreServiceServer) testEmbeddedByValue() {}
@ -546,6 +578,42 @@ func _LibcoreService_IsPrivileged_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler)
}
func _LibcoreService_SpeedTest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SpeedTestRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LibcoreServiceServer).SpeedTest(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LibcoreService_SpeedTest_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LibcoreServiceServer).SpeedTest(ctx, req.(*SpeedTestRequest))
}
return interceptor(ctx, in, info, handler)
}
func _LibcoreService_QuerySpeedTest_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).QuerySpeedTest(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LibcoreService_QuerySpeedTest_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LibcoreServiceServer).QuerySpeedTest(ctx, req.(*EmptyReq))
}
return interceptor(ctx, in, info, handler)
}
// LibcoreService_ServiceDesc is the grpc.ServiceDesc for LibcoreService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -609,6 +677,14 @@ var LibcoreService_ServiceDesc = grpc.ServiceDesc{
MethodName: "IsPrivileged",
Handler: _LibcoreService_IsPrivileged_Handler,
},
{
MethodName: "SpeedTest",
Handler: _LibcoreService_SpeedTest_Handler,
},
{
MethodName: "QuerySpeedTest",
Handler: _LibcoreService_QuerySpeedTest_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "libcore.proto",

View File

@ -23,6 +23,7 @@ replace github.com/sagernet/sing-box => github.com/Mahdi-zarei/sing-box v1.3.5-0
replace github.com/sagernet/sing-dns => github.com/Mahdi-zarei/sing-dns v0.3.0-beta.14.0.20250419091211-cee3ab2d4492
require (
github.com/Mahdi-zarei/speedtest-go v1.7.11 // indirect
github.com/ajg/form v1.5.1 // indirect
github.com/andybalholm/brotli v1.0.6 // indirect
github.com/caddyserver/certmagic v0.20.0 // indirect

View File

@ -2,6 +2,8 @@ github.com/Mahdi-zarei/sing-box v1.3.5-0.20250419091424-318eff0efb34 h1:xhAgBfvZ
github.com/Mahdi-zarei/sing-box v1.3.5-0.20250419091424-318eff0efb34/go.mod h1:wMfYe7SB/9L11IuO7r0A5Rh6eoxGsyjoErxeYwqLgXU=
github.com/Mahdi-zarei/sing-dns v0.3.0-beta.14.0.20250419091211-cee3ab2d4492 h1:fLReuPi1fM99oFRERDU96JzEY1YpLh8PmDGEcfnexCY=
github.com/Mahdi-zarei/sing-dns v0.3.0-beta.14.0.20250419091211-cee3ab2d4492/go.mod h1:dweQs54ng2YGzoJfz+F9dGuDNdP5pJ3PLeggnK5VWc8=
github.com/Mahdi-zarei/speedtest-go v1.7.11 h1:K/c7qBlJNAYGv6MujDaIKvtb4AH+yPRdssZ1NJMGPFU=
github.com/Mahdi-zarei/speedtest-go v1.7.11/go.mod h1:b1H+UBFUnLKH1YquN2xao8d1hokcnDFFhEKDARTzddM=
github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU=
github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
github.com/andybalholm/brotli v1.0.6 h1:Yf9fFpf49Zrxb9NlQaluyE92/+X7UVHlhMNJN2sxfOI=

View File

@ -309,3 +309,69 @@ func (s *server) IsPrivileged(ctx context.Context, _ *gen.EmptyReq) (*gen.IsPriv
return &gen.IsPrivilegedResponse{HasPrivilege: os.Geteuid() == 0}, nil
}
func (s *server) SpeedTest(ctx context.Context, in *gen.SpeedTestRequest) (*gen.SpeedTestResponse, error) {
var testInstance *boxbox.Box
var cancel context.CancelFunc
outboundTags := in.OutboundTags
var err error
if in.TestCurrent {
if boxInstance == nil {
return &gen.SpeedTestResponse{Results: []*gen.SpeedTestResult{{
OutboundTag: "proxy",
Error: "Instance is not running",
}}}, nil
}
testInstance = boxInstance
outbound := testInstance.Outbound().Default()
outboundTags = []string{outbound.Tag()}
} else {
testInstance, cancel, err = boxmain.Create([]byte(in.Config))
if err != nil {
return nil, err
}
defer cancel()
defer testInstance.Close()
}
results := BatchSpeedTest(testCtx, testInstance, outboundTags)
res := make([]*gen.SpeedTestResult, 0)
for _, data := range results {
errStr := ""
if data.Error != nil {
errStr = data.Error.Error()
}
res = append(res, &gen.SpeedTestResult{
DlSpeed: data.DlSpeed,
UlSpeed: data.UlSpeed,
Latency: data.Latency,
OutboundTag: data.Tag,
Error: errStr,
ServerName: data.ServerName,
ServerCountry: data.ServerCountry,
})
}
return &gen.SpeedTestResponse{Results: res}, nil
}
func (s *server) QuerySpeedTest(context.Context, *gen.EmptyReq) (*gen.QuerySpeedTestResponse, error) {
res, isRunning := SpTQuerier.Result()
errStr := ""
if res.Error != nil {
errStr = res.Error.Error()
}
return &gen.QuerySpeedTestResponse{
Result: &gen.SpeedTestResult{
DlSpeed: res.DlSpeed,
UlSpeed: res.UlSpeed,
Latency: res.Latency,
OutboundTag: res.Tag,
Error: errStr,
ServerName: res.ServerName,
ServerCountry: res.ServerCountry,
},
IsRunning: isRunning,
}, nil
}

View File

@ -3,6 +3,8 @@ package main
import (
"context"
"errors"
"fmt"
"github.com/Mahdi-zarei/speedtest-go/speedtest"
"github.com/sagernet/sing-box/adapter"
"github.com/sagernet/sing/common/metadata"
"github.com/sagernet/sing/service"
@ -15,6 +17,7 @@ import (
var testCtx context.Context
var cancelTests context.CancelFunc
var SpTQuerier SpeedTestResultQuerier
const URLTestTimeout = 3 * time.Second
const MaxConcurrentTests = 100
@ -24,6 +27,38 @@ type URLTestResult struct {
Error error
}
type SpeedTestResult struct {
Tag string
DlSpeed string
UlSpeed string
Latency int32
ServerName string
ServerCountry string
Error error
}
type SpeedTestResultQuerier struct {
isRunning bool
current SpeedTestResult
mu sync.RWMutex
}
func (s *SpeedTestResultQuerier) Result() (SpeedTestResult, bool) {
s.mu.RLock()
defer s.mu.RUnlock()
return s.current, s.isRunning
}
func (s *SpeedTestResultQuerier) storeResult(result *SpeedTestResult) {
s.mu.Lock()
defer s.mu.Unlock()
s.current = *result
}
func (s *SpeedTestResultQuerier) setIsRunning(isRunning bool) {
s.isRunning = isRunning
}
func BatchURLTest(ctx context.Context, i *boxbox.Box, outboundTags []string, url string, maxConcurrency int, twice bool) []*URLTestResult {
outbounds := service.FromContext[adapter.OutboundManager](i.Context())
resMap := make(map[string]*URLTestResult)
@ -99,3 +134,95 @@ func urlTest(ctx context.Context, client *http.Client, url string) (time.Duratio
_ = resp.Body.Close()
return time.Since(begin), nil
}
func getNetDialer(dialer func(ctx context.Context, network string, destination metadata.Socksaddr) (net.Conn, error)) func(ctx context.Context, network string, address string) (net.Conn, error) {
return func(ctx context.Context, network string, address string) (net.Conn, error) {
return dialer(ctx, network, metadata.Socksaddr{Addr: metadata.ParseAddr(address)})
}
}
func BatchSpeedTest(ctx context.Context, i *boxbox.Box, outboundTags []string) []*SpeedTestResult {
outbounds := service.FromContext[adapter.OutboundManager](i.Context())
results := make([]*SpeedTestResult, 0)
for _, tag := range outboundTags {
outbound, exists := outbounds.Outbound(tag)
if !exists {
panic("no outbound with tag " + tag + " found")
}
res := new(SpeedTestResult)
res.Tag = tag
results = append(results, res)
insCtx, cancel := context.WithTimeout(ctx, 30*time.Second)
err := speedTestWithDialer(insCtx, getNetDialer(outbound.DialContext), res)
cancel()
if err != nil {
res.Error = err
fmt.Println("Failed to speedtest with err:", err)
}
}
return results
}
func speedTestWithDialer(ctx context.Context, dialer func(ctx context.Context, network string, address string) (net.Conn, error), res *SpeedTestResult) error {
clt := speedtest.New(speedtest.WithUserConfig(&speedtest.UserConfig{
DialContextFunc: dialer,
PingMode: speedtest.HTTP,
MaxConnections: 8,
}))
srv, err := clt.FetchServerListContext(ctx)
if err != nil {
return err
}
srv, err = srv.FindServer(nil)
if err != nil {
return err
}
if srv.Len() == 0 {
return errors.New("no server found for speedTest")
}
res.ServerName = srv[0].Name
res.ServerCountry = srv[0].Country
done := make(chan struct{})
SpTQuerier.setIsRunning(true)
defer SpTQuerier.setIsRunning(false)
go func() {
defer func() { close(done) }()
err = srv[0].DownloadTestContext(ctx)
if err != nil {
res.Error = err
return
}
err = srv[0].UploadTestContext(ctx)
if err != nil {
res.Error = err
return
}
}()
ticker := time.NewTicker(time.Millisecond * 50)
defer ticker.Stop()
for {
select {
case <-done:
res.DlSpeed = srv[0].DLSpeed.String()
res.UlSpeed = srv[0].ULSpeed.String()
res.Latency = int32(srv[0].Latency.Milliseconds())
SpTQuerier.storeResult(res)
return nil
case <-ctx.Done():
return ctx.Err()
case <-ticker.C:
res.DlSpeed = speedtest.ByteRate(srv[0].Context.GetEWMADownloadRate()).String()
res.UlSpeed = speedtest.ByteRate(srv[0].Context.GetEWMAUploadRate()).String()
SpTQuerier.storeResult(res)
}
}
}

View File

@ -40,6 +40,10 @@ namespace NekoGui_rpc {
bool IsPrivileged(bool *rpcOK) const;
libcore::SpeedTestResponse SpeedTest(bool *rpcOK, const libcore::SpeedTestRequest &request);
libcore::SpeedTestResult QueryCurrentSpeedTests(bool *rpcOK);
private:
std::function<std::unique_ptr<QtGrpc::Http2GrpcChannelPrivate>()> make_grpc_channel;
std::unique_ptr<QtGrpc::Http2GrpcChannelPrivate> default_grpc_channel;

View File

@ -407,5 +407,34 @@ namespace NekoGui_rpc {
}
}
libcore::SpeedTestResponse Client::SpeedTest(bool *rpcOK, const libcore::SpeedTestRequest &request)
{
libcore::SpeedTestResponse reply;
auto status = make_grpc_channel()->Call("SpeedTest", request, &reply);
if (status == QNetworkReply::NoError) {
*rpcOK = true;
return reply;
} else {
NOT_OK
return reply;
}
}
libcore::SpeedTestResult Client::QueryCurrentSpeedTests(bool *rpcOK)
{
const libcore::EmptyReq req;
libcore::SpeedTestResult reply;
auto status = make_grpc_channel()->Call("QuerySpeedTest", req, &reply);
if (status == QNetworkReply::NoError) {
*rpcOK = true;
return reply;
} else {
NOT_OK
return reply;
}
}
} // namespace NekoGui_rpc