aboutsummaryrefslogtreecommitdiff
path: root/examples/cert.go
diff options
context:
space:
mode:
authoradnano <[email protected]>2020-10-12 16:34:52 -0400
committeradnano <[email protected]>2020-10-12 16:34:59 -0400
commita33a5be0634cbbca6c6f8eb2fd53bceb014fed02 (patch)
treea23fdfdab8807baa8a604023f25d729f3edaabf1 /examples/cert.go
parentUse a map for registering server handlers (diff)
downloadgo-gemini-a33a5be0634cbbca6c6f8eb2fd53bceb014fed02.tar.xz
go-gemini-a33a5be0634cbbca6c6f8eb2fd53bceb014fed02.zip
Update documentation
Diffstat (limited to 'examples/cert.go')
-rw-r--r--examples/cert.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/cert.go b/examples/cert.go
new file mode 100644
index 0000000..4c08578
--- /dev/null
+++ b/examples/cert.go
@@ -0,0 +1,24 @@
+// +build ignore
+
+package main
+
+import (
+ "log"
+ "time"
+
+ "git.sr.ht/~adnano/gmi"
+)
+
+func main() {
+ host := "localhost"
+
+ duration := 365 * 24 * time.Hour
+ crt, key, err := gmi.NewRawCertificate(host, duration)
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ if err := gmi.WriteX509KeyPair(host, crt, key); err != nil {
+ log.Fatal(err)
+ }
+}