DNS访问日志显示匹配的线路

This commit is contained in:
GoEdgeLab
2021-08-20 11:27:22 +08:00
parent ecd5d3ad29
commit 7bef4d6d30
2 changed files with 74 additions and 56 deletions

View File

@@ -35,20 +35,21 @@ type NSAccessLog struct {
NsDomainId int64 `protobuf:"varint,2,opt,name=nsDomainId,proto3" json:"nsDomainId,omitempty"`
NsRecordId int64 `protobuf:"varint,3,opt,name=nsRecordId,proto3" json:"nsRecordId,omitempty"`
// Deprecated: Do not use.
NsRouteIds []int64 `protobuf:"varint,4,rep,packed,name=nsRouteIds,proto3" json:"nsRouteIds,omitempty"`
NsRouteCodes []string `protobuf:"bytes,17,rep,name=nsRouteCodes,proto3" json:"nsRouteCodes,omitempty"`
RemoteAddr string `protobuf:"bytes,5,opt,name=remoteAddr,proto3" json:"remoteAddr,omitempty"`
QuestionName string `protobuf:"bytes,6,opt,name=questionName,proto3" json:"questionName,omitempty"`
QuestionType string `protobuf:"bytes,7,opt,name=questionType,proto3" json:"questionType,omitempty"`
RecordName string `protobuf:"bytes,8,opt,name=recordName,proto3" json:"recordName,omitempty"`
RecordType string `protobuf:"bytes,9,opt,name=recordType,proto3" json:"recordType,omitempty"`
RecordValue string `protobuf:"bytes,10,opt,name=recordValue,proto3" json:"recordValue,omitempty"`
Networking string `protobuf:"bytes,11,opt,name=networking,proto3" json:"networking,omitempty"`
ServerAddr string `protobuf:"bytes,12,opt,name=serverAddr,proto3" json:"serverAddr,omitempty"`
Timestamp int64 `protobuf:"varint,13,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
RequestId string `protobuf:"bytes,14,opt,name=requestId,proto3" json:"requestId,omitempty"`
TimeLocal string `protobuf:"bytes,15,opt,name=timeLocal,proto3" json:"timeLocal,omitempty"`
Error string `protobuf:"bytes,16,opt,name=error,proto3" json:"error,omitempty"`
NsRouteIds []int64 `protobuf:"varint,4,rep,packed,name=nsRouteIds,proto3" json:"nsRouteIds,omitempty"`
NsRouteCodes []string `protobuf:"bytes,17,rep,name=nsRouteCodes,proto3" json:"nsRouteCodes,omitempty"`
NsRoutes []*NSRoute `protobuf:"bytes,18,rep,name=nsRoutes,proto3" json:"nsRoutes,omitempty"` // 仅供查看访问日志时使用
RemoteAddr string `protobuf:"bytes,5,opt,name=remoteAddr,proto3" json:"remoteAddr,omitempty"`
QuestionName string `protobuf:"bytes,6,opt,name=questionName,proto3" json:"questionName,omitempty"`
QuestionType string `protobuf:"bytes,7,opt,name=questionType,proto3" json:"questionType,omitempty"`
RecordName string `protobuf:"bytes,8,opt,name=recordName,proto3" json:"recordName,omitempty"`
RecordType string `protobuf:"bytes,9,opt,name=recordType,proto3" json:"recordType,omitempty"`
RecordValue string `protobuf:"bytes,10,opt,name=recordValue,proto3" json:"recordValue,omitempty"`
Networking string `protobuf:"bytes,11,opt,name=networking,proto3" json:"networking,omitempty"`
ServerAddr string `protobuf:"bytes,12,opt,name=serverAddr,proto3" json:"serverAddr,omitempty"`
Timestamp int64 `protobuf:"varint,13,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
RequestId string `protobuf:"bytes,14,opt,name=requestId,proto3" json:"requestId,omitempty"`
TimeLocal string `protobuf:"bytes,15,opt,name=timeLocal,proto3" json:"timeLocal,omitempty"`
Error string `protobuf:"bytes,16,opt,name=error,proto3" json:"error,omitempty"`
}
func (x *NSAccessLog) Reset() {
@@ -119,6 +120,13 @@ func (x *NSAccessLog) GetNsRouteCodes() []string {
return nil
}
func (x *NSAccessLog) GetNsRoutes() []*NSRoute {
if x != nil {
return x.NsRoutes
}
return nil
}
func (x *NSAccessLog) GetRemoteAddr() string {
if x != nil {
return x.RemoteAddr
@@ -208,43 +216,47 @@ var File_models_model_ns_access_log_proto protoreflect.FileDescriptor
var file_models_model_ns_access_log_proto_rawDesc = []byte{
0x0a, 0x20, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e,
0x73, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xab, 0x04, 0x0a, 0x0b, 0x4e, 0x53, 0x41, 0x63, 0x63,
0x65, 0x73, 0x73, 0x4c, 0x6f, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x73, 0x4e, 0x6f, 0x64, 0x65,
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6e, 0x73, 0x4e, 0x6f, 0x64, 0x65,
0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, 0x73, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x49, 0x64,
0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6e, 0x73, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e,
0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, 0x73, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x49, 0x64,
0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6e, 0x73, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64,
0x49, 0x64, 0x12, 0x22, 0x0a, 0x0a, 0x6e, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x49, 0x64, 0x73,
0x18, 0x04, 0x20, 0x03, 0x28, 0x03, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0a, 0x6e, 0x73, 0x52, 0x6f,
0x75, 0x74, 0x65, 0x49, 0x64, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x6e, 0x73, 0x52, 0x6f, 0x75, 0x74,
0x65, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x11, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x6e, 0x73,
0x52, 0x6f, 0x75, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65,
0x6d, 0x6f, 0x74, 0x65, 0x41, 0x64, 0x64, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x64, 0x64, 0x72, 0x12, 0x22, 0x0a, 0x0c, 0x71, 0x75,
0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0c, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22,
0x0a, 0x0c, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x07,
0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79,
0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x4e, 0x61, 0x6d, 0x65,
0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x4e, 0x61,
0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x79, 0x70, 0x65,
0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x79,
0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x56, 0x61, 0x6c, 0x75,
0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x56,
0x61, 0x6c, 0x75, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x69,
0x6e, 0x67, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72,
0x6b, 0x69, 0x6e, 0x67, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x41, 0x64,
0x64, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
0x41, 0x64, 0x64, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
0x70, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61,
0x6d, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x18,
0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64,
0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x18, 0x0f, 0x20,
0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x12, 0x14,
0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65,
0x72, 0x72, 0x6f, 0x72, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x1b, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d,
0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x73, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x22, 0xd4, 0x04, 0x0a, 0x0b, 0x4e, 0x53, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73,
0x4c, 0x6f, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6e, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12,
0x1e, 0x0a, 0x0a, 0x6e, 0x73, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20,
0x01, 0x28, 0x03, 0x52, 0x0a, 0x6e, 0x73, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12,
0x1e, 0x0a, 0x0a, 0x6e, 0x73, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x49, 0x64, 0x18, 0x03, 0x20,
0x01, 0x28, 0x03, 0x52, 0x0a, 0x6e, 0x73, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x49, 0x64, 0x12,
0x22, 0x0a, 0x0a, 0x6e, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x49, 0x64, 0x73, 0x18, 0x04, 0x20,
0x03, 0x28, 0x03, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0a, 0x6e, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65,
0x49, 0x64, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x6e, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x43, 0x6f,
0x64, 0x65, 0x73, 0x18, 0x11, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x6e, 0x73, 0x52, 0x6f, 0x75,
0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x27, 0x0a, 0x08, 0x6e, 0x73, 0x52, 0x6f, 0x75,
0x74, 0x65, 0x73, 0x18, 0x12, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x62, 0x2e, 0x4e,
0x53, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x08, 0x6e, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73,
0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x64, 0x64, 0x72, 0x18, 0x05,
0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x64, 0x64, 0x72,
0x12, 0x22, 0x0a, 0x0c, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65,
0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e,
0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e,
0x54, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x71, 0x75, 0x65, 0x73,
0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x63, 0x6f,
0x72, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65,
0x63, 0x6f, 0x72, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x63, 0x6f,
0x72, 0x64, 0x54, 0x79, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65,
0x63, 0x6f, 0x72, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x72, 0x65, 0x63, 0x6f,
0x72, 0x64, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72,
0x65, 0x63, 0x6f, 0x72, 0x64, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, 0x65,
0x74, 0x77, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x65,
0x72, 0x76, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69,
0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74,
0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x49, 0x64, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x4c, 0x6f,
0x63, 0x61, 0x6c, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x4c,
0x6f, 0x63, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x10, 0x20,
0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -262,13 +274,15 @@ func file_models_model_ns_access_log_proto_rawDescGZIP() []byte {
var file_models_model_ns_access_log_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_models_model_ns_access_log_proto_goTypes = []interface{}{
(*NSAccessLog)(nil), // 0: pb.NSAccessLog
(*NSRoute)(nil), // 1: pb.NSRoute
}
var file_models_model_ns_access_log_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
1, // 0: pb.NSAccessLog.nsRoutes:type_name -> pb.NSRoute
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_models_model_ns_access_log_proto_init() }
@@ -276,6 +290,7 @@ func file_models_model_ns_access_log_proto_init() {
if File_models_model_ns_access_log_proto != nil {
return
}
file_models_model_ns_route_proto_init()
if !protoimpl.UnsafeEnabled {
file_models_model_ns_access_log_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NSAccessLog); i {

View File

@@ -3,6 +3,8 @@ option go_package = "./pb";
package pb;
import "models/model_ns_route.proto";
// 域名服务访问记录
message NSAccessLog {
int64 nsNodeId = 1;
@@ -10,6 +12,7 @@ message NSAccessLog {
int64 nsRecordId = 3;
repeated int64 nsRouteIds = 4 [deprecated = true];
repeated string nsRouteCodes = 17;
repeated NSRoute nsRoutes = 18; // 仅供查看访问日志时使用
string remoteAddr = 5;
string questionName = 6;
string questionType = 7;