Add stats counter for outbounds

pull/2625/head
yuhan6665 2020-06-22 23:55:00 -04:00
parent f34c092a06
commit 886598542c
7 changed files with 220 additions and 136 deletions

View File

@ -84,8 +84,10 @@ func (p *Policy) ToCorePolicy() policy.Session {
func (p *SystemPolicy) ToCorePolicy() policy.System { func (p *SystemPolicy) ToCorePolicy() policy.System {
return policy.System{ return policy.System{
Stats: policy.SystemStats{ Stats: policy.SystemStats{
InboundUplink: p.Stats.InboundUplink, InboundUplink: p.Stats.InboundUplink,
InboundDownlink: p.Stats.InboundDownlink, InboundDownlink: p.Stats.InboundDownlink,
OutboundUplink: p.Stats.OutboundUplink,
OutboundDownlink: p.Stats.OutboundDownlink,
}, },
} }
} }

View File

@ -1,3 +1,9 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.24.0
// protoc (unknown)
// source: config.proto
package policy package policy
import ( import (
@ -30,7 +36,7 @@ type Second struct {
func (x *Second) Reset() { func (x *Second) Reset() {
*x = Second{} *x = Second{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_v2ray_com_core_app_policy_config_proto_msgTypes[0] mi := &file_config_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -43,7 +49,7 @@ func (x *Second) String() string {
func (*Second) ProtoMessage() {} func (*Second) ProtoMessage() {}
func (x *Second) ProtoReflect() protoreflect.Message { func (x *Second) ProtoReflect() protoreflect.Message {
mi := &file_v2ray_com_core_app_policy_config_proto_msgTypes[0] mi := &file_config_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -56,7 +62,7 @@ func (x *Second) ProtoReflect() protoreflect.Message {
// Deprecated: Use Second.ProtoReflect.Descriptor instead. // Deprecated: Use Second.ProtoReflect.Descriptor instead.
func (*Second) Descriptor() ([]byte, []int) { func (*Second) Descriptor() ([]byte, []int) {
return file_v2ray_com_core_app_policy_config_proto_rawDescGZIP(), []int{0} return file_config_proto_rawDescGZIP(), []int{0}
} }
func (x *Second) GetValue() uint32 { func (x *Second) GetValue() uint32 {
@ -79,7 +85,7 @@ type Policy struct {
func (x *Policy) Reset() { func (x *Policy) Reset() {
*x = Policy{} *x = Policy{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_v2ray_com_core_app_policy_config_proto_msgTypes[1] mi := &file_config_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -92,7 +98,7 @@ func (x *Policy) String() string {
func (*Policy) ProtoMessage() {} func (*Policy) ProtoMessage() {}
func (x *Policy) ProtoReflect() protoreflect.Message { func (x *Policy) ProtoReflect() protoreflect.Message {
mi := &file_v2ray_com_core_app_policy_config_proto_msgTypes[1] mi := &file_config_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -105,7 +111,7 @@ func (x *Policy) ProtoReflect() protoreflect.Message {
// Deprecated: Use Policy.ProtoReflect.Descriptor instead. // Deprecated: Use Policy.ProtoReflect.Descriptor instead.
func (*Policy) Descriptor() ([]byte, []int) { func (*Policy) Descriptor() ([]byte, []int) {
return file_v2ray_com_core_app_policy_config_proto_rawDescGZIP(), []int{1} return file_config_proto_rawDescGZIP(), []int{1}
} }
func (x *Policy) GetTimeout() *Policy_Timeout { func (x *Policy) GetTimeout() *Policy_Timeout {
@ -140,7 +146,7 @@ type SystemPolicy struct {
func (x *SystemPolicy) Reset() { func (x *SystemPolicy) Reset() {
*x = SystemPolicy{} *x = SystemPolicy{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_v2ray_com_core_app_policy_config_proto_msgTypes[2] mi := &file_config_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -153,7 +159,7 @@ func (x *SystemPolicy) String() string {
func (*SystemPolicy) ProtoMessage() {} func (*SystemPolicy) ProtoMessage() {}
func (x *SystemPolicy) ProtoReflect() protoreflect.Message { func (x *SystemPolicy) ProtoReflect() protoreflect.Message {
mi := &file_v2ray_com_core_app_policy_config_proto_msgTypes[2] mi := &file_config_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -166,7 +172,7 @@ func (x *SystemPolicy) ProtoReflect() protoreflect.Message {
// Deprecated: Use SystemPolicy.ProtoReflect.Descriptor instead. // Deprecated: Use SystemPolicy.ProtoReflect.Descriptor instead.
func (*SystemPolicy) Descriptor() ([]byte, []int) { func (*SystemPolicy) Descriptor() ([]byte, []int) {
return file_v2ray_com_core_app_policy_config_proto_rawDescGZIP(), []int{2} return file_config_proto_rawDescGZIP(), []int{2}
} }
func (x *SystemPolicy) GetStats() *SystemPolicy_Stats { func (x *SystemPolicy) GetStats() *SystemPolicy_Stats {
@ -188,7 +194,7 @@ type Config struct {
func (x *Config) Reset() { func (x *Config) Reset() {
*x = Config{} *x = Config{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_v2ray_com_core_app_policy_config_proto_msgTypes[3] mi := &file_config_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -201,7 +207,7 @@ func (x *Config) String() string {
func (*Config) ProtoMessage() {} func (*Config) ProtoMessage() {}
func (x *Config) ProtoReflect() protoreflect.Message { func (x *Config) ProtoReflect() protoreflect.Message {
mi := &file_v2ray_com_core_app_policy_config_proto_msgTypes[3] mi := &file_config_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -214,7 +220,7 @@ func (x *Config) ProtoReflect() protoreflect.Message {
// Deprecated: Use Config.ProtoReflect.Descriptor instead. // Deprecated: Use Config.ProtoReflect.Descriptor instead.
func (*Config) Descriptor() ([]byte, []int) { func (*Config) Descriptor() ([]byte, []int) {
return file_v2ray_com_core_app_policy_config_proto_rawDescGZIP(), []int{3} return file_config_proto_rawDescGZIP(), []int{3}
} }
func (x *Config) GetLevel() map[uint32]*Policy { func (x *Config) GetLevel() map[uint32]*Policy {
@ -246,7 +252,7 @@ type Policy_Timeout struct {
func (x *Policy_Timeout) Reset() { func (x *Policy_Timeout) Reset() {
*x = Policy_Timeout{} *x = Policy_Timeout{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_v2ray_com_core_app_policy_config_proto_msgTypes[4] mi := &file_config_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -259,7 +265,7 @@ func (x *Policy_Timeout) String() string {
func (*Policy_Timeout) ProtoMessage() {} func (*Policy_Timeout) ProtoMessage() {}
func (x *Policy_Timeout) ProtoReflect() protoreflect.Message { func (x *Policy_Timeout) ProtoReflect() protoreflect.Message {
mi := &file_v2ray_com_core_app_policy_config_proto_msgTypes[4] mi := &file_config_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -272,7 +278,7 @@ func (x *Policy_Timeout) ProtoReflect() protoreflect.Message {
// Deprecated: Use Policy_Timeout.ProtoReflect.Descriptor instead. // Deprecated: Use Policy_Timeout.ProtoReflect.Descriptor instead.
func (*Policy_Timeout) Descriptor() ([]byte, []int) { func (*Policy_Timeout) Descriptor() ([]byte, []int) {
return file_v2ray_com_core_app_policy_config_proto_rawDescGZIP(), []int{1, 0} return file_config_proto_rawDescGZIP(), []int{1, 0}
} }
func (x *Policy_Timeout) GetHandshake() *Second { func (x *Policy_Timeout) GetHandshake() *Second {
@ -315,7 +321,7 @@ type Policy_Stats struct {
func (x *Policy_Stats) Reset() { func (x *Policy_Stats) Reset() {
*x = Policy_Stats{} *x = Policy_Stats{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_v2ray_com_core_app_policy_config_proto_msgTypes[5] mi := &file_config_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -328,7 +334,7 @@ func (x *Policy_Stats) String() string {
func (*Policy_Stats) ProtoMessage() {} func (*Policy_Stats) ProtoMessage() {}
func (x *Policy_Stats) ProtoReflect() protoreflect.Message { func (x *Policy_Stats) ProtoReflect() protoreflect.Message {
mi := &file_v2ray_com_core_app_policy_config_proto_msgTypes[5] mi := &file_config_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -341,7 +347,7 @@ func (x *Policy_Stats) ProtoReflect() protoreflect.Message {
// Deprecated: Use Policy_Stats.ProtoReflect.Descriptor instead. // Deprecated: Use Policy_Stats.ProtoReflect.Descriptor instead.
func (*Policy_Stats) Descriptor() ([]byte, []int) { func (*Policy_Stats) Descriptor() ([]byte, []int) {
return file_v2ray_com_core_app_policy_config_proto_rawDescGZIP(), []int{1, 1} return file_config_proto_rawDescGZIP(), []int{1, 1}
} }
func (x *Policy_Stats) GetUserUplink() bool { func (x *Policy_Stats) GetUserUplink() bool {
@ -370,7 +376,7 @@ type Policy_Buffer struct {
func (x *Policy_Buffer) Reset() { func (x *Policy_Buffer) Reset() {
*x = Policy_Buffer{} *x = Policy_Buffer{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_v2ray_com_core_app_policy_config_proto_msgTypes[6] mi := &file_config_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -383,7 +389,7 @@ func (x *Policy_Buffer) String() string {
func (*Policy_Buffer) ProtoMessage() {} func (*Policy_Buffer) ProtoMessage() {}
func (x *Policy_Buffer) ProtoReflect() protoreflect.Message { func (x *Policy_Buffer) ProtoReflect() protoreflect.Message {
mi := &file_v2ray_com_core_app_policy_config_proto_msgTypes[6] mi := &file_config_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -396,7 +402,7 @@ func (x *Policy_Buffer) ProtoReflect() protoreflect.Message {
// Deprecated: Use Policy_Buffer.ProtoReflect.Descriptor instead. // Deprecated: Use Policy_Buffer.ProtoReflect.Descriptor instead.
func (*Policy_Buffer) Descriptor() ([]byte, []int) { func (*Policy_Buffer) Descriptor() ([]byte, []int) {
return file_v2ray_com_core_app_policy_config_proto_rawDescGZIP(), []int{1, 2} return file_config_proto_rawDescGZIP(), []int{1, 2}
} }
func (x *Policy_Buffer) GetConnection() int32 { func (x *Policy_Buffer) GetConnection() int32 {
@ -411,14 +417,16 @@ type SystemPolicy_Stats struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
InboundUplink bool `protobuf:"varint,1,opt,name=inbound_uplink,json=inboundUplink,proto3" json:"inbound_uplink,omitempty"` InboundUplink bool `protobuf:"varint,1,opt,name=inbound_uplink,json=inboundUplink,proto3" json:"inbound_uplink,omitempty"`
InboundDownlink bool `protobuf:"varint,2,opt,name=inbound_downlink,json=inboundDownlink,proto3" json:"inbound_downlink,omitempty"` InboundDownlink bool `protobuf:"varint,2,opt,name=inbound_downlink,json=inboundDownlink,proto3" json:"inbound_downlink,omitempty"`
OutboundUplink bool `protobuf:"varint,3,opt,name=outbound_uplink,json=outboundUplink,proto3" json:"outbound_uplink,omitempty"`
OutboundDownlink bool `protobuf:"varint,4,opt,name=outbound_downlink,json=outboundDownlink,proto3" json:"outbound_downlink,omitempty"`
} }
func (x *SystemPolicy_Stats) Reset() { func (x *SystemPolicy_Stats) Reset() {
*x = SystemPolicy_Stats{} *x = SystemPolicy_Stats{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_v2ray_com_core_app_policy_config_proto_msgTypes[7] mi := &file_config_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -431,7 +439,7 @@ func (x *SystemPolicy_Stats) String() string {
func (*SystemPolicy_Stats) ProtoMessage() {} func (*SystemPolicy_Stats) ProtoMessage() {}
func (x *SystemPolicy_Stats) ProtoReflect() protoreflect.Message { func (x *SystemPolicy_Stats) ProtoReflect() protoreflect.Message {
mi := &file_v2ray_com_core_app_policy_config_proto_msgTypes[7] mi := &file_config_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -444,7 +452,7 @@ func (x *SystemPolicy_Stats) ProtoReflect() protoreflect.Message {
// Deprecated: Use SystemPolicy_Stats.ProtoReflect.Descriptor instead. // Deprecated: Use SystemPolicy_Stats.ProtoReflect.Descriptor instead.
func (*SystemPolicy_Stats) Descriptor() ([]byte, []int) { func (*SystemPolicy_Stats) Descriptor() ([]byte, []int) {
return file_v2ray_com_core_app_policy_config_proto_rawDescGZIP(), []int{2, 0} return file_config_proto_rawDescGZIP(), []int{2, 0}
} }
func (x *SystemPolicy_Stats) GetInboundUplink() bool { func (x *SystemPolicy_Stats) GetInboundUplink() bool {
@ -461,98 +469,116 @@ func (x *SystemPolicy_Stats) GetInboundDownlink() bool {
return false return false
} }
var File_v2ray_com_core_app_policy_config_proto protoreflect.FileDescriptor func (x *SystemPolicy_Stats) GetOutboundUplink() bool {
if x != nil {
return x.OutboundUplink
}
return false
}
var file_v2ray_com_core_app_policy_config_proto_rawDesc = []byte{ func (x *SystemPolicy_Stats) GetOutboundDownlink() bool {
0x0a, 0x26, 0x76, 0x32, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x72, 0x65, if x != nil {
0x2f, 0x61, 0x70, 0x70, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, return x.OutboundDownlink
0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x76, 0x32, 0x72, 0x61, 0x79, 0x2e, }
0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, return false
0x1e, 0x0a, 0x06, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, }
0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22,
0xd0, 0x04, 0x0a, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x3f, 0x0a, 0x07, 0x74, 0x69, var File_config_proto protoreflect.FileDescriptor
0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x76, 0x32,
0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, var file_config_proto_rawDesc = []byte{
0x69, 0x63, 0x79, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15,
0x75, 0x74, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x39, 0x0a, 0x05, 0x73, 0x76, 0x32, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70,
0x74, 0x61, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x76, 0x32, 0x72, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0x1e, 0x0a, 0x06, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x12,
0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05,
0x63, 0x79, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xd0, 0x04, 0x0a, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79,
0x05, 0x73, 0x74, 0x61, 0x74, 0x73, 0x12, 0x3c, 0x0a, 0x06, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x12, 0x3f, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x76, 0x32, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x0b, 0x32, 0x25, 0x2e, 0x76, 0x32, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61,
0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79,
0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x52, 0x06, 0x62, 0x75, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75,
0x66, 0x66, 0x65, 0x72, 0x1a, 0x92, 0x02, 0x0a, 0x07, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x74, 0x12, 0x39, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x12, 0x3b, 0x0a, 0x09, 0x68, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x18, 0x01, 0x20, 0x32, 0x23, 0x2e, 0x76, 0x32, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70,
0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x76, 0x32, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e,
0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x65, 0x63, 0x6f, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x73, 0x12, 0x3c, 0x0a, 0x06,
0x6e, 0x64, 0x52, 0x09, 0x68, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x12, 0x46, 0x0a, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x76,
0x0f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x6c, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x76, 0x32, 0x72, 0x61, 0x79, 0x2e, 0x63,
0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53,
0x65, 0x63, 0x6f, 0x6e, 0x64, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x49, 0x64, 0x6c, 0x65, 0x12, 0x3e, 0x0a, 0x0b, 0x75, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x5f,
0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x76, 0x32, 0x72,
0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69,
0x63, 0x79, 0x2e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x52, 0x0a, 0x75, 0x70, 0x6c, 0x69, 0x6e,
0x6b, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x42, 0x0a, 0x0d, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e,
0x6b, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x76,
0x32, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x32, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f,
0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x52, 0x0c, 0x64, 0x6f, 0x77, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x42, 0x75, 0x66, 0x66,
0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x4f, 0x6e, 0x6c, 0x79, 0x1a, 0x4d, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x65, 0x72, 0x52, 0x06, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x1a, 0x92, 0x02, 0x0a, 0x07, 0x54,
0x74, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x75, 0x70, 0x6c, 0x69, 0x6e, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x3b, 0x0a, 0x09, 0x68, 0x61, 0x6e, 0x64, 0x73, 0x68,
0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x55, 0x70, 0x6c, 0x61, 0x6b, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x76, 0x32, 0x72, 0x61,
0x69, 0x6e, 0x6b, 0x12, 0x23, 0x0a, 0x0d, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x64, 0x6f, 0x77, 0x6e,
0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x75, 0x73, 0x65, 0x72,
0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x1a, 0x28, 0x0a, 0x06, 0x42, 0x75, 0x66, 0x66,
0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x22, 0xaa, 0x01, 0x0a, 0x0c, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x6f, 0x6c,
0x69, 0x63, 0x79, 0x12, 0x3f, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x29, 0x2e, 0x76, 0x32, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e,
0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65,
0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x05, 0x73,
0x74, 0x61, 0x74, 0x73, 0x1a, 0x59, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x25, 0x0a,
0x0e, 0x69, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x75, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x18,
0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x69, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x55, 0x70,
0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f,
0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f,
0x69, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x22,
0xde, 0x01, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3e, 0x0a, 0x05, 0x6c, 0x65,
0x76, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x76, 0x32, 0x72, 0x61,
0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63,
0x79, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x45, 0x6e, 0x79, 0x2e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x52, 0x09, 0x68, 0x61, 0x6e, 0x64, 0x73, 0x68,
0x74, 0x72, 0x79, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x3b, 0x0a, 0x06, 0x73, 0x79, 0x61, 0x6b, 0x65, 0x12, 0x46, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f,
0x73, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x76, 0x32, 0x72, 0x6e, 0x5f, 0x69, 0x64, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x76,
0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x32, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f,
0x63, 0x79, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x52, 0x0e, 0x63, 0x6f, 0x6e,
0x06, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x1a, 0x57, 0x0a, 0x0a, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x6c, 0x65, 0x12, 0x3e, 0x0a, 0x0b, 0x75,
0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x33, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x32, 0x1d, 0x2e, 0x76, 0x32, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x76, 0x32, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x52,
0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x0a, 0x75, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x42, 0x0a, 0x0d, 0x64,
0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x04, 0x20, 0x01,
0x42, 0x3d, 0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x2e, 0x76, 0x32, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x76, 0x32, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e,
0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x50, 0x01, 0x5a, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x65, 0x63, 0x6f, 0x6e,
0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0xaa, 0x02, 0x15, 0x56, 0x32, 0x52, 0x61, 0x79, 0x2e, 0x64, 0x52, 0x0c, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x4f, 0x6e, 0x6c, 0x79, 0x1a,
0x43, 0x6f, 0x72, 0x65, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x62, 0x4d, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x73, 0x65, 0x72,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x75, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x75,
0x73, 0x65, 0x72, 0x55, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x23, 0x0a, 0x0d, 0x75, 0x73, 0x65,
0x72, 0x5f, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08,
0x52, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x1a, 0x28,
0x0a, 0x06, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x6e,
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x63, 0x6f,
0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x81, 0x02, 0x0a, 0x0c, 0x53, 0x79, 0x73,
0x74, 0x65, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x3f, 0x0a, 0x05, 0x73, 0x74, 0x61,
0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x76, 0x32, 0x72, 0x61, 0x79,
0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79,
0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x74,
0x61, 0x74, 0x73, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x73, 0x1a, 0xaf, 0x01, 0x0a, 0x05, 0x53,
0x74, 0x61, 0x74, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x69, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f,
0x75, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x69, 0x6e,
0x62, 0x6f, 0x75, 0x6e, 0x64, 0x55, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x29, 0x0a, 0x10, 0x69,
0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x18,
0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x69, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x44, 0x6f,
0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75,
0x6e, 0x64, 0x5f, 0x75, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52,
0x0e, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x55, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x12,
0x2b, 0x0a, 0x11, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x64, 0x6f, 0x77, 0x6e,
0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x6f, 0x75, 0x74, 0x62,
0x6f, 0x75, 0x6e, 0x64, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x22, 0xde, 0x01, 0x0a,
0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3e, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c,
0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x76, 0x32, 0x72, 0x61, 0x79, 0x2e, 0x63,
0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x43,
0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x3b, 0x0a, 0x06, 0x73, 0x79, 0x73, 0x74, 0x65,
0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x76, 0x32, 0x72, 0x61, 0x79, 0x2e,
0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e,
0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x06, 0x73, 0x79,
0x73, 0x74, 0x65, 0x6d, 0x1a, 0x57, 0x0a, 0x0a, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x45, 0x6e, 0x74,
0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52,
0x03, 0x6b, 0x65, 0x79, 0x12, 0x33, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x76, 0x32, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65,
0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x6f, 0x6c, 0x69,
0x63, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x3d, 0x0a,
0x19, 0x63, 0x6f, 0x6d, 0x2e, 0x76, 0x32, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e,
0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x50, 0x01, 0x5a, 0x06, 0x70, 0x6f,
0x6c, 0x69, 0x63, 0x79, 0xaa, 0x02, 0x15, 0x56, 0x32, 0x52, 0x61, 0x79, 0x2e, 0x43, 0x6f, 0x72,
0x65, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
file_v2ray_com_core_app_policy_config_proto_rawDescOnce sync.Once file_config_proto_rawDescOnce sync.Once
file_v2ray_com_core_app_policy_config_proto_rawDescData = file_v2ray_com_core_app_policy_config_proto_rawDesc file_config_proto_rawDescData = file_config_proto_rawDesc
) )
func file_v2ray_com_core_app_policy_config_proto_rawDescGZIP() []byte { func file_config_proto_rawDescGZIP() []byte {
file_v2ray_com_core_app_policy_config_proto_rawDescOnce.Do(func() { file_config_proto_rawDescOnce.Do(func() {
file_v2ray_com_core_app_policy_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2ray_com_core_app_policy_config_proto_rawDescData) file_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_config_proto_rawDescData)
}) })
return file_v2ray_com_core_app_policy_config_proto_rawDescData return file_config_proto_rawDescData
} }
var file_v2ray_com_core_app_policy_config_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_config_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_v2ray_com_core_app_policy_config_proto_goTypes = []interface{}{ var file_config_proto_goTypes = []interface{}{
(*Second)(nil), // 0: v2ray.core.app.policy.Second (*Second)(nil), // 0: v2ray.core.app.policy.Second
(*Policy)(nil), // 1: v2ray.core.app.policy.Policy (*Policy)(nil), // 1: v2ray.core.app.policy.Policy
(*SystemPolicy)(nil), // 2: v2ray.core.app.policy.SystemPolicy (*SystemPolicy)(nil), // 2: v2ray.core.app.policy.SystemPolicy
@ -563,7 +589,7 @@ var file_v2ray_com_core_app_policy_config_proto_goTypes = []interface{}{
(*SystemPolicy_Stats)(nil), // 7: v2ray.core.app.policy.SystemPolicy.Stats (*SystemPolicy_Stats)(nil), // 7: v2ray.core.app.policy.SystemPolicy.Stats
nil, // 8: v2ray.core.app.policy.Config.LevelEntry nil, // 8: v2ray.core.app.policy.Config.LevelEntry
} }
var file_v2ray_com_core_app_policy_config_proto_depIdxs = []int32{ var file_config_proto_depIdxs = []int32{
4, // 0: v2ray.core.app.policy.Policy.timeout:type_name -> v2ray.core.app.policy.Policy.Timeout 4, // 0: v2ray.core.app.policy.Policy.timeout:type_name -> v2ray.core.app.policy.Policy.Timeout
5, // 1: v2ray.core.app.policy.Policy.stats:type_name -> v2ray.core.app.policy.Policy.Stats 5, // 1: v2ray.core.app.policy.Policy.stats:type_name -> v2ray.core.app.policy.Policy.Stats
6, // 2: v2ray.core.app.policy.Policy.buffer:type_name -> v2ray.core.app.policy.Policy.Buffer 6, // 2: v2ray.core.app.policy.Policy.buffer:type_name -> v2ray.core.app.policy.Policy.Buffer
@ -582,13 +608,13 @@ var file_v2ray_com_core_app_policy_config_proto_depIdxs = []int32{
0, // [0:11] is the sub-list for field type_name 0, // [0:11] is the sub-list for field type_name
} }
func init() { file_v2ray_com_core_app_policy_config_proto_init() } func init() { file_config_proto_init() }
func file_v2ray_com_core_app_policy_config_proto_init() { func file_config_proto_init() {
if File_v2ray_com_core_app_policy_config_proto != nil { if File_config_proto != nil {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_v2ray_com_core_app_policy_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Second); i { switch v := v.(*Second); i {
case 0: case 0:
return &v.state return &v.state
@ -600,7 +626,7 @@ func file_v2ray_com_core_app_policy_config_proto_init() {
return nil return nil
} }
} }
file_v2ray_com_core_app_policy_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { file_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Policy); i { switch v := v.(*Policy); i {
case 0: case 0:
return &v.state return &v.state
@ -612,7 +638,7 @@ func file_v2ray_com_core_app_policy_config_proto_init() {
return nil return nil
} }
} }
file_v2ray_com_core_app_policy_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { file_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SystemPolicy); i { switch v := v.(*SystemPolicy); i {
case 0: case 0:
return &v.state return &v.state
@ -624,7 +650,7 @@ func file_v2ray_com_core_app_policy_config_proto_init() {
return nil return nil
} }
} }
file_v2ray_com_core_app_policy_config_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { file_config_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state
@ -636,7 +662,7 @@ func file_v2ray_com_core_app_policy_config_proto_init() {
return nil return nil
} }
} }
file_v2ray_com_core_app_policy_config_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { file_config_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Policy_Timeout); i { switch v := v.(*Policy_Timeout); i {
case 0: case 0:
return &v.state return &v.state
@ -648,7 +674,7 @@ func file_v2ray_com_core_app_policy_config_proto_init() {
return nil return nil
} }
} }
file_v2ray_com_core_app_policy_config_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { file_config_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Policy_Stats); i { switch v := v.(*Policy_Stats); i {
case 0: case 0:
return &v.state return &v.state
@ -660,7 +686,7 @@ func file_v2ray_com_core_app_policy_config_proto_init() {
return nil return nil
} }
} }
file_v2ray_com_core_app_policy_config_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { file_config_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Policy_Buffer); i { switch v := v.(*Policy_Buffer); i {
case 0: case 0:
return &v.state return &v.state
@ -672,7 +698,7 @@ func file_v2ray_com_core_app_policy_config_proto_init() {
return nil return nil
} }
} }
file_v2ray_com_core_app_policy_config_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { file_config_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SystemPolicy_Stats); i { switch v := v.(*SystemPolicy_Stats); i {
case 0: case 0:
return &v.state return &v.state
@ -689,18 +715,18 @@ func file_v2ray_com_core_app_policy_config_proto_init() {
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_v2ray_com_core_app_policy_config_proto_rawDesc, RawDescriptor: file_config_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 9, NumMessages: 9,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },
GoTypes: file_v2ray_com_core_app_policy_config_proto_goTypes, GoTypes: file_config_proto_goTypes,
DependencyIndexes: file_v2ray_com_core_app_policy_config_proto_depIdxs, DependencyIndexes: file_config_proto_depIdxs,
MessageInfos: file_v2ray_com_core_app_policy_config_proto_msgTypes, MessageInfos: file_config_proto_msgTypes,
}.Build() }.Build()
File_v2ray_com_core_app_policy_config_proto = out.File File_config_proto = out.File
file_v2ray_com_core_app_policy_config_proto_rawDesc = nil file_config_proto_rawDesc = nil
file_v2ray_com_core_app_policy_config_proto_goTypes = nil file_config_proto_goTypes = nil
file_v2ray_com_core_app_policy_config_proto_depIdxs = nil file_config_proto_depIdxs = nil
} }

View File

@ -38,6 +38,8 @@ message SystemPolicy {
message Stats { message Stats {
bool inbound_uplink = 1; bool inbound_uplink = 1;
bool inbound_downlink = 2; bool inbound_downlink = 2;
bool outbound_uplink = 3;
bool outbound_downlink = 4;
} }
Stats stats = 1; Stats stats = 1;

View File

@ -10,6 +10,8 @@ import (
"v2ray.com/core/common/net" "v2ray.com/core/common/net"
"v2ray.com/core/common/session" "v2ray.com/core/common/session"
"v2ray.com/core/features/outbound" "v2ray.com/core/features/outbound"
"v2ray.com/core/features/policy"
"v2ray.com/core/features/stats"
"v2ray.com/core/proxy" "v2ray.com/core/proxy"
"v2ray.com/core/transport" "v2ray.com/core/transport"
"v2ray.com/core/transport/internet" "v2ray.com/core/transport/internet"
@ -17,6 +19,31 @@ import (
"v2ray.com/core/transport/pipe" "v2ray.com/core/transport/pipe"
) )
func getStatCounter(v *core.Instance, tag string) (stats.Counter, stats.Counter) {
var uplinkCounter stats.Counter
var downlinkCounter stats.Counter
policy := v.GetFeature(policy.ManagerType()).(policy.Manager)
if len(tag) > 0 && policy.ForSystem().Stats.OutboundUplink {
statsManager := v.GetFeature(stats.ManagerType()).(stats.Manager)
name := "outbound>>>" + tag + ">>>traffic>>>uplink"
c, _ := stats.GetOrRegisterCounter(statsManager, name)
if c != nil {
uplinkCounter = c
}
}
if len(tag) > 0 && policy.ForSystem().Stats.OutboundDownlink {
statsManager := v.GetFeature(stats.ManagerType()).(stats.Manager)
name := "outbound>>>" + tag + ">>>traffic>>>downlink"
c, _ := stats.GetOrRegisterCounter(statsManager, name)
if c != nil {
downlinkCounter = c
}
}
return uplinkCounter, downlinkCounter
}
// Handler is an implements of outbound.Handler. // Handler is an implements of outbound.Handler.
type Handler struct { type Handler struct {
tag string tag string
@ -25,14 +52,19 @@ type Handler struct {
proxy proxy.Outbound proxy proxy.Outbound
outboundManager outbound.Manager outboundManager outbound.Manager
mux *mux.ClientManager mux *mux.ClientManager
uplinkCounter stats.Counter
downlinkCounter stats.Counter
} }
// NewHandler create a new Handler based on the given configuration. // NewHandler create a new Handler based on the given configuration.
func NewHandler(ctx context.Context, config *core.OutboundHandlerConfig) (outbound.Handler, error) { func NewHandler(ctx context.Context, config *core.OutboundHandlerConfig) (outbound.Handler, error) {
v := core.MustFromContext(ctx) v := core.MustFromContext(ctx)
uplinkCounter, downlinkCounter := getStatCounter(v, config.Tag)
h := &Handler{ h := &Handler{
tag: config.Tag, tag: config.Tag,
outboundManager: v.GetFeature(outbound.ManagerType()).(outbound.Manager), outboundManager: v.GetFeature(outbound.ManagerType()).(outbound.Manager),
uplinkCounter: uplinkCounter,
downlinkCounter: downlinkCounter,
} }
if config.SenderSettings != nil { if config.SenderSettings != nil {
@ -148,7 +180,7 @@ func (h *Handler) Dial(ctx context.Context, dest net.Destination) (internet.Conn
conn = tls.Client(conn, tlsConfig) conn = tls.Client(conn, tlsConfig)
} }
return conn, nil return h.getStatCouterConnection(conn), nil
} }
newError("failed to get outbound handler with tag: ", tag).AtWarning().WriteToLog(session.ExportIDToError(ctx)) newError("failed to get outbound handler with tag: ", tag).AtWarning().WriteToLog(session.ExportIDToError(ctx))
@ -164,7 +196,19 @@ func (h *Handler) Dial(ctx context.Context, dest net.Destination) (internet.Conn
} }
} }
return internet.Dial(ctx, dest, h.streamSettings) conn, err := internet.Dial(ctx, dest, h.streamSettings)
return h.getStatCouterConnection(conn), err
}
func (h *Handler) getStatCouterConnection(conn internet.Connection) (internet.Connection) {
if h.uplinkCounter != nil || h.downlinkCounter != nil {
return &internet.StatCouterConnection{
Connection: conn,
ReadCounter: h.downlinkCounter,
WriteCounter: h.uplinkCounter,
}
}
return conn
} }
// GetOutbound implements proxy.GetOutbound. // GetOutbound implements proxy.GetOutbound.

View File

@ -41,6 +41,10 @@ type SystemStats struct {
InboundUplink bool InboundUplink bool
// Whether or not to enable stat counter for downlink traffic in inbound handlers. // Whether or not to enable stat counter for downlink traffic in inbound handlers.
InboundDownlink bool InboundDownlink bool
// Whether or not to enable stat counter for uplink traffic in outbound handlers.
OutboundUplink bool
// Whether or not to enable stat counter for downlink traffic in outbound handlers.
OutboundDownlink bool
} }
// System contains policy settings at system level. // System contains policy settings at system level.

View File

@ -51,15 +51,19 @@ func (t *Policy) Build() (*policy.Policy, error) {
} }
type SystemPolicy struct { type SystemPolicy struct {
StatsInboundUplink bool `json:"statsInboundUplink"` StatsInboundUplink bool `json:"statsInboundUplink"`
StatsInboundDownlink bool `json:"statsInboundDownlink"` StatsInboundDownlink bool `json:"statsInboundDownlink"`
StatsOutboundUplink bool `json:"statsOutboundUplink"`
StatsOutboundDownlink bool `json:"statsOutboundDownlink"`
} }
func (p *SystemPolicy) Build() (*policy.SystemPolicy, error) { func (p *SystemPolicy) Build() (*policy.SystemPolicy, error) {
return &policy.SystemPolicy{ return &policy.SystemPolicy{
Stats: &policy.SystemPolicy_Stats{ Stats: &policy.SystemPolicy_Stats{
InboundUplink: p.StatsInboundUplink, InboundUplink: p.StatsInboundUplink,
InboundDownlink: p.StatsInboundDownlink, InboundDownlink: p.StatsInboundDownlink,
OutboundUplink: p.StatsOutboundUplink,
OutboundDownlink: p.StatsOutboundDownlink,
}, },
}, nil }, nil
} }

View File

@ -119,7 +119,9 @@
}, },
"system": { "system": {
"statsInboundUplink": false, "statsInboundUplink": false,
"statsInboundDownlink": false "statsInboundDownlink": false,
"statsOutboundUplink": false,
"statsOutboundDownlink": false
} }
}, },