Skip to content

Commit

Permalink
Merge pull request #20 from eryajf/feat_record_info
Browse files Browse the repository at this point in the history
feat: 支持同域名不通路线的解析方式获取证书信息
  • Loading branch information
eryajf authored Sep 13, 2024
2 parents 90f2682 + 58bb65b commit b4356ed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions pkg/export/cron_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ func loadingCert() {
CloudName: v.CloudName,
DomainName: v.DomainName,
FullRecord: v.FullRecord,
RecordValue: v.RecordValue,
RecordID: v.RecordID,
})
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/export/record_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,12 @@ func GetMultipleCertInfo(records []provider.GetRecordCertReq) ([]provider.Record
func GetCertInfo(record provider.GetRecordCertReq) (certInfo provider.RecordCert, err error) {
config := &tls.Config{
InsecureSkipVerify: true,
ServerName: record.FullRecord,
}
d := net.Dialer{
Timeout: time.Second * 3,
}
conn, err := tls.DialWithDialer(&d, "tcp", record.FullRecord+":443", config)
conn, err := tls.DialWithDialer(&d, "tcp", record.RecordValue+":443", config)
if err != nil {
return certInfo, err
}
Expand Down Expand Up @@ -135,7 +136,7 @@ func getNewRecord(records []provider.Record) (newRecords []provider.Record) {
rec.FullRecord = strings.ReplaceAll(rec.FullRecord, "*", "a")
}
if (rec.RecordType == "A" || rec.RecordType == "CNAME") &&
rec.RecordStatus == "enable" && isPortOpen(rec.FullRecord) {
rec.RecordStatus == "enable" && isPortOpen(rec.RecordValue) {
recordChan <- rec
}
}(record)
Expand Down
1 change: 1 addition & 0 deletions pkg/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ type GetRecordCertReq struct {
CloudName string `json:"cloud_name"`
DomainName string `json:"domain_name"`
FullRecord string `json:"full_record"`
RecordValue string `json:"record_value"`
RecordID string `json:"record_id"`
}

Expand Down

0 comments on commit b4356ed

Please sign in to comment.