From 5152222000109dc97464562bff14da38296d0727 Mon Sep 17 00:00:00 2001 From: JeremyRand Date: Sat, 4 Nov 2017 08:00:09 +0000 Subject: [PATCH] gofmt -s tlshook/tlshook.go --- tlshook/tlshook.go | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/tlshook/tlshook.go b/tlshook/tlshook.go index 88ca979..a911f7b 100644 --- a/tlshook/tlshook.go +++ b/tlshook/tlshook.go @@ -1,58 +1,57 @@ package tlshook import ( + "github.com/hlandau/xlog" "github.com/namecoin/ncdns/certdehydrate" "github.com/namecoin/ncdns/certinject" "github.com/namecoin/ncdns/ncdomain" - "github.com/hlandau/xlog" ) var log, Log = xlog.New("ncdns.tlshook") func DomainValueHookTLS(qname string, ncv *ncdomain.Value) (err error) { - + log.Info("Intercepted a Value for ", qname) if protocol, ok := ncv.Map["_tcp"]; ok { // TODO: look into allowing non-TCP protocols log.Info("Saw a request with TCP") if port, ok := protocol.Map["_443"]; ok { // TODO: check all ports, not just 443 log.Info("Saw a request with TCP port 443") - - + // For dehydrated certificates if len(port.TLSAGenerated) > 0 { - + log.Info("Just saw a TLS port 443 capable domain request for ", qname, "!") - + for index, cert := range port.TLSAGenerated { - + log.Info("Using dehydrated certificate # ", index) - + template := cert - + var derBytes []byte - + derBytes, err = certdehydrate.FillRehydratedCertTemplate(template, qname) if err != nil { log.Info("Failed to create certificate: ", err) continue } - + // TODO: check return value certinject.InjectCert(derBytes) - + } - + } - + // TODO: support non-dehydrated certificates } } - + // remove any certs that aren't valid anymore certinject.CleanCerts() - + err = nil - + return -} \ No newline at end of file +}