aboutsummaryrefslogtreecommitdiff
path: root/models
diff options
context:
space:
mode:
authorBobby <[email protected]>2026-03-08 17:00:49 +0530
committerBobby <[email protected]>2026-03-08 17:00:49 +0530
commit2d5fb5e2078e92e7ec19582c3954409dd93f89fd (patch)
tree932f96385d56c94596cb2bb073f0f72b13d3eee4 /models
parent0f254730178c9b0d9b171fef49993071a4b6a0f1 (diff)
downloaddove-2d5fb5e2078e92e7ec19582c3954409dd93f89fd.tar.xz
dove-2d5fb5e2078e92e7ec19582c3954409dd93f89fd.zip
feat(dns): Implement DNS record management and query handling
- Added models for various DNS record types: A, AAAA, CNAME, MX, SRV, and TXT. - Created repository functions for CRUD operations on DNS records. - Developed DNS server functionality to handle incoming queries and forward them to upstream servers. - Implemented local resolution for DNS queries, including support for A, AAAA, CNAME, MX, TXT, and SRV records. - Enhanced SMTP server to support TLS and STARTTLS configurations. - Improved email session handling with local delivery and error logging. - Added new log messages for better traceability of DNS operations and SMTP actions.
Diffstat (limited to 'models')
-rw-r--r--models/dns/a.go14
-rw-r--r--models/dns/aaaa.go13
-rw-r--r--models/dns/cname.go13
-rw-r--r--models/dns/mx.go14
-rw-r--r--models/dns/srv.go17
-rw-r--r--models/dns/txt.go13
6 files changed, 84 insertions, 0 deletions
diff --git a/models/dns/a.go b/models/dns/a.go
new file mode 100644
index 0000000..b3c7f38
--- /dev/null
+++ b/models/dns/a.go
@@ -0,0 +1,14 @@
+package dns
+
+import (
+ "gorm.io/gorm"
+)
+
+type ARecord struct {
+ gorm.Model
+ DomainID uint `gorm:"not null;index" json:"domain_id"`
+ Name string `gorm:"not null;default:@" json:"name"`
+ Address string `gorm:"not null" json:"address"`
+ Port int `gorm:"default:0" json:"port"`
+ TTL uint32 `gorm:"not null;default:300" json:"ttl"`
+}
diff --git a/models/dns/aaaa.go b/models/dns/aaaa.go
new file mode 100644
index 0000000..0053fe0
--- /dev/null
+++ b/models/dns/aaaa.go
@@ -0,0 +1,13 @@
+package dns
+
+import (
+ "gorm.io/gorm"
+)
+
+type AAAARecord struct {
+ gorm.Model
+ DomainID uint `gorm:"not null;index" json:"domain_id"`
+ Name string `gorm:"not null;default:@" json:"name"`
+ Address string `gorm:"not null" json:"address"`
+ TTL uint32 `gorm:"not null;default:300" json:"ttl"`
+}
diff --git a/models/dns/cname.go b/models/dns/cname.go
new file mode 100644
index 0000000..5460f82
--- /dev/null
+++ b/models/dns/cname.go
@@ -0,0 +1,13 @@
+package dns
+
+import (
+ "gorm.io/gorm"
+)
+
+type CNAMERecord struct {
+ gorm.Model
+ DomainID uint `gorm:"not null;index" json:"domain_id"`
+ Name string `gorm:"not null" json:"name"`
+ Target string `gorm:"not null" json:"target"`
+ TTL uint32 `gorm:"not null;default:300" json:"ttl"`
+}
diff --git a/models/dns/mx.go b/models/dns/mx.go
new file mode 100644
index 0000000..1e05489
--- /dev/null
+++ b/models/dns/mx.go
@@ -0,0 +1,14 @@
+package dns
+
+import (
+ "gorm.io/gorm"
+)
+
+type MXRecord struct {
+ gorm.Model
+ DomainID uint `gorm:"not null;index" json:"domain_id"`
+ Name string `gorm:"not null;default:@" json:"name"`
+ Target string `gorm:"not null" json:"target"`
+ Priority uint16 `gorm:"not null;default:10" json:"priority"`
+ TTL uint32 `gorm:"not null;default:300" json:"ttl"`
+}
diff --git a/models/dns/srv.go b/models/dns/srv.go
new file mode 100644
index 0000000..481ee7e
--- /dev/null
+++ b/models/dns/srv.go
@@ -0,0 +1,17 @@
+package dns
+
+import (
+ "gorm.io/gorm"
+)
+
+type SRVRecord struct {
+ gorm.Model
+ DomainID uint `gorm:"not null;index" json:"domain_id"`
+ Name string `gorm:"not null" json:"name"`
+ Target string `gorm:"not null" json:"target"`
+ Priority uint16 `gorm:"not null;default:0" json:"priority"`
+ Weight uint16 `gorm:"not null;default:0" json:"weight"`
+ Port uint16 `gorm:"not null" json:"port"`
+ Protocol string `gorm:"not null;default:tcp" json:"protocol"`
+ TTL uint32 `gorm:"not null;default:300" json:"ttl"`
+}
diff --git a/models/dns/txt.go b/models/dns/txt.go
new file mode 100644
index 0000000..98342b3
--- /dev/null
+++ b/models/dns/txt.go
@@ -0,0 +1,13 @@
+package dns
+
+import (
+ "gorm.io/gorm"
+)
+
+type TXTRecord struct {
+ gorm.Model
+ DomainID uint `gorm:"not null;index" json:"domain_id"`
+ Name string `gorm:"not null;default:@" json:"name"`
+ Content string `gorm:"not null" json:"content"`
+ TTL uint32 `gorm:"not null;default:300" json:"ttl"`
+}