commit 7e61c981f5539bf669653ba3f6a277fcab6c812a
parent 35119a0520a9674773b63fdc229a1eabe6b3ab82
Author: parazyd <parazyd@dyne.org>
Date: Tue, 20 Feb 2018 13:06:54 +0100
Write the onion hostname on key generation to a corresponding file.
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/cmd/dam-client/main.go b/cmd/dam-client/main.go
@@ -27,6 +27,7 @@ import (
"crypto/rsa"
"encoding/base64"
"encoding/json"
+ "io/ioutil"
"log"
"math/rand"
"os"
@@ -206,7 +207,11 @@ func main() {
lib.CheckError(err)
err = lib.SavePrivRsa(lib.PrivKeyPath, key)
lib.CheckError(err)
- // TODO: save or log hostname
+ onionaddr, err := lib.OnionFromPubkeyRsa(key.PublicKey)
+ lib.CheckError(err)
+ err = ioutil.WriteFile("hostname", onionaddr, 0644)
+ lib.CheckError(err)
+ log.Println("Our hostname is:", string(onionaddr))
}
// Start up the hidden service