summaryrefslogtreecommitdiff
path: root/domain.go
diff options
context:
space:
mode:
authorHorus32015-03-20 17:30:11 +0100
committerHorus32015-03-20 17:30:11 +0100
commit410504e069d37c522dca6bf820e9fc4cea2de871 (patch)
tree75db9c44b5e852652fd8e54b8d4db91147fb77a2 /domain.go
parent9ab1f49c4c4aa5dcaa0dd50ec606ca06ca071c71 (diff)
downloadfreemail-410504e069d37c522dca6bf820e9fc4cea2de871.tar.gz
Check if domain points to mail server. Add http handler to create a new entry.
Diffstat (limited to 'domain.go')
-rw-r--r--domain.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/domain.go b/domain.go
index 0e3bfcc..501351b 100644
--- a/domain.go
+++ b/domain.go
@@ -3,6 +3,7 @@ package main
import (
"log"
"net"
+ "reflect"
"strings"
)
@@ -31,7 +32,7 @@ func (vD VirtualDomain) CreateDomain() bool {
return true
}
-func (vD VirtualDomain) ValidateDomain() bool {
+func (vD VirtualDomain) ValidateDomain(ref string) bool {
if vD.Name == "" {
return false
}
@@ -43,7 +44,12 @@ func (vD VirtualDomain) ValidateDomain() bool {
if len(addr) == 0 {
return false
}
- return true
+ serverIP, err := net.LookupIP(ref)
+ if err != nil {
+ log.Println(err)
+ return false
+ }
+ return reflect.DeepEqual(serverIP, addr)
}
func (vD VirtualDomain) ValidateDomainMX(ref string) bool {
if vD.Name == "" {