mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
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)
43 lines
815 B
Go
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
|
|
}
|