I'm very new to golang, I have some experience with python but not on this level per say. I am creating an application that's called "digall", making it easy for a user to see active dns-records when checking a domain name.
In the application I am using LookupSRV
, which I seem to have some issues with:
func srvRecord(query string) {
service := "sipfederationtls"
protocol:= "tcp"
fmt.Printf("
[+] SRV Record(s)
")
//srvMap := ["sipfederationtls", "autodiscover", "VLMCS"]
cname, addresses, err := net.LookupSRV(service, protocol, query)
if err != nil {
fmt.Printf("[!] This feature is currently under development, thus not ready yet.
")
}
fmt.Printf("cname : %s
", cname)
for i := 0; i < len(addresses); i++ {
fmt.Printf("addrs[%d].Target : %s
", i, addresses[i].Target)
fmt.Printf("addrs[%d].Port : %d
", i, addresses[i].Port)
fmt.Printf("addrs[%d].Priority : %d
", i, addresses[i].Priority)
fmt.Printf("addrs[%d].Weight : %d
", i, addresses[i].Weight)
}
}
As you can see the variable "service" serves as the prefix of the SRV record. My only problem is that i want to check multiple prefixes of this record, namely "sipfederationtls", "autodiscover" and "VLMCS".
What I am asking is; How to i make this function swift through these prefixes and return the ones that work? (the ones that error out will be handled by err by my fantastic error message)
I am aware that this is a noob question, and like I said I am very new to golang. I would appreciate any tips you guys could give me.
Here is the full source of the application: http://dpaste.com/3X24ZYR
Thank you.