]> Sergey Matveev's repositories - tofuproxy.git/blobdiff - dane.go
Refactoring
[tofuproxy.git] / dane.go
diff --git a/dane.go b/dane.go
index f660f026cc0797b69e4928561179ac1812a69e03..cd97220f6d7ff4ed9d7fdd477fca846e0de2b8e3 100644 (file)
--- a/dane.go
+++ b/dane.go
@@ -1,4 +1,5 @@
 /*
+tofuproxy -- HTTP proxy with TLS certificates management
 Copyright (C) 2021 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
@@ -14,7 +15,7 @@ You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-package main
+package tofuproxy
 
 import (
        "crypto/sha256"
@@ -28,12 +29,10 @@ import (
        "github.com/miekg/dns"
 )
 
-var (
-       dnsSrv *string
-)
+var DNSSrv string
 
 func dane(addr string, cert *x509.Certificate) (bool, bool) {
-       if *dnsSrv == "" {
+       if DNSSrv == "" {
                return false, false
        }
        host := addr
@@ -45,7 +44,7 @@ func dane(addr string, cert *x509.Certificate) (bool, bool) {
        }
        m := new(dns.Msg)
        m.SetQuestion(dns.Fqdn(fmt.Sprintf("_%s._tcp.%s", port, host)), dns.TypeTLSA)
-       msg, err := dns.Exchange(m, *dnsSrv)
+       msg, err := dns.Exchange(m, DNSSrv)
        if err != nil {
                log.Printf("DNS: %+v\n", err)
                return false, false