nginx-ui/internal/cert/issue.go
0xJacky ac68fd05c9
refactor(cert): introducing new management page
1. User can now view the latest renew logs of the certain certificate.

2. Add manually renew button in certificate modify page for managed certificate (auto cert)
2023-12-04 22:22:42 +08:00

43 lines
815 B
Go

package cert
import (
"crypto"
"github.com/go-acme/lego/v4/registration"
)
type ChannelWriter struct {
Ch chan []byte
}
func NewChannelWriter() *ChannelWriter {
return &ChannelWriter{
Ch: make(chan []byte, 1024),
}
}
func (cw *ChannelWriter) Write(p []byte) (n int, err error) {
n = len(p)
temp := make([]byte, n)
copy(temp, p)
cw.Ch <- temp
return n, nil
}
// User You'll need a user or account type that implements acme.User
type User struct {
Email string
Registration *registration.Resource
Key crypto.PrivateKey
}
func (u *User) GetEmail() string {
return u.Email
}
func (u *User) GetRegistration() *registration.Resource {
return u.Registration
}
func (u *User) GetPrivateKey() crypto.PrivateKey {
return u.Key
}