2020-09-27 17:50:48 +00:00
|
|
|
// +build example
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
2020-09-28 03:49:41 +00:00
|
|
|
"time"
|
2020-09-27 17:50:48 +00:00
|
|
|
|
2020-09-28 18:20:19 +00:00
|
|
|
"git.sr.ht/~adnano/go-gemini"
|
2020-09-27 17:50:48 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
host := "localhost"
|
|
|
|
|
2020-09-28 03:49:41 +00:00
|
|
|
duration := 365 * 24 * time.Hour
|
|
|
|
crt, key, err := gmi.NewRawCertificate(host, duration)
|
2020-09-27 17:50:48 +00:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
2020-09-28 03:49:41 +00:00
|
|
|
if err := gmi.WriteCertificate(host, crt, key); err != nil {
|
2020-09-27 17:50:48 +00:00
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|