Update examples
This commit is contained in:
parent
79a4dfd43f
commit
4b643523fb
@ -12,6 +12,7 @@ import (
|
||||
"time"
|
||||
|
||||
"git.sr.ht/~adnano/go-gemini"
|
||||
"git.sr.ht/~adnano/go-gemini/certificate"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
@ -33,7 +34,7 @@ func main() {
|
||||
log.Fatal(err)
|
||||
}
|
||||
server.CreateCertificate = func(hostname string) (tls.Certificate, error) {
|
||||
return gemini.CreateCertificate(gemini.CertificateOptions{
|
||||
return certificate.Create(certificate.CreateOptions{
|
||||
Subject: pkix.Name{
|
||||
CommonName: hostname,
|
||||
},
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"git.sr.ht/~adnano/go-gemini"
|
||||
"git.sr.ht/~adnano/go-gemini/certificate"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@ -24,20 +24,20 @@ func main() {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
options := gemini.CertificateOptions{
|
||||
options := certificate.CreateOptions{
|
||||
Subject: pkix.Name{
|
||||
CommonName: host,
|
||||
},
|
||||
DNSNames: []string{host},
|
||||
Duration: duration,
|
||||
}
|
||||
cert, err := gemini.CreateCertificate(options)
|
||||
cert, err := certificate.Create(options)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
certPath := host + ".crt"
|
||||
keyPath := host + ".key"
|
||||
if err := gemini.WriteCertificate(cert, certPath, keyPath); err != nil {
|
||||
if err := certificate.Write(cert, certPath, keyPath); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
"time"
|
||||
|
||||
"git.sr.ht/~adnano/go-gemini"
|
||||
"git.sr.ht/~adnano/go-gemini/certificate"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@ -21,7 +22,7 @@ func main() {
|
||||
log.Fatal(err)
|
||||
}
|
||||
server.CreateCertificate = func(hostname string) (tls.Certificate, error) {
|
||||
return gemini.CreateCertificate(gemini.CertificateOptions{
|
||||
return certificate.Create(certificate.CreateOptions{
|
||||
Subject: pkix.Name{
|
||||
CommonName: hostname,
|
||||
},
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
"time"
|
||||
|
||||
"git.sr.ht/~adnano/go-gemini"
|
||||
"git.sr.ht/~adnano/go-gemini/certificate"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@ -21,7 +22,7 @@ func main() {
|
||||
log.Fatal(err)
|
||||
}
|
||||
server.CreateCertificate = func(hostname string) (tls.Certificate, error) {
|
||||
return gemini.CreateCertificate(gemini.CertificateOptions{
|
||||
return certificate.Create(certificate.CreateOptions{
|
||||
Subject: pkix.Name{
|
||||
CommonName: hostname,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user