Documentation ¶
Index ¶
- Constants
- func ActionToString(action int) string
- func CreateAllRecordsFromDB(client *mongo.Client) *[]Record
- func CreateManyRecordsFromDB(client *mongo.Client, key string, value interface{}) *[]Record
- func GetRecord(client *mongo.Client, url string, messageType dnsmessage.Type) int
- func IsRecordEmpty(record Record) bool
- func Listen(s *Server)
- func RecordToString(record Record) string
- func StringToAction(action string) int
- func StringToType(mtype string) (dnsmessage.Type, error)
- func TypeToString(mtype dnsmessage.Type) string
- type MessageData
- type Question
- type Record
- type Server
- type Stat
- type StatCollection
Constants ¶
View Source
const ( // ActionUknown from error or not found record1 ActionNo = -1 // ActionBlock block given url ActionBlock = iota // ActionLog log given url ActionLog = iota )
Variables ¶
This section is empty.
Functions ¶
func ActionToString ¶
func CreateAllRecordsFromDB ¶
func CreateManyRecordsFromDB ¶
func IsRecordEmpty ¶
func RecordToString ¶
func StringToAction ¶
func StringToType ¶
func StringToType(mtype string) (dnsmessage.Type, error)
func TypeToString ¶
func TypeToString(mtype dnsmessage.Type) string
Types ¶
type MessageData ¶
type MessageData struct { ID uint16 Questions []Question ResponseType dnsmessage.Type ResponseURL string Data *dnsmessage.Message // contains filtered or unexported fields }
type Question ¶
type Question struct { URL string Type dnsmessage.Type }
type Record ¶
type Record struct { ID primitive.ObjectID `bson:"_id,omitempty"` Action int `bson:"action"` URL string `bson:"url"` Type dnsmessage.Type `bson:"type"` }
Record struct containging single record with corresponding action
func CreateRecord ¶
func CreateRecord(url string, action int, recordType dnsmessage.Type) *Record
CreateRecord create record structure
func CreateRecordBlock ¶
CreateRecordBlock create record structure with type ActionBlock
func GetOneRecordFromDB ¶
func GetOneRecordFromDB(url string, recordType dnsmessage.Type) Record
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server struct containing all dns connection data
type Stat ¶
type Stat struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"_id"` Action string `bson:"action" json:"action"` URL string `bson:"url" json:"url"` Type string `bson:"type" json:"type"` IP string `bson:"ip" json:"ip"` Port int `bson:"port" json:"port"` Timestamp int64 `bson:"timestamp" json:"timestamp"` }
type StatCollection ¶
type StatCollection struct { Number_of_records int `json:"number_of_records"` Number_of_requests int `json:"number_of_requests"` Number_of_blocked_requests int `json:"number_of_blocked_requests"` Requests []Stat `json:"requests"` }
func GetStatsCollection ¶
func GetStatsCollection(client *mongo.Client) *StatCollection
Click to show internal directories.
Click to hide internal directories.