go-gemini/examples/cert/cert.go

25 lines
340 B
Go
Raw Normal View History

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