mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-26 03:11:21 +08:00
migrate to clash for traffic &&
refactor
This commit is contained in:
parent
aedf4e2201
commit
9e66635244
@ -446,10 +446,8 @@ type QueryStatsResp struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
DirectTrafficUp int64 `protobuf:"varint,1,opt,name=direct_traffic_up,json=directTrafficUp,proto3" json:"direct_traffic_up,omitempty"`
|
Ups map[string]int64 `protobuf:"bytes,1,rep,name=ups,proto3" json:"ups,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
||||||
DirectTrafficDown int64 `protobuf:"varint,2,opt,name=direct_traffic_down,json=directTrafficDown,proto3" json:"direct_traffic_down,omitempty"`
|
Downs map[string]int64 `protobuf:"bytes,2,rep,name=downs,proto3" json:"downs,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
||||||
ProxyTrafficUp int64 `protobuf:"varint,3,opt,name=proxy_traffic_up,json=proxyTrafficUp,proto3" json:"proxy_traffic_up,omitempty"`
|
|
||||||
ProxyTrafficDown int64 `protobuf:"varint,4,opt,name=proxy_traffic_down,json=proxyTrafficDown,proto3" json:"proxy_traffic_down,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *QueryStatsResp) Reset() {
|
func (x *QueryStatsResp) Reset() {
|
||||||
@ -484,32 +482,18 @@ func (*QueryStatsResp) Descriptor() ([]byte, []int) {
|
|||||||
return file_libcore_proto_rawDescGZIP(), []int{7}
|
return file_libcore_proto_rawDescGZIP(), []int{7}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *QueryStatsResp) GetDirectTrafficUp() int64 {
|
func (x *QueryStatsResp) GetUps() map[string]int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.DirectTrafficUp
|
return x.Ups
|
||||||
}
|
}
|
||||||
return 0
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *QueryStatsResp) GetDirectTrafficDown() int64 {
|
func (x *QueryStatsResp) GetDowns() map[string]int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.DirectTrafficDown
|
return x.Downs
|
||||||
}
|
}
|
||||||
return 0
|
return nil
|
||||||
}
|
|
||||||
|
|
||||||
func (x *QueryStatsResp) GetProxyTrafficUp() int64 {
|
|
||||||
if x != nil {
|
|
||||||
return x.ProxyTrafficUp
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *QueryStatsResp) GetProxyTrafficDown() int64 {
|
|
||||||
if x != nil {
|
|
||||||
return x.ProxyTrafficDown
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateReq struct {
|
type UpdateReq struct {
|
||||||
@ -1281,158 +1265,161 @@ var file_libcore_proto_rawDesc = []byte{
|
|||||||
0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2e, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c,
|
0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 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,
|
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, 0x2e, 0x55, 0x52, 0x4c, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x52, 0x07,
|
||||||
0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x22, 0xc4, 0x01, 0x0a, 0x0e, 0x51, 0x75, 0x65, 0x72,
|
0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x22, 0xf0, 0x01, 0x0a, 0x0e, 0x51, 0x75, 0x65, 0x72,
|
||||||
0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2a, 0x0a, 0x11, 0x64, 0x69,
|
0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x32, 0x0a, 0x03, 0x75, 0x70,
|
||||||
0x72, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x5f, 0x75, 0x70, 0x18,
|
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72,
|
||||||
0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x54, 0x72, 0x61,
|
0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70,
|
||||||
0x66, 0x66, 0x69, 0x63, 0x55, 0x70, 0x12, 0x2e, 0x0a, 0x13, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74,
|
0x2e, 0x55, 0x70, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x03, 0x75, 0x70, 0x73, 0x12, 0x38,
|
||||||
0x5f, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x5f, 0x64, 0x6f, 0x77, 0x6e, 0x18, 0x02, 0x20,
|
0x0a, 0x05, 0x64, 0x6f, 0x77, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e,
|
||||||
0x01, 0x28, 0x03, 0x52, 0x11, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x54, 0x72, 0x61, 0x66, 0x66,
|
0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, 0x61,
|
||||||
0x69, 0x63, 0x44, 0x6f, 0x77, 0x6e, 0x12, 0x28, 0x0a, 0x10, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f,
|
0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72,
|
||||||
0x74, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x5f, 0x75, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03,
|
0x79, 0x52, 0x05, 0x64, 0x6f, 0x77, 0x6e, 0x73, 0x1a, 0x36, 0x0a, 0x08, 0x55, 0x70, 0x73, 0x45,
|
||||||
0x52, 0x0e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x55, 0x70,
|
0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
0x12, 0x2c, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69,
|
0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
|
||||||
0x63, 0x5f, 0x64, 0x6f, 0x77, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x70, 0x72,
|
0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01,
|
||||||
0x6f, 0x78, 0x79, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x44, 0x6f, 0x77, 0x6e, 0x22, 0x66,
|
0x1a, 0x38, 0x0a, 0x0a, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10,
|
||||||
0x0a, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12, 0x2d, 0x0a, 0x06, 0x61,
|
0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79,
|
||||||
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6c, 0x69,
|
0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||||
0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69,
|
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x66, 0x0a, 0x09, 0x55, 0x70,
|
||||||
0x6f, 0x6e, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x11, 0x63, 0x68,
|
0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12, 0x2d, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f,
|
||||||
0x65, 0x63, 0x6b, 0x5f, 0x70, 0x72, 0x65, 0x5f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x18,
|
0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72,
|
||||||
0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x72, 0x65, 0x52,
|
0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06,
|
||||||
0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x22, 0xd0, 0x01, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74,
|
0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x11, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f,
|
||||||
0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01,
|
0x70, 0x72, 0x65, 0x5f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x61,
|
0x08, 0x52, 0x0f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x72, 0x65, 0x52, 0x65, 0x6c, 0x65, 0x61,
|
||||||
0x73, 0x73, 0x65, 0x74, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
0x73, 0x65, 0x22, 0xd0, 0x01, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73,
|
||||||
0x52, 0x0a, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c,
|
0x70, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||||
0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01,
|
0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x73, 0x73, 0x65, 0x74,
|
||||||
0x28, 0x09, 0x52, 0x0b, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x72, 0x6c, 0x12,
|
0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x73,
|
||||||
0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04,
|
0x73, 0x65, 0x74, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x6f, 0x77, 0x6e,
|
||||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x55, 0x72, 0x6c,
|
0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
|
||||||
0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x6e, 0x6f, 0x74, 0x65,
|
0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x72, 0x6c, 0x12, 0x1f, 0x0a, 0x0b, 0x72,
|
||||||
0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x4e,
|
0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
|
||||||
0x6f, 0x74, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x69, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x5f, 0x72, 0x65,
|
0x52, 0x0a, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x21, 0x0a, 0x0c,
|
||||||
0x6c, 0x65, 0x61, 0x73, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, 0x50,
|
0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x6e, 0x6f, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01,
|
||||||
0x72, 0x65, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x22, 0x54, 0x0a, 0x13, 0x4c, 0x69, 0x73,
|
0x28, 0x09, 0x52, 0x0b, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x4e, 0x6f, 0x74, 0x65, 0x12,
|
||||||
0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70,
|
0x24, 0x0a, 0x0e, 0x69, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x5f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73,
|
||||||
0x12, 0x3d, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18,
|
0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, 0x50, 0x72, 0x65, 0x52, 0x65,
|
||||||
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e,
|
0x6c, 0x65, 0x61, 0x73, 0x65, 0x22, 0x54, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e,
|
||||||
|
0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3d, 0x0a, 0x0b,
|
||||||
|
0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
|
||||||
|
0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x6e,
|
||||||
|
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0b,
|
||||||
|
0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x8f, 0x02, 0x0a, 0x12,
|
||||||
0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61,
|
0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61,
|
||||||
0x74, 0x61, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22,
|
0x74, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
|
||||||
0x8f, 0x02, 0x0a, 0x12, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65,
|
0x69, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74,
|
||||||
0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
|
0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41,
|
||||||
0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65,
|
0x74, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||||
0x64, 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61,
|
0x03, 0x52, 0x06, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x6f, 0x77,
|
||||||
0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x18,
|
0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x6f, 0x77,
|
||||||
0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1a, 0x0a,
|
0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e,
|
||||||
0x08, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52,
|
0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e,
|
||||||
0x08, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x75, 0x74,
|
0x64, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x06, 0x20, 0x01,
|
||||||
0x62, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6f, 0x75, 0x74,
|
0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x64,
|
||||||
0x62, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b,
|
0x65, 0x73, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x65, 0x73, 0x74, 0x12,
|
||||||
0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12,
|
0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28,
|
||||||
0x12, 0x0a, 0x04, 0x64, 0x65, 0x73, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64,
|
0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x64,
|
||||||
0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18,
|
0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d,
|
||||||
0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12,
|
0x61, 0x69, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x18, 0x0a,
|
||||||
0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x22, 0x2c, 0x0a,
|
||||||
0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65,
|
0x14, 0x47, 0x65, 0x74, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73,
|
||||||
0x73, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73,
|
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01,
|
||||||
0x73, 0x22, 0x2c, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x4c, 0x69, 0x73,
|
0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x2e, 0x0a, 0x16, 0x47,
|
||||||
0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x74, 0x65,
|
0x65, 0x74, 0x47, 0x65, 0x6f, 0x53, 0x69, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73,
|
||||||
0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22,
|
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02,
|
||||||
0x2e, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x47, 0x65, 0x6f, 0x53, 0x69, 0x74, 0x65, 0x4c, 0x69, 0x73,
|
0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x24, 0x0a, 0x0e, 0x47,
|
||||||
0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x74, 0x65,
|
0x65, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a,
|
||||||
0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22,
|
0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74,
|
||||||
0x24, 0x0a, 0x0e, 0x47, 0x65, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
0x68, 0x22, 0x42, 0x0a, 0x18, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x47, 0x65, 0x6f, 0x49,
|
||||||
0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x50, 0x54, 0x6f, 0x53, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a,
|
||||||
0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x42, 0x0a, 0x18, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65,
|
0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x74, 0x65,
|
||||||
0x47, 0x65, 0x6f, 0x49, 0x50, 0x54, 0x6f, 0x53, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
0x6d, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
0x74, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x44, 0x0a, 0x1a, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65,
|
||||||
0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20,
|
0x47, 0x65, 0x6f, 0x53, 0x69, 0x74, 0x65, 0x54, 0x6f, 0x53, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75,
|
||||||
0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x44, 0x0a, 0x1a, 0x43, 0x6f, 0x6d,
|
0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
0x70, 0x69, 0x6c, 0x65, 0x47, 0x65, 0x6f, 0x53, 0x69, 0x74, 0x65, 0x54, 0x6f, 0x53, 0x72, 0x73,
|
0x09, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18,
|
||||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18,
|
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x49, 0x0a, 0x15, 0x53,
|
||||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x70,
|
0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71,
|
||||||
0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22,
|
0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01,
|
||||||
0x49, 0x0a, 0x15, 0x53, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72, 0x6f, 0x78,
|
0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07,
|
||||||
0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x61, 0x62,
|
0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61,
|
||||||
0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65,
|
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x60, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x53, 0x79, 0x73,
|
||||||
0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28,
|
0x74, 0x65, 0x6d, 0x44, 0x4e, 0x53, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a,
|
||||||
0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x60, 0x0a, 0x13, 0x53, 0x65,
|
0x05, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x63, 0x6c,
|
||||||
0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x44, 0x4e, 0x53, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
0x65, 0x61, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x02,
|
||||||
0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08,
|
0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, 0x19, 0x0a,
|
||||||
0x52, 0x05, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65,
|
0x08, 0x73, 0x65, 0x74, 0x5f, 0x64, 0x68, 0x63, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52,
|
||||||
0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
|
0x07, 0x73, 0x65, 0x74, 0x44, 0x68, 0x63, 0x70, 0x22, 0x49, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x53,
|
||||||
0x73, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x65, 0x74, 0x5f, 0x64, 0x68, 0x63, 0x70, 0x18, 0x03, 0x20,
|
0x79, 0x73, 0x74, 0x65, 0x6d, 0x44, 0x4e, 0x53, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||||
0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x65, 0x74, 0x44, 0x68, 0x63, 0x70, 0x22, 0x49, 0x0a, 0x14,
|
0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
|
||||||
0x47, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x44, 0x4e, 0x53, 0x52, 0x65, 0x73, 0x70,
|
0x09, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x73,
|
||||||
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x18,
|
0x5f, 0x64, 0x68, 0x63, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x44,
|
||||||
0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, 0x17,
|
0x68, 0x63, 0x70, 0x2a, 0x27, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x74,
|
||||||
0x0a, 0x07, 0x69, 0x73, 0x5f, 0x64, 0x68, 0x63, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52,
|
0x69, 0x6f, 0x6e, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x10, 0x00, 0x12, 0x0c,
|
||||||
0x06, 0x69, 0x73, 0x44, 0x68, 0x63, 0x70, 0x2a, 0x27, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74,
|
0x0a, 0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x10, 0x01, 0x32, 0xbc, 0x07, 0x0a,
|
||||||
0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x68, 0x65, 0x63, 0x6b,
|
0x0e, 0x4c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
|
||||||
0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x10, 0x01,
|
0x2f, 0x0a, 0x04, 0x45, 0x78, 0x69, 0x74, 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72,
|
||||||
0x32, 0xbc, 0x07, 0x0a, 0x0e, 0x4c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76,
|
0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62,
|
||||||
0x69, 0x63, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x45, 0x78, 0x69, 0x74, 0x12, 0x11, 0x2e, 0x6c, 0x69,
|
0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00,
|
||||||
0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x12,
|
0x12, 0x33, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x12, 0x2e, 0x6c, 0x69, 0x62,
|
||||||
0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65,
|
0x63, 0x6f, 0x72, 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x13,
|
||||||
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,
|
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,
|
0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x16,
|
||||||
0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x05, 0x53, 0x74, 0x61,
|
0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6e,
|
||||||
0x72, 0x74, 0x12, 0x16, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4c, 0x6f, 0x61,
|
0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65,
|
||||||
0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62,
|
0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x2f, 0x0a, 0x04,
|
||||||
0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00,
|
0x53, 0x74, 0x6f, 0x70, 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45,
|
||||||
0x12, 0x2f, 0x0a, 0x04, 0x53, 0x74, 0x6f, 0x70, 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f,
|
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,
|
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,
|
0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12,
|
||||||
0x00, 0x12, 0x2d, 0x0a, 0x04, 0x54, 0x65, 0x73, 0x74, 0x12, 0x10, 0x2e, 0x6c, 0x69, 0x62, 0x63,
|
0x3a, 0x0a, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x11, 0x2e,
|
||||||
0x6f, 0x72, 0x65, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x11, 0x2e, 0x6c, 0x69,
|
0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71,
|
||||||
0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00,
|
0x1a, 0x17, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79,
|
||||||
0x12, 0x31, 0x0a, 0x08, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x65, 0x73, 0x74, 0x12, 0x11, 0x2e, 0x6c,
|
0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x44, 0x0a, 0x0f, 0x4c,
|
||||||
0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a,
|
0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x11,
|
||||||
0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52,
|
0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65,
|
||||||
0x65, 0x73, 0x70, 0x12, 0x3a, 0x0a, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74,
|
0x71, 0x1a, 0x1c, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74,
|
||||||
0x73, 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74,
|
0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22,
|
||||||
0x79, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x51,
|
0x00, 0x12, 0x46, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x4c, 0x69, 0x73,
|
||||||
0x75, 0x65, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12,
|
0x74, 0x12, 0x17, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x65, 0x6f, 0x4c,
|
||||||
0x44, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f,
|
0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6c, 0x69, 0x62,
|
||||||
0x6e, 0x73, 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70,
|
0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x4c, 0x69, 0x73,
|
||||||
0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x1c, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e,
|
0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x0e, 0x47, 0x65, 0x74,
|
||||||
0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52,
|
0x47, 0x65, 0x6f, 0x53, 0x69, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x17, 0x2e, 0x6c, 0x69,
|
||||||
0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x47, 0x65, 0x6f, 0x49,
|
0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x65, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71,
|
||||||
0x50, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x17, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e,
|
0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47,
|
||||||
0x47, 0x65, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d,
|
0x65, 0x74, 0x47, 0x65, 0x6f, 0x53, 0x69, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73,
|
||||||
0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x65, 0x6f, 0x49,
|
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x11, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65,
|
||||||
0x50, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a,
|
0x47, 0x65, 0x6f, 0x49, 0x50, 0x54, 0x6f, 0x53, 0x72, 0x73, 0x12, 0x21, 0x2e, 0x6c, 0x69, 0x62,
|
||||||
0x0e, 0x47, 0x65, 0x74, 0x47, 0x65, 0x6f, 0x53, 0x69, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12,
|
0x63, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x47, 0x65, 0x6f, 0x49,
|
||||||
0x17, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x65, 0x6f, 0x4c, 0x69, 0x73,
|
0x50, 0x54, 0x6f, 0x53, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e,
|
||||||
0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f,
|
0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73,
|
||||||
0x72, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x65, 0x6f, 0x53, 0x69, 0x74, 0x65, 0x4c, 0x69, 0x73,
|
0x70, 0x12, 0x4e, 0x0a, 0x13, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x47, 0x65, 0x6f, 0x53,
|
||||||
0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x11, 0x43, 0x6f, 0x6d,
|
0x69, 0x74, 0x65, 0x54, 0x6f, 0x53, 0x72, 0x73, 0x12, 0x23, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f,
|
||||||
0x70, 0x69, 0x6c, 0x65, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x54, 0x6f, 0x53, 0x72, 0x73, 0x12, 0x21,
|
0x72, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x47, 0x65, 0x6f, 0x53, 0x69, 0x74,
|
||||||
0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65,
|
0x65, 0x54, 0x6f, 0x53, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e,
|
||||||
0x47, 0x65, 0x6f, 0x49, 0x50, 0x54, 0x6f, 0x53, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73,
|
||||||
0x74, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74,
|
0x70, 0x12, 0x44, 0x0a, 0x0e, 0x53, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72,
|
||||||
0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x4e, 0x0a, 0x13, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65,
|
0x6f, 0x78, 0x79, 0x12, 0x1e, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x65,
|
||||||
0x47, 0x65, 0x6f, 0x53, 0x69, 0x74, 0x65, 0x54, 0x6f, 0x53, 0x72, 0x73, 0x12, 0x23, 0x2e, 0x6c,
|
0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75,
|
||||||
0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x47, 0x65,
|
0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d,
|
||||||
0x6f, 0x53, 0x69, 0x74, 0x65, 0x54, 0x6f, 0x53, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x40, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x53, 0x79,
|
||||||
0x74, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74,
|
0x73, 0x74, 0x65, 0x6d, 0x44, 0x4e, 0x53, 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72,
|
||||||
0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x44, 0x0a, 0x0e, 0x53, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74,
|
0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x1d, 0x2e, 0x6c, 0x69, 0x62,
|
||||||
0x65, 0x6d, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x1e, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72,
|
0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x44, 0x4e,
|
||||||
0x65, 0x2e, 0x53, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72, 0x6f, 0x78, 0x79,
|
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,
|
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, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x42, 0x11, 0x5a, 0x0f, 0x67,
|
||||||
0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x44, 0x4e, 0x53, 0x12, 0x11, 0x2e, 0x6c, 0x69,
|
0x72, 0x70, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x6e, 0x62, 0x06,
|
||||||
0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x1d,
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
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 (
|
var (
|
||||||
@ -1448,7 +1435,7 @@ func file_libcore_proto_rawDescGZIP() []byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var file_libcore_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
var file_libcore_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||||
var file_libcore_proto_msgTypes = make([]protoimpl.MessageInfo, 20)
|
var file_libcore_proto_msgTypes = make([]protoimpl.MessageInfo, 22)
|
||||||
var file_libcore_proto_goTypes = []any{
|
var file_libcore_proto_goTypes = []any{
|
||||||
(UpdateAction)(0), // 0: libcore.UpdateAction
|
(UpdateAction)(0), // 0: libcore.UpdateAction
|
||||||
(*EmptyReq)(nil), // 1: libcore.EmptyReq
|
(*EmptyReq)(nil), // 1: libcore.EmptyReq
|
||||||
@ -1471,46 +1458,50 @@ var file_libcore_proto_goTypes = []any{
|
|||||||
(*SetSystemProxyRequest)(nil), // 18: libcore.SetSystemProxyRequest
|
(*SetSystemProxyRequest)(nil), // 18: libcore.SetSystemProxyRequest
|
||||||
(*SetSystemDNSRequest)(nil), // 19: libcore.SetSystemDNSRequest
|
(*SetSystemDNSRequest)(nil), // 19: libcore.SetSystemDNSRequest
|
||||||
(*GetSystemDNSResponse)(nil), // 20: libcore.GetSystemDNSResponse
|
(*GetSystemDNSResponse)(nil), // 20: libcore.GetSystemDNSResponse
|
||||||
|
nil, // 21: libcore.QueryStatsResp.UpsEntry
|
||||||
|
nil, // 22: libcore.QueryStatsResp.DownsEntry
|
||||||
}
|
}
|
||||||
var file_libcore_proto_depIdxs = []int32{
|
var file_libcore_proto_depIdxs = []int32{
|
||||||
5, // 0: libcore.TestResp.results:type_name -> libcore.URLTestResp
|
5, // 0: libcore.TestResp.results:type_name -> libcore.URLTestResp
|
||||||
0, // 1: libcore.UpdateReq.action:type_name -> libcore.UpdateAction
|
21, // 1: libcore.QueryStatsResp.ups:type_name -> libcore.QueryStatsResp.UpsEntry
|
||||||
12, // 2: libcore.ListConnectionsResp.connections:type_name -> libcore.ConnectionMetaData
|
22, // 2: libcore.QueryStatsResp.downs:type_name -> libcore.QueryStatsResp.DownsEntry
|
||||||
1, // 3: libcore.LibcoreService.Exit:input_type -> libcore.EmptyReq
|
0, // 3: libcore.UpdateReq.action:type_name -> libcore.UpdateAction
|
||||||
9, // 4: libcore.LibcoreService.Update:input_type -> libcore.UpdateReq
|
12, // 4: libcore.ListConnectionsResp.connections:type_name -> libcore.ConnectionMetaData
|
||||||
4, // 5: libcore.LibcoreService.Start:input_type -> libcore.LoadConfigReq
|
1, // 5: libcore.LibcoreService.Exit:input_type -> libcore.EmptyReq
|
||||||
1, // 6: libcore.LibcoreService.Stop:input_type -> libcore.EmptyReq
|
9, // 6: libcore.LibcoreService.Update:input_type -> libcore.UpdateReq
|
||||||
6, // 7: libcore.LibcoreService.Test:input_type -> libcore.TestReq
|
4, // 7: libcore.LibcoreService.Start:input_type -> libcore.LoadConfigReq
|
||||||
1, // 8: libcore.LibcoreService.StopTest:input_type -> libcore.EmptyReq
|
1, // 8: libcore.LibcoreService.Stop:input_type -> libcore.EmptyReq
|
||||||
1, // 9: libcore.LibcoreService.QueryStats:input_type -> libcore.EmptyReq
|
6, // 9: libcore.LibcoreService.Test:input_type -> libcore.TestReq
|
||||||
1, // 10: libcore.LibcoreService.ListConnections:input_type -> libcore.EmptyReq
|
1, // 10: libcore.LibcoreService.StopTest:input_type -> libcore.EmptyReq
|
||||||
15, // 11: libcore.LibcoreService.GetGeoIPList:input_type -> libcore.GeoListRequest
|
1, // 11: libcore.LibcoreService.QueryStats:input_type -> libcore.EmptyReq
|
||||||
15, // 12: libcore.LibcoreService.GetGeoSiteList:input_type -> libcore.GeoListRequest
|
1, // 12: libcore.LibcoreService.ListConnections:input_type -> libcore.EmptyReq
|
||||||
16, // 13: libcore.LibcoreService.CompileGeoIPToSrs:input_type -> libcore.CompileGeoIPToSrsRequest
|
15, // 13: libcore.LibcoreService.GetGeoIPList:input_type -> libcore.GeoListRequest
|
||||||
17, // 14: libcore.LibcoreService.CompileGeoSiteToSrs:input_type -> libcore.CompileGeoSiteToSrsRequest
|
15, // 14: libcore.LibcoreService.GetGeoSiteList:input_type -> libcore.GeoListRequest
|
||||||
18, // 15: libcore.LibcoreService.SetSystemProxy:input_type -> libcore.SetSystemProxyRequest
|
16, // 15: libcore.LibcoreService.CompileGeoIPToSrs:input_type -> libcore.CompileGeoIPToSrsRequest
|
||||||
1, // 16: libcore.LibcoreService.GetSystemDNS:input_type -> libcore.EmptyReq
|
17, // 16: libcore.LibcoreService.CompileGeoSiteToSrs:input_type -> libcore.CompileGeoSiteToSrsRequest
|
||||||
19, // 17: libcore.LibcoreService.SetSystemDNS:input_type -> libcore.SetSystemDNSRequest
|
18, // 17: libcore.LibcoreService.SetSystemProxy:input_type -> libcore.SetSystemProxyRequest
|
||||||
2, // 18: libcore.LibcoreService.Exit:output_type -> libcore.EmptyResp
|
1, // 18: libcore.LibcoreService.GetSystemDNS:input_type -> libcore.EmptyReq
|
||||||
10, // 19: libcore.LibcoreService.Update:output_type -> libcore.UpdateResp
|
19, // 19: libcore.LibcoreService.SetSystemDNS:input_type -> libcore.SetSystemDNSRequest
|
||||||
3, // 20: libcore.LibcoreService.Start:output_type -> libcore.ErrorResp
|
2, // 20: libcore.LibcoreService.Exit:output_type -> libcore.EmptyResp
|
||||||
3, // 21: libcore.LibcoreService.Stop:output_type -> libcore.ErrorResp
|
10, // 21: libcore.LibcoreService.Update:output_type -> libcore.UpdateResp
|
||||||
7, // 22: libcore.LibcoreService.Test:output_type -> libcore.TestResp
|
3, // 22: libcore.LibcoreService.Start:output_type -> libcore.ErrorResp
|
||||||
2, // 23: libcore.LibcoreService.StopTest:output_type -> libcore.EmptyResp
|
3, // 23: libcore.LibcoreService.Stop:output_type -> libcore.ErrorResp
|
||||||
8, // 24: libcore.LibcoreService.QueryStats:output_type -> libcore.QueryStatsResp
|
7, // 24: libcore.LibcoreService.Test:output_type -> libcore.TestResp
|
||||||
11, // 25: libcore.LibcoreService.ListConnections:output_type -> libcore.ListConnectionsResp
|
2, // 25: libcore.LibcoreService.StopTest:output_type -> libcore.EmptyResp
|
||||||
13, // 26: libcore.LibcoreService.GetGeoIPList:output_type -> libcore.GetGeoIPListResponse
|
8, // 26: libcore.LibcoreService.QueryStats:output_type -> libcore.QueryStatsResp
|
||||||
14, // 27: libcore.LibcoreService.GetGeoSiteList:output_type -> libcore.GetGeoSiteListResponse
|
11, // 27: libcore.LibcoreService.ListConnections:output_type -> libcore.ListConnectionsResp
|
||||||
2, // 28: libcore.LibcoreService.CompileGeoIPToSrs:output_type -> libcore.EmptyResp
|
13, // 28: libcore.LibcoreService.GetGeoIPList:output_type -> libcore.GetGeoIPListResponse
|
||||||
2, // 29: libcore.LibcoreService.CompileGeoSiteToSrs:output_type -> libcore.EmptyResp
|
14, // 29: libcore.LibcoreService.GetGeoSiteList:output_type -> libcore.GetGeoSiteListResponse
|
||||||
2, // 30: libcore.LibcoreService.SetSystemProxy:output_type -> libcore.EmptyResp
|
2, // 30: libcore.LibcoreService.CompileGeoIPToSrs:output_type -> libcore.EmptyResp
|
||||||
20, // 31: libcore.LibcoreService.GetSystemDNS:output_type -> libcore.GetSystemDNSResponse
|
2, // 31: libcore.LibcoreService.CompileGeoSiteToSrs:output_type -> libcore.EmptyResp
|
||||||
2, // 32: libcore.LibcoreService.SetSystemDNS:output_type -> libcore.EmptyResp
|
2, // 32: libcore.LibcoreService.SetSystemProxy:output_type -> libcore.EmptyResp
|
||||||
18, // [18:33] is the sub-list for method output_type
|
20, // 33: libcore.LibcoreService.GetSystemDNS:output_type -> libcore.GetSystemDNSResponse
|
||||||
3, // [3:18] is the sub-list for method input_type
|
2, // 34: libcore.LibcoreService.SetSystemDNS:output_type -> libcore.EmptyResp
|
||||||
3, // [3:3] is the sub-list for extension type_name
|
20, // [20:35] is the sub-list for method output_type
|
||||||
3, // [3:3] is the sub-list for extension extendee
|
5, // [5:20] is the sub-list for method input_type
|
||||||
0, // [0:3] is the sub-list for field type_name
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_libcore_proto_init() }
|
func init() { file_libcore_proto_init() }
|
||||||
@ -1766,7 +1757,7 @@ func file_libcore_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_libcore_proto_rawDesc,
|
RawDescriptor: file_libcore_proto_rawDesc,
|
||||||
NumEnums: 1,
|
NumEnums: 1,
|
||||||
NumMessages: 20,
|
NumMessages: 22,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 1,
|
NumServices: 1,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -58,10 +58,8 @@ message TestResp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message QueryStatsResp{
|
message QueryStatsResp{
|
||||||
int64 direct_traffic_up = 1;
|
map<string, int64> ups = 1;
|
||||||
int64 direct_traffic_down = 2;
|
map<string, int64> downs = 2;
|
||||||
int64 proxy_traffic_up = 3;
|
|
||||||
int64 proxy_traffic_down = 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum UpdateAction {
|
enum UpdateAction {
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
package boxdns
|
|
||||||
@ -26,14 +26,14 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func check() error {
|
func check() error {
|
||||||
options, err := readConfigAndMerge()
|
options, err := parseConfig(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
instance, err := boxbox.New(boxbox.Options{
|
instance, err := boxbox.New(boxbox.Options{
|
||||||
Context: ctx,
|
Context: ctx,
|
||||||
Options: options,
|
Options: *options,
|
||||||
})
|
})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
instance.Close()
|
instance.Close()
|
||||||
|
|||||||
@ -2,24 +2,19 @@ package boxmain
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/sagernet/sing/common/json"
|
"github.com/sagernet/sing-box/include"
|
||||||
"github.com/sagernet/sing/common/json/badjson"
|
"nekobox_core/internal/boxbox"
|
||||||
"io"
|
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path/filepath"
|
|
||||||
runtimeDebug "runtime/debug"
|
runtimeDebug "runtime/debug"
|
||||||
"sort"
|
|
||||||
"strings"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/matsuridayo/libneko/protect_server"
|
C "github.com/sagernet/sing-box/constant"
|
||||||
"github.com/sagernet/sing-box/log"
|
"github.com/sagernet/sing-box/log"
|
||||||
"github.com/sagernet/sing-box/option"
|
"github.com/sagernet/sing-box/option"
|
||||||
E "github.com/sagernet/sing/common/exceptions"
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
"nekobox_core/internal/boxbox"
|
"github.com/sagernet/sing/common/json"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -27,10 +22,6 @@ var commandRun = &cobra.Command{
|
|||||||
Use: "run",
|
Use: "run",
|
||||||
Short: "Run service",
|
Short: "Run service",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
if protectListenPath != "" {
|
|
||||||
// for v2ray now
|
|
||||||
go protect_server.ServeProtect(protectListenPath, true, protectFwMark, nil)
|
|
||||||
}
|
|
||||||
err := run()
|
err := run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
@ -48,111 +39,34 @@ type OptionsEntry struct {
|
|||||||
options option.Options
|
options option.Options
|
||||||
}
|
}
|
||||||
|
|
||||||
func readConfigAt(path string) (*OptionsEntry, error) {
|
func parseConfig(configContent []byte) (*option.Options, error) {
|
||||||
var (
|
var (
|
||||||
configContent []byte
|
err error
|
||||||
err error
|
|
||||||
)
|
)
|
||||||
if path == "stdin" {
|
options, err := json.UnmarshalExtendedContext[option.Options](globalCtx, configContent)
|
||||||
configContent, err = io.ReadAll(os.Stdin)
|
|
||||||
} else {
|
|
||||||
configContent, err = os.ReadFile(path)
|
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, E.Cause(err, "read config at ", path)
|
return nil, E.Cause(err, "decode config at ", string(configContent))
|
||||||
}
|
}
|
||||||
var options option.Options
|
return &options, nil
|
||||||
err = options.UnmarshalJSONContext(context.Background(), configContent)
|
|
||||||
if err != nil {
|
|
||||||
return nil, E.Cause(err, "decode config at ", path)
|
|
||||||
}
|
|
||||||
return &OptionsEntry{
|
|
||||||
content: configContent,
|
|
||||||
path: path,
|
|
||||||
options: options,
|
|
||||||
}, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func readConfig() ([]*OptionsEntry, error) {
|
func Create(configContent []byte) (*boxbox.Box, context.CancelFunc, error) {
|
||||||
var optionsList []*OptionsEntry
|
globalCtx = context.Background()
|
||||||
for _, path := range configPaths {
|
globalCtx = boxbox.Context(globalCtx, include.InboundRegistry(), include.OutboundRegistry(), include.EndpointRegistry())
|
||||||
optionsEntry, err := readConfigAt(path)
|
options, err := parseConfig(configContent)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
optionsList = append(optionsList, optionsEntry)
|
|
||||||
}
|
|
||||||
for _, directory := range configDirectories {
|
|
||||||
entries, err := os.ReadDir(directory)
|
|
||||||
if err != nil {
|
|
||||||
return nil, E.Cause(err, "read config directory at ", directory)
|
|
||||||
}
|
|
||||||
for _, entry := range entries {
|
|
||||||
if !strings.HasSuffix(entry.Name(), ".json") || entry.IsDir() {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
optionsEntry, err := readConfigAt(filepath.Join(directory, entry.Name()))
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
optionsList = append(optionsList, optionsEntry)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sort.Slice(optionsList, func(i, j int) bool {
|
|
||||||
return optionsList[i].path < optionsList[j].path
|
|
||||||
})
|
|
||||||
return optionsList, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func readConfigAndMerge() (option.Options, error) {
|
|
||||||
optionsList, err := readConfig()
|
|
||||||
if err != nil {
|
|
||||||
return option.Options{}, err
|
|
||||||
}
|
|
||||||
if len(optionsList) == 1 {
|
|
||||||
return optionsList[0].options, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var mergedMessage json.RawMessage
|
|
||||||
for _, options := range optionsList {
|
|
||||||
mergedMessage, err = badjson.MergeJSON(context.Background(), options.options.RawMessage, mergedMessage, false)
|
|
||||||
if err != nil {
|
|
||||||
return option.Options{}, E.Cause(err, "merge config at ", options.path)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var mergedOptions option.Options
|
|
||||||
err = mergedOptions.UnmarshalJSONContext(context.Background(), mergedMessage)
|
|
||||||
if err != nil {
|
|
||||||
return option.Options{}, E.Cause(err, "unmarshal merged config")
|
|
||||||
}
|
|
||||||
|
|
||||||
return mergedOptions, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func Create(nekoConfigContent []byte) (*boxbox.Box, context.CancelFunc, error) {
|
|
||||||
var options option.Options
|
|
||||||
var err error
|
|
||||||
//
|
|
||||||
if nekoConfigContent == nil {
|
|
||||||
options, err = readConfigAndMerge()
|
|
||||||
} else {
|
|
||||||
err = options.UnmarshalJSONContext(context.Background(), nekoConfigContent)
|
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
//
|
|
||||||
if disableColor {
|
if disableColor {
|
||||||
if options.Log == nil {
|
if options.Log == nil {
|
||||||
options.Log = &option.LogOptions{}
|
options.Log = &option.LogOptions{}
|
||||||
}
|
}
|
||||||
options.Log.DisableColor = true
|
options.Log.DisableColor = true
|
||||||
}
|
}
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(globalCtx)
|
||||||
instance, err := boxbox.New(boxbox.Options{
|
instance, err := boxbox.New(boxbox.Options{
|
||||||
Context: ctx,
|
Context: ctx,
|
||||||
Options: options,
|
Options: *options,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cancel()
|
cancel()
|
||||||
@ -165,14 +79,16 @@ func Create(nekoConfigContent []byte) (*boxbox.Box, context.CancelFunc, error) {
|
|||||||
signal.Stop(osSignals)
|
signal.Stop(osSignals)
|
||||||
close(osSignals)
|
close(osSignals)
|
||||||
}()
|
}()
|
||||||
|
startCtx, finishStart := context.WithCancel(context.Background())
|
||||||
go func() {
|
go func() {
|
||||||
_, loaded := <-osSignals
|
_, loaded := <-osSignals
|
||||||
if loaded {
|
if loaded {
|
||||||
cancel()
|
cancel()
|
||||||
|
closeMonitor(startCtx)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
err = instance.Start()
|
err = instance.Start()
|
||||||
|
finishStart()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cancel()
|
cancel()
|
||||||
return nil, nil, E.Cause(err, "start service")
|
return nil, nil, E.Cause(err, "start service")
|
||||||
@ -185,7 +101,7 @@ func run() error {
|
|||||||
signal.Notify(osSignals, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP)
|
signal.Notify(osSignals, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP)
|
||||||
defer signal.Stop(osSignals)
|
defer signal.Stop(osSignals)
|
||||||
for {
|
for {
|
||||||
instance, cancel, err := Create(nil)
|
instance, cancel, err := Create([]byte{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -202,9 +118,12 @@ func run() error {
|
|||||||
cancel()
|
cancel()
|
||||||
closeCtx, closed := context.WithCancel(context.Background())
|
closeCtx, closed := context.WithCancel(context.Background())
|
||||||
go closeMonitor(closeCtx)
|
go closeMonitor(closeCtx)
|
||||||
instance.Close()
|
err = instance.Close()
|
||||||
closed()
|
closed()
|
||||||
if osSignal != syscall.SIGHUP {
|
if osSignal != syscall.SIGHUP {
|
||||||
|
if err != nil {
|
||||||
|
log.Error(E.Cause(err, "sing-box did not closed properly"))
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
@ -213,7 +132,7 @@ func run() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func closeMonitor(ctx context.Context) {
|
func closeMonitor(ctx context.Context) {
|
||||||
time.Sleep(3 * time.Second)
|
time.Sleep(C.FatalStopTimeout)
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return
|
return
|
||||||
@ -221,24 +140,3 @@ func closeMonitor(ctx context.Context) {
|
|||||||
}
|
}
|
||||||
log.Fatal("sing-box did not close!")
|
log.Fatal("sing-box did not close!")
|
||||||
}
|
}
|
||||||
|
|
||||||
func MergeOptions(source option.Options, destination option.Options) (option.Options, error) {
|
|
||||||
rawSource, err := json.Marshal(source)
|
|
||||||
if err != nil {
|
|
||||||
return option.Options{}, E.Cause(err, "marshal source")
|
|
||||||
}
|
|
||||||
rawDestination, err := json.Marshal(destination)
|
|
||||||
if err != nil {
|
|
||||||
return option.Options{}, E.Cause(err, "marshal destination")
|
|
||||||
}
|
|
||||||
rawMerged, err := badjson.MergeJSON(context.Background(), rawSource, rawDestination, false)
|
|
||||||
if err != nil {
|
|
||||||
return option.Options{}, E.Cause(err, "merge options")
|
|
||||||
}
|
|
||||||
var merged option.Options
|
|
||||||
err = json.Unmarshal(rawMerged, &merged)
|
|
||||||
if err != nil {
|
|
||||||
return option.Options{}, E.Cause(err, "unmarshal merged options")
|
|
||||||
}
|
|
||||||
return merged, nil
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,24 +1,28 @@
|
|||||||
package boxmain
|
package boxmain
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/sagernet/sing-box/option"
|
"context"
|
||||||
"os"
|
"os"
|
||||||
|
"os/user"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
_ "github.com/sagernet/sing-box/include"
|
"github.com/sagernet/sing-box"
|
||||||
|
"github.com/sagernet/sing-box/experimental/deprecated"
|
||||||
|
"github.com/sagernet/sing-box/include"
|
||||||
"github.com/sagernet/sing-box/log"
|
"github.com/sagernet/sing-box/log"
|
||||||
|
"github.com/sagernet/sing/service"
|
||||||
|
"github.com/sagernet/sing/service/filemanager"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
globalCtx context.Context
|
||||||
configPaths []string
|
configPaths []string
|
||||||
configDirectories []string
|
configDirectories []string
|
||||||
workingDir string
|
workingDir string
|
||||||
disableColor bool
|
disableColor bool
|
||||||
//
|
|
||||||
protectListenPath string
|
|
||||||
protectFwMark int
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var mainCommand = &cobra.Command{
|
var mainCommand = &cobra.Command{
|
||||||
@ -31,31 +35,39 @@ func init() {
|
|||||||
mainCommand.PersistentFlags().StringArrayVarP(&configDirectories, "config-directory", "C", nil, "set configuration directory path")
|
mainCommand.PersistentFlags().StringArrayVarP(&configDirectories, "config-directory", "C", nil, "set configuration directory path")
|
||||||
mainCommand.PersistentFlags().StringVarP(&workingDir, "directory", "D", "", "set working directory")
|
mainCommand.PersistentFlags().StringVarP(&workingDir, "directory", "D", "", "set working directory")
|
||||||
mainCommand.PersistentFlags().BoolVarP(&disableColor, "disable-color", "", false, "disable color output")
|
mainCommand.PersistentFlags().BoolVarP(&disableColor, "disable-color", "", false, "disable color output")
|
||||||
mainCommand.PersistentFlags().StringVarP(&protectListenPath, "protect-listen-path", "", "", "Linux Only")
|
|
||||||
mainCommand.PersistentFlags().IntVarP(&protectFwMark, "protect-fwmark", "", 0, "Linux Only")
|
|
||||||
}
|
|
||||||
|
|
||||||
func Main() {
|
|
||||||
if err := mainCommand.Execute(); err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func preRun(cmd *cobra.Command, args []string) {
|
func preRun(cmd *cobra.Command, args []string) {
|
||||||
|
globalCtx = context.Background()
|
||||||
|
sudoUser := os.Getenv("SUDO_USER")
|
||||||
|
sudoUID, _ := strconv.Atoi(os.Getenv("SUDO_UID"))
|
||||||
|
sudoGID, _ := strconv.Atoi(os.Getenv("SUDO_GID"))
|
||||||
|
if sudoUID == 0 && sudoGID == 0 && sudoUser != "" {
|
||||||
|
sudoUserObject, _ := user.Lookup(sudoUser)
|
||||||
|
if sudoUserObject != nil {
|
||||||
|
sudoUID, _ = strconv.Atoi(sudoUserObject.Uid)
|
||||||
|
sudoGID, _ = strconv.Atoi(sudoUserObject.Gid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if sudoUID > 0 && sudoGID > 0 {
|
||||||
|
globalCtx = filemanager.WithDefault(globalCtx, "", "", sudoUID, sudoGID)
|
||||||
|
}
|
||||||
if disableColor {
|
if disableColor {
|
||||||
factory, _ := log.New(log.Options{Options: option.LogOptions{Output: "stderr", DisableColor: true}, BaseTime: time.Now()})
|
log.SetStdLogger(log.NewDefaultFactory(context.Background(), log.Formatter{BaseTime: time.Now(), DisableColors: true}, os.Stderr, "", nil, false).Logger())
|
||||||
log.SetStdLogger(factory.Logger())
|
|
||||||
}
|
}
|
||||||
if workingDir != "" {
|
if workingDir != "" {
|
||||||
_, err := os.Stat(workingDir)
|
_, err := os.Stat(workingDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
os.MkdirAll(workingDir, 0o777)
|
filemanager.MkdirAll(globalCtx, workingDir, 0o777)
|
||||||
}
|
}
|
||||||
if err := os.Chdir(workingDir); err != nil {
|
err = os.Chdir(workingDir)
|
||||||
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(configPaths) == 0 && len(configDirectories) == 0 {
|
if len(configPaths) == 0 && len(configDirectories) == 0 {
|
||||||
configPaths = append(configPaths, "config.json")
|
configPaths = append(configPaths, "config.json")
|
||||||
}
|
}
|
||||||
|
globalCtx = service.ContextWith(globalCtx, deprecated.NewStderrManager(log.StdLogger()))
|
||||||
|
globalCtx = box.Context(globalCtx, include.InboundRegistry(), include.OutboundRegistry(), include.EndpointRegistry())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,7 +58,7 @@ func RunCore() {
|
|||||||
)
|
)
|
||||||
gen.RegisterLibcoreServiceServer(s, &server{})
|
gen.RegisterLibcoreServiceServer(s, &server{})
|
||||||
|
|
||||||
log.Printf("Core grpc server listening at %v\n", lis.Addr())
|
fmt.Printf("Core listening at %v\n", lis.Addr())
|
||||||
if err := s.Serve(lis); err != nil {
|
if err := s.Serve(lis); err != nil {
|
||||||
log.Fatalf("failed to serve: %v", err)
|
log.Fatalf("failed to serve: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/sagernet/sing/service"
|
"github.com/sagernet/sing/service"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
gen2 "nekobox_core/gen"
|
"nekobox_core/gen"
|
||||||
"nekobox_core/internal/boxapi"
|
"nekobox_core/internal/boxapi"
|
||||||
"nekobox_core/internal/boxbox"
|
"nekobox_core/internal/boxbox"
|
||||||
"nekobox_core/internal/boxmain"
|
"nekobox_core/internal/boxmain"
|
||||||
@ -32,22 +32,22 @@ var instanceCancel context.CancelFunc
|
|||||||
var debug bool
|
var debug bool
|
||||||
|
|
||||||
type server struct {
|
type server struct {
|
||||||
gen2.LibcoreServiceServer
|
gen.UnimplementedLibcoreServiceServer
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) Exit(ctx context.Context, in *gen2.EmptyReq) (out *gen2.EmptyResp, _ error) {
|
func (s *server) Exit(ctx context.Context, in *gen.EmptyReq) (out *gen.EmptyResp, _ error) {
|
||||||
out = &gen2.EmptyResp{}
|
out = &gen.EmptyResp{}
|
||||||
|
|
||||||
// Connection closed
|
// Connection closed
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) Start(ctx context.Context, in *gen2.LoadConfigReq) (out *gen2.ErrorResp, _ error) {
|
func (s *server) Start(ctx context.Context, in *gen.LoadConfigReq) (out *gen.ErrorResp, _ error) {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
out = &gen2.ErrorResp{}
|
out = &gen.ErrorResp{}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
out.Error = err.Error()
|
out.Error = err.Error()
|
||||||
boxInstance = nil
|
boxInstance = nil
|
||||||
@ -75,11 +75,11 @@ func (s *server) Start(ctx context.Context, in *gen2.LoadConfigReq) (out *gen2.E
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) Stop(ctx context.Context, in *gen2.EmptyReq) (out *gen2.ErrorResp, _ error) {
|
func (s *server) Stop(ctx context.Context, in *gen.EmptyReq) (out *gen.ErrorResp, _ error) {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
out = &gen2.ErrorResp{}
|
out = &gen.ErrorResp{}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
out.Error = err.Error()
|
out.Error = err.Error()
|
||||||
}
|
}
|
||||||
@ -103,14 +103,14 @@ func (s *server) Stop(ctx context.Context, in *gen2.EmptyReq) (out *gen2.ErrorRe
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) Test(ctx context.Context, in *gen2.TestReq) (*gen2.TestResp, error) {
|
func (s *server) Test(ctx context.Context, in *gen.TestReq) (*gen.TestResp, error) {
|
||||||
var testInstance *boxbox.Box
|
var testInstance *boxbox.Box
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
var err error
|
var err error
|
||||||
var twice = true
|
var twice = true
|
||||||
if in.TestCurrent {
|
if in.TestCurrent {
|
||||||
if boxInstance == nil {
|
if boxInstance == nil {
|
||||||
return &gen2.TestResp{Results: []*gen2.URLTestResp{{
|
return &gen.TestResp{Results: []*gen.URLTestResp{{
|
||||||
OutboundTag: "proxy",
|
OutboundTag: "proxy",
|
||||||
LatencyMs: 0,
|
LatencyMs: 0,
|
||||||
Error: "Instance is not running",
|
Error: "Instance is not running",
|
||||||
@ -139,31 +139,34 @@ func (s *server) Test(ctx context.Context, in *gen2.TestReq) (*gen2.TestResp, er
|
|||||||
}
|
}
|
||||||
results := BatchURLTest(testCtx, testInstance, outboundTags, in.Url, int(maxConcurrency), twice)
|
results := BatchURLTest(testCtx, testInstance, outboundTags, in.Url, int(maxConcurrency), twice)
|
||||||
|
|
||||||
res := make([]*gen2.URLTestResp, 0)
|
res := make([]*gen.URLTestResp, 0)
|
||||||
for idx, data := range results {
|
for idx, data := range results {
|
||||||
errStr := ""
|
errStr := ""
|
||||||
if data.Error != nil {
|
if data.Error != nil {
|
||||||
errStr = data.Error.Error()
|
errStr = data.Error.Error()
|
||||||
}
|
}
|
||||||
res = append(res, &gen2.URLTestResp{
|
res = append(res, &gen.URLTestResp{
|
||||||
OutboundTag: outboundTags[idx],
|
OutboundTag: outboundTags[idx],
|
||||||
LatencyMs: int32(data.Duration.Milliseconds()),
|
LatencyMs: int32(data.Duration.Milliseconds()),
|
||||||
Error: errStr,
|
Error: errStr,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return &gen2.TestResp{Results: res}, nil
|
return &gen.TestResp{Results: res}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) StopTest(ctx context.Context, in *gen2.EmptyReq) (*gen2.EmptyResp, error) {
|
func (s *server) StopTest(ctx context.Context, in *gen.EmptyReq) (*gen.EmptyResp, error) {
|
||||||
cancelTests()
|
cancelTests()
|
||||||
testCtx, cancelTests = context.WithCancel(context.Background())
|
testCtx, cancelTests = context.WithCancel(context.Background())
|
||||||
|
|
||||||
return &gen2.EmptyResp{}, nil
|
return &gen.EmptyResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) QueryStats(ctx context.Context, _ *gen2.EmptyReq) (*gen2.QueryStatsResp, error) {
|
func (s *server) QueryStats(ctx context.Context, _ *gen.EmptyReq) (*gen.QueryStatsResp, error) {
|
||||||
resp := &gen2.QueryStatsResp{}
|
resp := &gen.QueryStatsResp{
|
||||||
|
Ups: make(map[string]int64),
|
||||||
|
Downs: make(map[string]int64),
|
||||||
|
}
|
||||||
if boxInstance != nil {
|
if boxInstance != nil {
|
||||||
clash := service.FromContext[adapter.ClashServer](boxInstance.Context())
|
clash := service.FromContext[adapter.ClashServer](boxInstance.Context())
|
||||||
if clash != nil {
|
if clash != nil {
|
||||||
@ -172,20 +175,19 @@ func (s *server) QueryStats(ctx context.Context, _ *gen2.EmptyReq) (*gen2.QueryS
|
|||||||
log.Println("Failed to assert clash server")
|
log.Println("Failed to assert clash server")
|
||||||
return nil, E.New("invalid clash server type")
|
return nil, E.New("invalid clash server type")
|
||||||
}
|
}
|
||||||
outbounds := service.FromContext[adapter.OutboundManager](ctx)
|
outbounds := service.FromContext[adapter.OutboundManager](boxInstance.Context())
|
||||||
if outbounds == nil {
|
if outbounds == nil {
|
||||||
log.Println("Failed to assert outbound manager")
|
log.Println("Failed to assert outbound manager")
|
||||||
return nil, E.New("invalid outbound manager type")
|
return nil, E.New("invalid outbound manager type")
|
||||||
}
|
}
|
||||||
for _, out := range outbounds.Outbounds() {
|
for _, out := range outbounds.Outbounds() {
|
||||||
u, d := cApi.TrafficManager().TotalOutbound(out.Tag())
|
if len(out.Dependencies()) > 0 {
|
||||||
if strings.ToLower(out.Tag()) == "direct" {
|
// ignore, has detour
|
||||||
resp.DirectTrafficUp += u
|
continue
|
||||||
resp.DirectTrafficDown += d
|
|
||||||
} else {
|
|
||||||
resp.ProxyTrafficUp += u
|
|
||||||
resp.ProxyTrafficDown += d
|
|
||||||
}
|
}
|
||||||
|
u, d := cApi.TrafficManager().TotalOutbound(out.Tag())
|
||||||
|
resp.Ups[out.Tag()] = u
|
||||||
|
resp.Downs[out.Tag()] = d
|
||||||
}
|
}
|
||||||
cApi.TrafficManager().ResetStatistic()
|
cApi.TrafficManager().ResetStatistic()
|
||||||
}
|
}
|
||||||
@ -194,9 +196,9 @@ func (s *server) QueryStats(ctx context.Context, _ *gen2.EmptyReq) (*gen2.QueryS
|
|||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) ListConnections(ctx context.Context, in *gen2.EmptyReq) (*gen2.ListConnectionsResp, error) {
|
func (s *server) ListConnections(ctx context.Context, in *gen.EmptyReq) (*gen.ListConnectionsResp, error) {
|
||||||
if boxInstance == nil {
|
if boxInstance == nil {
|
||||||
return &gen2.ListConnectionsResp{}, nil
|
return &gen.ListConnectionsResp{}, nil
|
||||||
}
|
}
|
||||||
if service.FromContext[adapter.ClashServer](boxInstance.Context()) == nil {
|
if service.FromContext[adapter.ClashServer](boxInstance.Context()) == nil {
|
||||||
return nil, errors.New("no clash server found")
|
return nil, errors.New("no clash server found")
|
||||||
@ -207,14 +209,14 @@ func (s *server) ListConnections(ctx context.Context, in *gen2.EmptyReq) (*gen2.
|
|||||||
}
|
}
|
||||||
connections := clash.TrafficManager().Connections()
|
connections := clash.TrafficManager().Connections()
|
||||||
|
|
||||||
res := make([]*gen2.ConnectionMetaData, 0)
|
res := make([]*gen.ConnectionMetaData, 0)
|
||||||
for _, c := range connections {
|
for _, c := range connections {
|
||||||
process := ""
|
process := ""
|
||||||
if c.Metadata.ProcessInfo != nil {
|
if c.Metadata.ProcessInfo != nil {
|
||||||
spl := strings.Split(c.Metadata.ProcessInfo.ProcessPath, string(os.PathSeparator))
|
spl := strings.Split(c.Metadata.ProcessInfo.ProcessPath, string(os.PathSeparator))
|
||||||
process = spl[len(spl)-1]
|
process = spl[len(spl)-1]
|
||||||
}
|
}
|
||||||
r := &gen2.ConnectionMetaData{
|
r := &gen.ConnectionMetaData{
|
||||||
Id: c.ID.String(),
|
Id: c.ID.String(),
|
||||||
CreatedAt: c.CreatedAt.UnixMilli(),
|
CreatedAt: c.CreatedAt.UnixMilli(),
|
||||||
Upload: c.Upload.Load(),
|
Upload: c.Upload.Load(),
|
||||||
@ -228,13 +230,13 @@ func (s *server) ListConnections(ctx context.Context, in *gen2.EmptyReq) (*gen2.
|
|||||||
}
|
}
|
||||||
res = append(res, r)
|
res = append(res, r)
|
||||||
}
|
}
|
||||||
out := &gen2.ListConnectionsResp{
|
out := &gen.ListConnectionsResp{
|
||||||
Connections: res,
|
Connections: res,
|
||||||
}
|
}
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) GetGeoIPList(ctx context.Context, in *gen2.GeoListRequest) (*gen2.GetGeoIPListResponse, error) {
|
func (s *server) GetGeoIPList(ctx context.Context, in *gen.GeoListRequest) (*gen.GetGeoIPListResponse, error) {
|
||||||
resp, err := boxmain.ListGeoip(in.Path + string(os.PathSeparator) + "geoip.db")
|
resp, err := boxmain.ListGeoip(in.Path + string(os.PathSeparator) + "geoip.db")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -246,10 +248,10 @@ func (s *server) GetGeoIPList(ctx context.Context, in *gen2.GeoListRequest) (*ge
|
|||||||
res = append(res, r)
|
res = append(res, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &gen2.GetGeoIPListResponse{Items: res}, nil
|
return &gen.GetGeoIPListResponse{Items: res}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) GetGeoSiteList(ctx context.Context, in *gen2.GeoListRequest) (*gen2.GetGeoSiteListResponse, error) {
|
func (s *server) GetGeoSiteList(ctx context.Context, in *gen.GeoListRequest) (*gen.GetGeoSiteListResponse, error) {
|
||||||
resp, err := boxmain.GeositeList(in.Path + string(os.PathSeparator) + "geosite.db")
|
resp, err := boxmain.GeositeList(in.Path + string(os.PathSeparator) + "geosite.db")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -261,30 +263,30 @@ func (s *server) GetGeoSiteList(ctx context.Context, in *gen2.GeoListRequest) (*
|
|||||||
res = append(res, r)
|
res = append(res, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &gen2.GetGeoSiteListResponse{Items: res}, nil
|
return &gen.GetGeoSiteListResponse{Items: res}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) CompileGeoIPToSrs(ctx context.Context, in *gen2.CompileGeoIPToSrsRequest) (*gen2.EmptyResp, error) {
|
func (s *server) CompileGeoIPToSrs(ctx context.Context, in *gen.CompileGeoIPToSrsRequest) (*gen.EmptyResp, error) {
|
||||||
category := strings.TrimSuffix(in.Item, "_IP")
|
category := strings.TrimSuffix(in.Item, "_IP")
|
||||||
err := boxmain.CompileRuleSet(in.Path+string(os.PathSeparator)+"geoip.db", category, boxmain.IpRuleSet, "./rule_sets/"+in.Item+".srs")
|
err := boxmain.CompileRuleSet(in.Path+string(os.PathSeparator)+"geoip.db", category, boxmain.IpRuleSet, "./rule_sets/"+in.Item+".srs")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &gen2.EmptyResp{}, nil
|
return &gen.EmptyResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) CompileGeoSiteToSrs(ctx context.Context, in *gen2.CompileGeoSiteToSrsRequest) (*gen2.EmptyResp, error) {
|
func (s *server) CompileGeoSiteToSrs(ctx context.Context, in *gen.CompileGeoSiteToSrsRequest) (*gen.EmptyResp, error) {
|
||||||
category := strings.TrimSuffix(in.Item, "_SITE")
|
category := strings.TrimSuffix(in.Item, "_SITE")
|
||||||
err := boxmain.CompileRuleSet(in.Path+string(os.PathSeparator)+"geosite.db", category, boxmain.SiteRuleSet, "./rule_sets/"+in.Item+".srs")
|
err := boxmain.CompileRuleSet(in.Path+string(os.PathSeparator)+"geosite.db", category, boxmain.SiteRuleSet, "./rule_sets/"+in.Item+".srs")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &gen2.EmptyResp{}, nil
|
return &gen.EmptyResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) SetSystemProxy(ctx context.Context, in *gen2.SetSystemProxyRequest) (*gen2.EmptyResp, error) {
|
func (s *server) SetSystemProxy(ctx context.Context, in *gen.SetSystemProxyRequest) (*gen.EmptyResp, error) {
|
||||||
var err error
|
var err error
|
||||||
addr := metadata.ParseSocksaddr(in.Address)
|
addr := metadata.ParseSocksaddr(in.Address)
|
||||||
if systemProxyController == nil || systemProxyAddr.String() != addr.String() {
|
if systemProxyController == nil || systemProxyAddr.String() != addr.String() {
|
||||||
@ -304,16 +306,16 @@ func (s *server) SetSystemProxy(ctx context.Context, in *gen2.SetSystemProxyRequ
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &gen2.EmptyResp{}, nil
|
return &gen.EmptyResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) Update(ctx context.Context, in *gen2.UpdateReq) (*gen2.UpdateResp, error) {
|
func (s *server) Update(ctx context.Context, in *gen.UpdateReq) (*gen.UpdateResp, error) {
|
||||||
var updateDownloadUrl string
|
var updateDownloadUrl string
|
||||||
ret := &gen2.UpdateResp{}
|
ret := &gen.UpdateResp{}
|
||||||
|
|
||||||
client := boxapi.CreateProxyHttpClient(boxInstance)
|
client := boxapi.CreateProxyHttpClient(boxInstance)
|
||||||
|
|
||||||
if in.Action == gen2.UpdateAction_Check { // Check update
|
if in.Action == gen.UpdateAction_Check { // Check update
|
||||||
ctx, cancel := context.WithTimeout(ctx, time.Second*10)
|
ctx, cancel := context.WithTimeout(ctx, time.Second*10)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#ifndef NKR_NO_GRPC
|
#ifndef NKR_NO_GRPC
|
||||||
|
|
||||||
#include "core/cmd/nekobox_core/server/gen/libcore.pb.h"
|
#include "core/server/gen/libcore.pb.h"
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
namespace QtGrpc {
|
namespace QtGrpc {
|
||||||
@ -24,7 +24,7 @@ namespace NekoGui_rpc {
|
|||||||
|
|
||||||
QString Stop(bool *rpcOK);
|
QString Stop(bool *rpcOK);
|
||||||
|
|
||||||
long long QueryStats(const std::string &tag, const std::string &direct);
|
libcore::QueryStatsResp QueryStats();
|
||||||
|
|
||||||
libcore::TestResp Test(bool *rpcOK, const libcore::TestReq &request);
|
libcore::TestResp Test(bool *rpcOK, const libcore::TestReq &request);
|
||||||
|
|
||||||
|
|||||||
@ -10,8 +10,6 @@ namespace NekoGui {
|
|||||||
QJsonObject coreConfig;
|
QJsonObject coreConfig;
|
||||||
|
|
||||||
QList<std::shared_ptr<NekoGui_traffic::TrafficData>> outboundStats; // all, but not including "bypass" "block"
|
QList<std::shared_ptr<NekoGui_traffic::TrafficData>> outboundStats; // all, but not including "bypass" "block"
|
||||||
std::shared_ptr<NekoGui_traffic::TrafficData> outboundStat; // main
|
|
||||||
QStringList ignoreConnTag;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class BuildTestConfigResult {
|
class BuildTestConfigResult {
|
||||||
|
|||||||
@ -39,7 +39,7 @@ namespace NekoGui {
|
|||||||
bool invert = false;
|
bool invert = false;
|
||||||
int outboundID = -2; // -1 is proxy -2 is direct -3 is block -4 is dns_out
|
int outboundID = -2; // -1 is proxy -2 is direct -3 is block -4 is dns_out
|
||||||
// since sing-box 1.11.0
|
// since sing-box 1.11.0
|
||||||
QString actionType = "route";
|
QString action = "route";
|
||||||
|
|
||||||
// reject options
|
// reject options
|
||||||
QString rejectMethod;
|
QString rejectMethod;
|
||||||
|
|||||||
@ -14,16 +14,12 @@ namespace NekoGui_traffic {
|
|||||||
QMutex loop_mutex;
|
QMutex loop_mutex;
|
||||||
|
|
||||||
QList<std::shared_ptr<TrafficData>> items;
|
QList<std::shared_ptr<TrafficData>> items;
|
||||||
TrafficData *proxy = nullptr;
|
std::shared_ptr<TrafficData> proxy;
|
||||||
|
std::shared_ptr<TrafficData> direct;
|
||||||
|
|
||||||
void UpdateAll();
|
void UpdateAll();
|
||||||
|
|
||||||
void Loop();
|
void Loop();
|
||||||
|
|
||||||
private:
|
|
||||||
TrafficData *direct = new TrafficData("direct");
|
|
||||||
|
|
||||||
[[nodiscard]] static TrafficData *update_stats(TrafficData *item);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern TrafficLooper *trafficLooper;
|
extern TrafficLooper *trafficLooper;
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
#include "include/api/gRPC.h"
|
#include "include/api/gRPC.h"
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <QStringList>
|
|
||||||
|
|
||||||
#include "include/global/NekoGui.hpp"
|
#include "include/global/NekoGui.hpp"
|
||||||
|
|
||||||
@ -13,8 +12,6 @@
|
|||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QAbstractNetworkCache>
|
#include <QAbstractNetworkCache>
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
namespace QtGrpc {
|
namespace QtGrpc {
|
||||||
const char *GrpcAcceptEncodingHeader = "grpc-accept-encoding";
|
const char *GrpcAcceptEncodingHeader = "grpc-accept-encoding";
|
||||||
const char *AcceptEncodingHeader = "accept-encoding";
|
const char *AcceptEncodingHeader = "accept-encoding";
|
||||||
@ -55,28 +52,22 @@ namespace QtGrpc {
|
|||||||
|
|
||||||
QString url_base;
|
QString url_base;
|
||||||
QString serviceName;
|
QString serviceName;
|
||||||
QByteArray nekoray_auth;
|
|
||||||
|
|
||||||
// async
|
// async
|
||||||
QNetworkReply *post(const QString &method, const QString &service, const QByteArray &args) {
|
QNetworkReply *post(const QString &method, const QString &service, const QByteArray &args) {
|
||||||
QUrl callUrl = url_base + "/" + service + "/" + method;
|
QUrl callUrl = url_base + "/" + service + "/" + method;
|
||||||
// qDebug() << "Service call url: " << callUrl;
|
|
||||||
|
|
||||||
QNetworkRequest request(callUrl);
|
QNetworkRequest request(callUrl);
|
||||||
// request.setAttribute(QNetworkRequest::CacheSaveControlAttribute, false);
|
|
||||||
// request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork);
|
|
||||||
request.setAttribute(QNetworkRequest::Http2DirectAttribute, true);
|
request.setAttribute(QNetworkRequest::Http2DirectAttribute, true);
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String{"application/grpc"});
|
request.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String{"application/grpc"});
|
||||||
request.setRawHeader("Cache-Control", "no-store");
|
request.setRawHeader("Cache-Control", "no-store");
|
||||||
request.setRawHeader(GrpcAcceptEncodingHeader, QByteArray{"identity,deflate,gzip"});
|
request.setRawHeader(GrpcAcceptEncodingHeader, QByteArray{"identity,deflate,gzip"});
|
||||||
request.setRawHeader(AcceptEncodingHeader, QByteArray{"identity,gzip"});
|
request.setRawHeader(AcceptEncodingHeader, QByteArray{"identity,gzip"});
|
||||||
request.setRawHeader(TEHeader, QByteArray{"trailers"});
|
request.setRawHeader(TEHeader, QByteArray{"trailers"});
|
||||||
request.setRawHeader("nekoray_auth", nekoray_auth);
|
|
||||||
|
|
||||||
QByteArray msg(GrpcMessageSizeHeaderSize, '\0');
|
QByteArray msg(GrpcMessageSizeHeaderSize, '\0');
|
||||||
*reinterpret_cast<int *>(msg.data() + 1) = qToBigEndian((int) args.size());
|
*reinterpret_cast<int *>(msg.data() + 1) = qToBigEndian((int) args.size());
|
||||||
msg += args;
|
msg += args;
|
||||||
// qDebug() << "SEND: " << msg.size();
|
|
||||||
|
|
||||||
QNetworkReply *networkReply = nm->post(request, msg);
|
QNetworkReply *networkReply = nm->post(request, msg);
|
||||||
return networkReply;
|
return networkReply;
|
||||||
@ -128,8 +119,6 @@ namespace QtGrpc {
|
|||||||
|
|
||||||
auto grpcStatus = QNetworkReply::NetworkError::ProtocolUnknownError;
|
auto grpcStatus = QNetworkReply::NetworkError::ProtocolUnknownError;
|
||||||
qByteArray = processReply(networkReply, grpcStatus);
|
qByteArray = processReply(networkReply, grpcStatus);
|
||||||
// qDebug() << __func__ << "RECV: " << qByteArray.toHex() << "grpcStatus" << grpcStatus;
|
|
||||||
// qDebug() << networkReply->rawHeaderPairs();
|
|
||||||
|
|
||||||
networkReply->deleteLater();
|
networkReply->deleteLater();
|
||||||
return grpcStatus;
|
return grpcStatus;
|
||||||
@ -138,7 +127,6 @@ namespace QtGrpc {
|
|||||||
public:
|
public:
|
||||||
Http2GrpcChannelPrivate(const QString &url_, const QString &nekoray_auth_, const QString &serviceName_) {
|
Http2GrpcChannelPrivate(const QString &url_, const QString &nekoray_auth_, const QString &serviceName_) {
|
||||||
url_base = "http://" + url_;
|
url_base = "http://" + url_;
|
||||||
nekoray_auth = nekoray_auth_.toLatin1();
|
|
||||||
serviceName = serviceName_;
|
serviceName = serviceName_;
|
||||||
//
|
//
|
||||||
thread = new QThread;
|
thread = new QThread;
|
||||||
@ -237,18 +225,16 @@ namespace NekoGui_rpc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long long Client::QueryStats(const std::string &tag, const std::string &direct) {
|
libcore::QueryStatsResp Client::QueryStats() {
|
||||||
libcore::QueryStatsReq request;
|
libcore::EmptyReq request;
|
||||||
request.set_tag(tag);
|
|
||||||
request.set_direct(direct);
|
|
||||||
|
|
||||||
libcore::QueryStatsResp reply;
|
libcore::QueryStatsResp reply;
|
||||||
auto status = default_grpc_channel->Call("QueryStats", request, &reply, 500);
|
auto status = default_grpc_channel->Call("QueryStats", request, &reply, 500);
|
||||||
|
|
||||||
if (status == QNetworkReply::NoError) {
|
if (status == QNetworkReply::NoError) {
|
||||||
return reply.traffic();
|
return reply;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -246,28 +246,15 @@ namespace NekoGui {
|
|||||||
tagOut = "proxy";
|
tagOut = "proxy";
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignoreConnTag
|
|
||||||
if (index != 0) {
|
|
||||||
status->result->ignoreConnTag << tagOut;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (index > 0) {
|
if (index > 0) {
|
||||||
// chain rules: past
|
// chain rules: past
|
||||||
if (pastExternalStat == 0) {
|
auto replaced = status->outbounds.last().toObject();
|
||||||
auto replaced = status->outbounds.last().toObject();
|
replaced["detour"] = tagOut;
|
||||||
replaced["detour"] = tagOut;
|
status->outbounds.removeLast();
|
||||||
status->outbounds.removeLast();
|
status->outbounds += replaced;
|
||||||
status->outbounds += replaced;
|
|
||||||
} else {
|
|
||||||
status->routingRules += QJsonObject{
|
|
||||||
{"inbound", QJsonArray{pastTag + "-mapping"}},
|
|
||||||
{"outbound", tagOut},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// index == 0 means last profile in chain / not chain
|
// index == 0 means last profile in chain / not chain
|
||||||
chainTagOut = tagOut;
|
chainTagOut = tagOut;
|
||||||
status->result->outboundStat = ent->traffic_data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Outbound
|
// Outbound
|
||||||
@ -276,7 +263,6 @@ namespace NekoGui {
|
|||||||
|
|
||||||
BuildOutbound(ent, status, outbound, tagOut);
|
BuildOutbound(ent, status, outbound, tagOut);
|
||||||
|
|
||||||
|
|
||||||
// apply custom outbound settings
|
// apply custom outbound settings
|
||||||
MergeJson(QString2QJsonObject(ent->bean->custom_outbound), outbound);
|
MergeJson(QString2QJsonObject(ent->bean->custom_outbound), outbound);
|
||||||
|
|
||||||
@ -433,11 +419,12 @@ namespace NekoGui {
|
|||||||
auto tagProxy = BuildChain(status->chainID, status);
|
auto tagProxy = BuildChain(status->chainID, status);
|
||||||
if (!status->result->error.isEmpty()) return;
|
if (!status->result->error.isEmpty()) return;
|
||||||
|
|
||||||
// direct & block & dns-out
|
// direct
|
||||||
status->outbounds += QJsonObject{
|
status->outbounds += QJsonObject{
|
||||||
{"type", "direct"},
|
{"type", "direct"},
|
||||||
{"tag", "direct"},
|
{"tag", "direct"},
|
||||||
};
|
};
|
||||||
|
status->result->outboundStats += std::make_shared<NekoGui_traffic::TrafficData>("direct");
|
||||||
status->outbounds += QJsonObject{
|
status->outbounds += QJsonObject{
|
||||||
{"type", "block"},
|
{"type", "block"},
|
||||||
{"tag", "block"},
|
{"tag", "block"},
|
||||||
@ -715,7 +702,7 @@ namespace NekoGui {
|
|||||||
// experimental
|
// experimental
|
||||||
QJsonObject experimentalObj;
|
QJsonObject experimentalObj;
|
||||||
QJsonObject clash_api = {
|
QJsonObject clash_api = {
|
||||||
{"default_mode", "Rule"} // dummy to make sure it is created
|
{"default_mode", ""} // dummy to make sure it is created
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!status->forTest)
|
if (!status->forTest)
|
||||||
|
|||||||
@ -46,7 +46,7 @@ namespace NekoGui {
|
|||||||
rule_set << other.rule_set;
|
rule_set << other.rule_set;
|
||||||
invert = other.invert;
|
invert = other.invert;
|
||||||
outboundID = other.outboundID;
|
outboundID = other.outboundID;
|
||||||
actionType = other.actionType;
|
action = other.action;
|
||||||
rejectMethod = other.rejectMethod;
|
rejectMethod = other.rejectMethod;
|
||||||
no_drop = other.no_drop;
|
no_drop = other.no_drop;
|
||||||
override_address = other.override_address;
|
override_address = other.override_address;
|
||||||
@ -78,7 +78,7 @@ namespace NekoGui {
|
|||||||
_add(new configItem("rule_set", &rule_set, itemType::stringList));
|
_add(new configItem("rule_set", &rule_set, itemType::stringList));
|
||||||
_add(new configItem("invert", &invert, itemType::boolean));
|
_add(new configItem("invert", &invert, itemType::boolean));
|
||||||
_add(new configItem("outboundID", &outboundID, itemType::integer));
|
_add(new configItem("outboundID", &outboundID, itemType::integer));
|
||||||
_add(new configItem("actionType", &actionType, itemType::string));
|
_add(new configItem("actionType", &action, itemType::string));
|
||||||
_add(new configItem("rejectMethod", &rejectMethod, itemType::string));
|
_add(new configItem("rejectMethod", &rejectMethod, itemType::string));
|
||||||
_add(new configItem("noDrop", &no_drop, itemType::boolean));
|
_add(new configItem("noDrop", &no_drop, itemType::boolean));
|
||||||
_add(new configItem("override_address", &override_address, itemType::string));
|
_add(new configItem("override_address", &override_address, itemType::string));
|
||||||
@ -113,24 +113,24 @@ namespace NekoGui {
|
|||||||
if (isValidStrArray(rule_set)) obj["rule_set"] = get_as_array(rule_set);
|
if (isValidStrArray(rule_set)) obj["rule_set"] = get_as_array(rule_set);
|
||||||
if (invert) obj["invert"] = invert;
|
if (invert) obj["invert"] = invert;
|
||||||
// fix action type
|
// fix action type
|
||||||
if (actionType == "route")
|
if (action == "route")
|
||||||
{
|
{
|
||||||
if (outboundID == -3) actionType = "reject";
|
if (outboundID == -3) action = "reject";
|
||||||
if (outboundID == -4) actionType = "resolve";
|
if (outboundID == -4) action = "hijack-dns";
|
||||||
}
|
}
|
||||||
obj["action_type"] = actionType;
|
obj["action"] = action;
|
||||||
|
|
||||||
if (actionType == "reject")
|
if (action == "reject")
|
||||||
{
|
{
|
||||||
if (!rejectMethod.isEmpty()) obj["reject_method"] = rejectMethod;
|
if (!rejectMethod.isEmpty()) obj["reject_method"] = rejectMethod;
|
||||||
if (no_drop) obj["no_drop"] = no_drop;
|
if (no_drop) obj["no_drop"] = no_drop;
|
||||||
}
|
}
|
||||||
if (actionType == "route" || actionType == "route-options")
|
if (action == "route" || action == "route-options")
|
||||||
{
|
{
|
||||||
if (!override_address.isEmpty()) obj["override_address"] = override_address;
|
if (!override_address.isEmpty()) obj["override_address"] = override_address;
|
||||||
if (override_port.toInt() > 0) obj["override_port"] = override_port.toInt();
|
if (override_port.toInt() > 0) obj["override_port"] = override_port.toInt();
|
||||||
|
|
||||||
if (actionType == "route")
|
if (action == "route")
|
||||||
{
|
{
|
||||||
if (forView) {
|
if (forView) {
|
||||||
switch (outboundID) { // TODO use constants
|
switch (outboundID) { // TODO use constants
|
||||||
@ -154,12 +154,12 @@ namespace NekoGui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (actionType == "sniff")
|
if (action == "sniff")
|
||||||
{
|
{
|
||||||
if (isValidStrArray(sniffers)) obj["sniffers"] = get_as_array(sniffers);
|
if (isValidStrArray(sniffers)) obj["sniffers"] = get_as_array(sniffers);
|
||||||
if (sniffOverrideDest) obj["override_destination"] = sniffOverrideDest;
|
if (sniffOverrideDest) obj["override_destination"] = sniffOverrideDest;
|
||||||
}
|
}
|
||||||
if (actionType == "resolve")
|
if (action == "resolve")
|
||||||
{
|
{
|
||||||
if (!strategy.isEmpty()) obj["strategy"] = strategy;
|
if (!strategy.isEmpty()) obj["strategy"] = strategy;
|
||||||
}
|
}
|
||||||
@ -192,7 +192,7 @@ namespace NekoGui {
|
|||||||
"process_path_regex",
|
"process_path_regex",
|
||||||
"rule_set",
|
"rule_set",
|
||||||
"invert",
|
"invert",
|
||||||
"action_type",
|
"action",
|
||||||
"outbound",
|
"outbound",
|
||||||
"override_address",
|
"override_address",
|
||||||
"override_port",
|
"override_port",
|
||||||
@ -213,7 +213,7 @@ namespace NekoGui {
|
|||||||
if (fieldName == "ip_version" ||
|
if (fieldName == "ip_version" ||
|
||||||
fieldName == "network" ||
|
fieldName == "network" ||
|
||||||
fieldName == "protocol" ||
|
fieldName == "protocol" ||
|
||||||
fieldName == "action_type" ||
|
fieldName == "action" ||
|
||||||
fieldName == "method" ||
|
fieldName == "method" ||
|
||||||
fieldName == "strategy" ||
|
fieldName == "strategy" ||
|
||||||
fieldName == "outbound") return select;
|
fieldName == "outbound") return select;
|
||||||
@ -233,7 +233,7 @@ namespace NekoGui {
|
|||||||
resp.prepend("");
|
resp.prepend("");
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
if (fieldName == "action_type")
|
if (fieldName == "action")
|
||||||
{
|
{
|
||||||
return Preset::SingBox::ActionTypes;
|
return Preset::SingBox::ActionTypes;
|
||||||
}
|
}
|
||||||
@ -262,9 +262,9 @@ namespace NekoGui {
|
|||||||
if (fieldName == "protocol") {
|
if (fieldName == "protocol") {
|
||||||
return {protocol};
|
return {protocol};
|
||||||
}
|
}
|
||||||
if (fieldName == "action_type")
|
if (fieldName == "action")
|
||||||
{
|
{
|
||||||
return {actionType};
|
return {action};
|
||||||
}
|
}
|
||||||
if (fieldName == "method")
|
if (fieldName == "method")
|
||||||
{
|
{
|
||||||
@ -398,9 +398,9 @@ namespace NekoGui {
|
|||||||
if (fieldName == "invert") {
|
if (fieldName == "invert") {
|
||||||
invert = value[0]=="true";
|
invert = value[0]=="true";
|
||||||
}
|
}
|
||||||
if (fieldName == "action_type")
|
if (fieldName == "action")
|
||||||
{
|
{
|
||||||
actionType = value[0];
|
action = value[0];
|
||||||
}
|
}
|
||||||
if (fieldName == "method")
|
if (fieldName == "method")
|
||||||
{
|
{
|
||||||
@ -429,7 +429,10 @@ namespace NekoGui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool RouteRule::isEmpty() {
|
bool RouteRule::isEmpty() {
|
||||||
return get_rule_json().keys().length() == 1;
|
auto ruleJson = get_rule_json();
|
||||||
|
if (action == "route" || action == "route-options" || action == "hijack-dns") return ruleJson.keys().length() <= 1;
|
||||||
|
if (action == "sniff" || action == "resolve" || action == "reject") return ruleJson.keys().length() < 1;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isOutboundIDValid(int id) {
|
bool isOutboundIDValid(int id) {
|
||||||
@ -536,7 +539,8 @@ namespace NekoGui {
|
|||||||
defaultChain->name = "Default";
|
defaultChain->name = "Default";
|
||||||
auto defaultRule = std::make_shared<RouteRule>();
|
auto defaultRule = std::make_shared<RouteRule>();
|
||||||
defaultRule->name = "Route DNS";
|
defaultRule->name = "Route DNS";
|
||||||
defaultRule->actionType = "hijack-dns";
|
defaultRule->action = "hijack-dns";
|
||||||
|
defaultRule->protocol = "dns";
|
||||||
defaultChain->Rules << defaultRule;
|
defaultChain->Rules << defaultRule;
|
||||||
return defaultChain;
|
return defaultChain;
|
||||||
}
|
}
|
||||||
@ -549,7 +553,8 @@ namespace NekoGui {
|
|||||||
|
|
||||||
auto rule0 = std::make_shared<RouteRule>();
|
auto rule0 = std::make_shared<RouteRule>();
|
||||||
rule0->name = "Route DNS";
|
rule0->name = "Route DNS";
|
||||||
rule0->actionType = "hijack-dns";
|
rule0->action = "hijack-dns";
|
||||||
|
rule0->protocol = "dns";
|
||||||
chain->Rules << rule0;
|
chain->Rules << rule0;
|
||||||
|
|
||||||
auto rule1 = std::make_shared<RouteRule>();
|
auto rule1 = std::make_shared<RouteRule>();
|
||||||
@ -575,7 +580,8 @@ namespace NekoGui {
|
|||||||
|
|
||||||
auto rule0 = std::make_shared<RouteRule>();
|
auto rule0 = std::make_shared<RouteRule>();
|
||||||
rule0->name = "Route DNS";
|
rule0->name = "Route DNS";
|
||||||
rule0->actionType = "hijack-dns";
|
rule0->action = "hijack-dns";
|
||||||
|
rule0->protocol = "dns";
|
||||||
chain->Rules << rule0;
|
chain->Rules << rule0;
|
||||||
|
|
||||||
auto rule1 = std::make_shared<RouteRule>();
|
auto rule1 = std::make_shared<RouteRule>();
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <core/cmd/nekobox_core/server/gen/libcore.pb.h>
|
#include <core/server/gen/libcore.pb.h>
|
||||||
#include <include/api/gRPC.h>
|
#include <include/api/gRPC.h>
|
||||||
#include "include/ui/mainwindow_interface.h"
|
#include "include/ui/mainwindow_interface.h"
|
||||||
#include <include/stats/connections/connectionLister.hpp>
|
#include <include/stats/connections/connectionLister.hpp>
|
||||||
|
|||||||
@ -4,8 +4,6 @@
|
|||||||
#include "include/ui/mainwindow_interface.h"
|
#include "include/ui/mainwindow_interface.h"
|
||||||
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QJsonObject>
|
|
||||||
#include <QJsonArray>
|
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
|
|
||||||
@ -14,59 +12,37 @@ namespace NekoGui_traffic {
|
|||||||
TrafficLooper *trafficLooper = new TrafficLooper;
|
TrafficLooper *trafficLooper = new TrafficLooper;
|
||||||
QElapsedTimer elapsedTimer;
|
QElapsedTimer elapsedTimer;
|
||||||
|
|
||||||
TrafficData *TrafficLooper::update_stats(TrafficData *item) {
|
|
||||||
if (NekoGui::dataStore->disable_traffic_stats) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
// last update
|
|
||||||
auto now = elapsedTimer.elapsed();
|
|
||||||
auto interval = now - item->last_update;
|
|
||||||
item->last_update = now;
|
|
||||||
if (interval <= 0) return nullptr;
|
|
||||||
|
|
||||||
// query
|
|
||||||
auto uplink = NekoGui_rpc::defaultClient->QueryStats(item->tag, "uplink");
|
|
||||||
auto downlink = NekoGui_rpc::defaultClient->QueryStats(item->tag, "downlink");
|
|
||||||
|
|
||||||
// add diff
|
|
||||||
item->downlink += downlink;
|
|
||||||
item->uplink += uplink;
|
|
||||||
item->downlink_rate = downlink * 1000 / interval;
|
|
||||||
item->uplink_rate = uplink * 1000 / interval;
|
|
||||||
|
|
||||||
// return diff
|
|
||||||
auto ret = new TrafficData(item->tag);
|
|
||||||
ret->downlink = downlink;
|
|
||||||
ret->uplink = uplink;
|
|
||||||
ret->downlink_rate = item->downlink_rate;
|
|
||||||
ret->uplink_rate = item->uplink_rate;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TrafficLooper::UpdateAll() {
|
void TrafficLooper::UpdateAll() {
|
||||||
if (NekoGui::dataStore->disable_traffic_stats) {
|
if (NekoGui::dataStore->disable_traffic_stats) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::map<std::string, TrafficData *> updated; // tag to diff
|
|
||||||
|
auto resp = NekoGui_rpc::defaultClient->QueryStats();
|
||||||
|
proxy->uplink_rate = 0;
|
||||||
|
proxy->downlink_rate = 0;
|
||||||
|
|
||||||
for (const auto &item: this->items) {
|
for (const auto &item: this->items) {
|
||||||
auto data = item.get();
|
if (!resp.ups().contains(item->tag)) continue;
|
||||||
auto diff = updated[data->tag];
|
auto now = elapsedTimer.elapsed();
|
||||||
// 避免重复查询一个 outbound tag
|
auto interval = now - item->last_update;
|
||||||
if (diff == nullptr) {
|
item->last_update = now;
|
||||||
diff = update_stats(data);
|
if (interval <= 0) continue;
|
||||||
updated[data->tag] = diff;
|
auto up = resp.ups().at(item->tag);
|
||||||
} else {
|
auto down = resp.downs().at(item->tag);
|
||||||
data->uplink += diff->uplink;
|
item->uplink += up;
|
||||||
data->downlink += diff->downlink;
|
item->downlink += down;
|
||||||
data->uplink_rate = diff->uplink_rate;
|
item->uplink_rate = up * 1000 / interval;
|
||||||
data->downlink_rate = diff->downlink_rate;
|
item->downlink_rate = down * 1000 / interval;
|
||||||
|
if (item->tag == "direct")
|
||||||
|
{
|
||||||
|
direct->uplink_rate = item->uplink_rate;
|
||||||
|
direct->downlink_rate = item->downlink_rate;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
proxy->uplink_rate += item->uplink_rate;
|
||||||
|
proxy->downlink_rate += item->downlink_rate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updated[direct->tag] = update_stats(direct);
|
|
||||||
//
|
|
||||||
for (const auto &pair: updated) {
|
|
||||||
delete pair.second;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrafficLooper::Loop() {
|
void TrafficLooper::Loop() {
|
||||||
|
|||||||
@ -36,7 +36,7 @@ namespace NekoGui_sys {
|
|||||||
connect(this, &QProcess::readyReadStandardOutput, this, [&]() {
|
connect(this, &QProcess::readyReadStandardOutput, this, [&]() {
|
||||||
auto log = readAllStandardOutput();
|
auto log = readAllStandardOutput();
|
||||||
if (!NekoGui::dataStore->core_running) {
|
if (!NekoGui::dataStore->core_running) {
|
||||||
if (log.contains("grpc server listening")) {
|
if (log.contains("Core listening at")) {
|
||||||
// The core really started
|
// The core really started
|
||||||
NekoGui::dataStore->core_running = true;
|
NekoGui::dataStore->core_running = true;
|
||||||
if (start_profile_when_core_is_up >= 0) {
|
if (start_profile_when_core_is_up >= 0) {
|
||||||
|
|||||||
@ -249,10 +249,6 @@ void MainWindow::neko_start(int _id) {
|
|||||||
libcore::LoadConfigReq req;
|
libcore::LoadConfigReq req;
|
||||||
req.set_core_config(QJsonObject2QString(result->coreConfig, true).toStdString());
|
req.set_core_config(QJsonObject2QString(result->coreConfig, true).toStdString());
|
||||||
req.set_disable_stats(NekoGui::dataStore->disable_traffic_stats);
|
req.set_disable_stats(NekoGui::dataStore->disable_traffic_stats);
|
||||||
if (NekoGui::dataStore->traffic_loop_interval > 0) {
|
|
||||||
req.add_stats_outbounds("proxy");
|
|
||||||
req.add_stats_outbounds("direct");
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
bool rpcOK;
|
bool rpcOK;
|
||||||
QString error = defaultClient->Start(&rpcOK, req);
|
QString error = defaultClient->Start(&rpcOK, req);
|
||||||
@ -276,9 +272,9 @@ void MainWindow::neko_start(int _id) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
NekoGui_traffic::trafficLooper->proxy = result->outboundStat.get();
|
NekoGui_traffic::trafficLooper->proxy = std::make_shared<NekoGui_traffic::TrafficData>("proxy");
|
||||||
|
NekoGui_traffic::trafficLooper->direct = std::make_shared<NekoGui_traffic::TrafficData>("direct");
|
||||||
NekoGui_traffic::trafficLooper->items = result->outboundStats;
|
NekoGui_traffic::trafficLooper->items = result->outboundStats;
|
||||||
NekoGui::dataStore->ignoreConnTag = result->ignoreConnTag;
|
|
||||||
NekoGui_traffic::trafficLooper->loop_enabled = true;
|
NekoGui_traffic::trafficLooper->loop_enabled = true;
|
||||||
NekoGui_traffic::connection_lister->suspend = false;
|
NekoGui_traffic::connection_lister->suspend = false;
|
||||||
|
|
||||||
@ -411,6 +407,7 @@ void MainWindow::neko_stop(bool crash, bool sem, bool manual) {
|
|||||||
if (NekoGui::dataStore->traffic_loop_interval != 0) {
|
if (NekoGui::dataStore->traffic_loop_interval != 0) {
|
||||||
NekoGui_traffic::trafficLooper->UpdateAll();
|
NekoGui_traffic::trafficLooper->UpdateAll();
|
||||||
for (const auto &item: NekoGui_traffic::trafficLooper->items) {
|
for (const auto &item: NekoGui_traffic::trafficLooper->items) {
|
||||||
|
if (item->id < 0) continue;
|
||||||
NekoGui::profileManager->GetProfile(item->id)->Save();
|
NekoGui::profileManager->GetProfile(item->id)->Save();
|
||||||
refresh_proxy_list(item->id);
|
refresh_proxy_list(item->id);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,7 +59,7 @@ RouteItem::RouteItem(QWidget *parent, const std::shared_ptr<NekoGui::RoutingChai
|
|||||||
auto routeItem = std::make_shared<NekoGui::RouteRule>();
|
auto routeItem = std::make_shared<NekoGui::RouteRule>();
|
||||||
routeItem->name = "dns-hijack";
|
routeItem->name = "dns-hijack";
|
||||||
routeItem->protocol = "dns";
|
routeItem->protocol = "dns";
|
||||||
routeItem->actionType = "hijack-dns";
|
routeItem->action = "hijack-dns";
|
||||||
chain->Rules << routeItem;
|
chain->Rules << routeItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user