From d78052ce084da33e94b2f242e73364c56a759aec Mon Sep 17 00:00:00 2001 From: Adnan Maolood Date: Sun, 10 Jan 2021 16:44:32 -0500 Subject: [PATCH] Move tofu.go to a subpackage --- examples/client.go | 5 +++-- tofu.go => tofu/tofu.go | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) rename tofu.go => tofu/tofu.go (97%) diff --git a/examples/client.go b/examples/client.go index e3c7537..251c6cd 100644 --- a/examples/client.go +++ b/examples/client.go @@ -17,11 +17,12 @@ import ( "time" "git.sr.ht/~adnano/go-gemini" + "git.sr.ht/~adnano/go-gemini/tofu" "git.sr.ht/~adnano/go-xdg" ) var ( - hosts gemini.KnownHostsFile + hosts tofu.KnownHostsFile scanner *bufio.Scanner ) @@ -46,7 +47,7 @@ Otherwise, this should be safe to trust. => ` func trustCertificate(hostname string, cert *x509.Certificate) error { - fingerprint := gemini.NewFingerprint(cert.Raw, cert.NotAfter) + fingerprint := tofu.NewFingerprint(cert.Raw, cert.NotAfter) knownHost, ok := hosts.Lookup(hostname) if ok && time.Now().Before(knownHost.Expires) { // Check fingerprint diff --git a/tofu.go b/tofu/tofu.go similarity index 97% rename from tofu.go rename to tofu/tofu.go index 9a252d6..547894a 100644 --- a/tofu.go +++ b/tofu/tofu.go @@ -1,4 +1,5 @@ -package gemini +// Package tofu implements trust on first use using hosts and fingerprints. +package tofu import ( "bufio"