mirror of
https://github.com/Li4n0/revsuit.git
synced 2026-09-21 22:30:46 +08:00
feat: add value field to the dns log (#67)
record resolve value of dns log to facilitate the observation of dns rebinding.
This commit is contained in:
+6
-1
@@ -17,6 +17,7 @@ var _ record.Record = (*Record)(nil)
|
||||
|
||||
type Record struct {
|
||||
Domain string `gorm:"index" form:"domain" json:"domain"`
|
||||
Value string `form:"value" json:"value"`
|
||||
|
||||
record.BaseRecord
|
||||
Rule Rule `gorm:"foreignKey:RuleName;references:Name;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;" form:"-" json:"-" notice:"-"`
|
||||
@@ -30,7 +31,7 @@ func (r Record) Notice() {
|
||||
notice.Notice(r)
|
||||
}
|
||||
|
||||
func newRecord(rule *Rule, flag, domain, remoteIp, ipArea string) (r *Record, err error) {
|
||||
func newRecord(rule *Rule, flag, domain, value, remoteIp, ipArea string) (r *Record, err error) {
|
||||
r = &Record{
|
||||
BaseRecord: record.BaseRecord{
|
||||
Flag: flag,
|
||||
@@ -39,6 +40,7 @@ func newRecord(rule *Rule, flag, domain, remoteIp, ipArea string) (r *Record, er
|
||||
RequestTime: time.Now(),
|
||||
},
|
||||
Domain: domain,
|
||||
Value: value,
|
||||
Rule: *rule,
|
||||
}
|
||||
|
||||
@@ -89,6 +91,9 @@ func Records(c *gin.Context) {
|
||||
if dnsRecord.RuleName != "" {
|
||||
db.Where("rule_name = ?", dnsRecord.RuleName)
|
||||
}
|
||||
if dnsRecord.Value != "" {
|
||||
db.Where("address= ?", dnsRecord.Value)
|
||||
}
|
||||
|
||||
//Delete records
|
||||
if c.Request.Method == http.MethodDelete {
|
||||
|
||||
Reference in New Issue
Block a user