Features: - Token-based subdomain claiming - NIC V2 (DynDNS2) protocol implementation - Technitium DNS integration - Rate limiting (10 req/min IP, 1 req/min token) - Web UI for space claiming - Docker/Docker Compose support - Compatible with UniFi, pfSense, EdgeRouter Module: git.dws.rip/DWS/dyn
36 lines
901 B
Go
36 lines
901 B
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type Space struct {
|
|
Token string `json:"token" db:"token"`
|
|
Subdomain string `json:"subdomain" db:"subdomain"`
|
|
LastIP string `json:"last_ip" db:"last_ip"`
|
|
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
|
|
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
|
}
|
|
|
|
type CreateSpaceRequest struct {
|
|
Subdomain string `json:"subdomain" binding:"required,alphanumdash,min=3,max=63"`
|
|
}
|
|
|
|
type CreateSpaceResponse struct {
|
|
Token string `json:"token"`
|
|
Subdomain string `json:"subdomain"`
|
|
FQDN string `json:"fqdn"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type SpaceInfo struct {
|
|
Subdomain string `json:"subdomain"`
|
|
LastIP string `json:"last_ip"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
func (s *Space) GetFQDN(zone string) string {
|
|
return s.Subdomain + "." + zone
|
|
}
|