update refactor

This commit is contained in:
xvzc 2022-01-08 00:39:58 +09:00
parent f7d7f37986
commit cb122ff3da
2 changed files with 7 additions and 3 deletions

View File

@ -37,8 +37,14 @@ func Start() {
util.Debug("Client sent data: ", len(message)) util.Debug("Client sent data: ", len(message))
util.Debug("")
util.Debug("Request : ")
util.Debug("\n" + string(message))
method := util.ExtractMethod(&message) method := util.ExtractMethod(&message)
if !util.IsValidMethod(method) { if !util.IsValidMethod(method) {
util.Debug("Not a valid method: " + method)
return return
} }
@ -46,6 +52,7 @@ func Start() {
ip, err := util.DnsLookupOverHttps(config.GetConfig().DNS, domain) // Dns lookup over https ip, err := util.DnsLookupOverHttps(config.GetConfig().DNS, domain) // Dns lookup over https
if err != nil { if err != nil {
log.Println("Error looking up dns: "+domain, err)
return return
} }

View File

@ -1,8 +1,6 @@
package util package util
import ( import (
"log"
"github.com/babolivier/go-doh-client" "github.com/babolivier/go-doh-client"
) )
@ -16,7 +14,6 @@ func DnsLookupOverHttps(dns string, domain string) (string, error) {
Debug(domain) Debug(domain)
a, _, err := resolver.LookupA(domain) a, _, err := resolver.LookupA(domain)
if err != nil { if err != nil {
log.Println("Error looking up dns. ", err)
return "", err return "", err
} }