mylego

package
v0.0.0-...-de015ad Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2023 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Email        string                 `json:"email"`
	Registration *registration.Resource `json:"registration"`
	// contains filtered or unexported fields
}

Account represents a users local saved credentials.

func (*Account) GetEmail

func (a *Account) GetEmail() string

GetEmail returns the email address for the account.

func (*Account) GetPrivateKey

func (a *Account) GetPrivateKey() crypto.PrivateKey

GetPrivateKey returns the private RSA account key.

func (*Account) GetRegistration

func (a *Account) GetRegistration() *registration.Resource

GetRegistration returns the server registration.

type AccountsStorage

type AccountsStorage struct {
	// contains filtered or unexported fields
}

AccountsStorage A storage for account data.

rootPath:

./.lego/accounts/
     │      └── root accounts directory
     └── "path" option

rootUserPath:

./.lego/accounts/localhost_14000/hubert@hubert.com/
     │      │             │             └── userID ("email" option)
     │      │             └── CA server ("server" option)
     │      └── root accounts directory
     └── "path" option

keysPath:

./.lego/accounts/localhost_14000/hubert@hubert.com/keys/
     │      │             │             │           └── root keys directory
     │      │             │             └── userID ("email" option)
     │      │             └── CA server ("server" option)
     │      └── root accounts directory
     └── "path" option

accountFilePath:

./.lego/accounts/localhost_14000/hubert@hubert.com/account.json
     │      │             │             │             └── account file
     │      │             │             └── userID ("email" option)
     │      │             └── CA server ("server" option)
     │      └── root accounts directory
     └── "path" option

func NewAccountsStorage

func NewAccountsStorage(l *LegoCMD) *AccountsStorage

NewAccountsStorage Creates a new AccountsStorage.

func (*AccountsStorage) ExistsAccountFilePath

func (s *AccountsStorage) ExistsAccountFilePath() bool

func (*AccountsStorage) GetPrivateKey

func (s *AccountsStorage) GetPrivateKey(keyType certcrypto.KeyType) crypto.PrivateKey

func (*AccountsStorage) GetRootPath

func (s *AccountsStorage) GetRootPath() string

func (*AccountsStorage) GetRootUserPath

func (s *AccountsStorage) GetRootUserPath() string

func (*AccountsStorage) GetUserID

func (s *AccountsStorage) GetUserID() string

func (*AccountsStorage) LoadAccount

func (s *AccountsStorage) LoadAccount(privateKey crypto.PrivateKey) *Account

func (*AccountsStorage) Save

func (s *AccountsStorage) Save(account *Account) error

type CertConfig

type CertConfig struct {
	CertMode         string            `mapstructure:"CertMode"` // none, file, http, dns
	CertDomain       string            `mapstructure:"CertDomain"`
	CertFile         string            `mapstructure:"CertFile"`
	KeyFile          string            `mapstructure:"KeyFile"`
	Provider         string            `mapstructure:"Provider"` // alidns, cloudflare, gandi, godaddy....
	Email            string            `mapstructure:"Email"`
	DNSEnv           map[string]string `mapstructure:"DNSEnv"`
	RejectUnknownSni bool              `mapstructure:"RejectUnknownSni"`
}

type CertificatesStorage

type CertificatesStorage struct {
	// contains filtered or unexported fields
}

CertificatesStorage a certificates' storage.

rootPath:

./.lego/certificates/
     │      └── root certificates directory
     └── "path" option

archivePath:

./.lego/archives/
     │      └── archived certificates directory
     └── "path" option

func NewCertificatesStorage

func NewCertificatesStorage(path string) *CertificatesStorage

NewCertificatesStorage create a new certificates storage.

func (*CertificatesStorage) CreateRootFolder

func (s *CertificatesStorage) CreateRootFolder()

func (*CertificatesStorage) ExistsFile

func (s *CertificatesStorage) ExistsFile(domain, extension string) bool

func (*CertificatesStorage) GetFileName

func (s *CertificatesStorage) GetFileName(domain, extension string) string

func (*CertificatesStorage) GetRootPath

func (s *CertificatesStorage) GetRootPath() string

func (*CertificatesStorage) ReadCertificate

func (s *CertificatesStorage) ReadCertificate(domain, extension string) ([]*x509.Certificate, error)

func (*CertificatesStorage) ReadFile

func (s *CertificatesStorage) ReadFile(domain, extension string) ([]byte, error)

func (*CertificatesStorage) ReadResource

func (s *CertificatesStorage) ReadResource(domain string) certificate.Resource

func (*CertificatesStorage) SaveResource

func (s *CertificatesStorage) SaveResource(certRes *certificate.Resource)

func (*CertificatesStorage) WriteFile

func (s *CertificatesStorage) WriteFile(domain, extension string, data []byte) error

type LegoCMD

type LegoCMD struct {
	C *CertConfig
	// contains filtered or unexported fields
}

func New

func New(certConf *CertConfig) (*LegoCMD, error)

func (*LegoCMD) DNSCert

func (l *LegoCMD) DNSCert() (CertPath string, KeyPath string, err error)

DNSCert cert a domain using DNS API

func (*LegoCMD) HTTPCert

func (l *LegoCMD) HTTPCert() (CertPath string, KeyPath string, err error)

HTTPCert cert a domain using http methods

func (*LegoCMD) Renew

func (l *LegoCMD) Renew() (bool, error)

func (*LegoCMD) RenewCert

func (l *LegoCMD) RenewCert() (CertPath string, KeyPath string, ok bool, err error)

RenewCert renew a domain cert

func (*LegoCMD) Run

func (l *LegoCMD) Run() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL