issue.go 815 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package cert
  2. import (
  3. "crypto"
  4. "github.com/go-acme/lego/v4/registration"
  5. )
  6. type ChannelWriter struct {
  7. Ch chan []byte
  8. }
  9. func NewChannelWriter() *ChannelWriter {
  10. return &ChannelWriter{
  11. Ch: make(chan []byte, 1024),
  12. }
  13. }
  14. func (cw *ChannelWriter) Write(p []byte) (n int, err error) {
  15. n = len(p)
  16. temp := make([]byte, n)
  17. copy(temp, p)
  18. cw.Ch <- temp
  19. return n, nil
  20. }
  21. // User You'll need a user or account type that implements acme.User
  22. type User struct {
  23. Email string
  24. Registration *registration.Resource
  25. Key crypto.PrivateKey
  26. }
  27. func (u *User) GetEmail() string {
  28. return u.Email
  29. }
  30. func (u *User) GetRegistration() *registration.Resource {
  31. return u.Registration
  32. }
  33. func (u *User) GetPrivateKey() crypto.PrivateKey {
  34. return u.Key
  35. }