mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 04:22:33 +08:00
fix: lint
This commit is contained in:
@@ -505,48 +505,3 @@ type DNSProvider interface {
|
||||
libdns.RecordSetter
|
||||
libdns.RecordDeleter
|
||||
}
|
||||
|
||||
type manualDNSSolver struct {
|
||||
check bool // 是否检查 DNS 解析,目前没写
|
||||
controlChan chan struct{}
|
||||
dnsChan chan any
|
||||
certChan chan any
|
||||
records []DNSRecord
|
||||
}
|
||||
|
||||
func (s *manualDNSSolver) Present(ctx context.Context, challenge acme.Challenge) error {
|
||||
full := challenge.DNS01TXTRecordName()
|
||||
keyAuth := challenge.DNS01KeyAuthorization()
|
||||
domain, err := publicsuffix.EffectiveTLDPlusOne(full)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get the effective TLD+1 for %q: %w", full, err)
|
||||
}
|
||||
|
||||
s.records = append(s.records, DNSRecord{
|
||||
Name: strings.TrimSuffix(full, "."+domain),
|
||||
Domain: domain,
|
||||
Value: keyAuth,
|
||||
})
|
||||
s.dnsChan <- s.records
|
||||
|
||||
select {
|
||||
case <-s.controlChan:
|
||||
return nil
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *manualDNSSolver) CleanUp(_ context.Context, _ acme.Challenge) error {
|
||||
defer func() { _ = recover() }()
|
||||
close(s.controlChan)
|
||||
close(s.dnsChan)
|
||||
close(s.certChan)
|
||||
return nil
|
||||
}
|
||||
|
||||
type DNSRecord struct {
|
||||
Name string `json:"name"`
|
||||
Domain string `json:"domain"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user