mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-22 13:16:07 +03:00
Fixed refresh error when multiple certificates exist (#663)
* Fix when there are multiple certs, after refresh from file all will be the same as the last.
This commit is contained in:
parent
d111a046c0
commit
b0b2aaa70c
@ -66,7 +66,7 @@ func (c *Config) BuildCertificates() []*tls.Certificate {
|
|||||||
isOcspstapling = true
|
isOcspstapling = true
|
||||||
}
|
}
|
||||||
index := len(certs) - 1
|
index := len(certs) - 1
|
||||||
go func(cert *tls.Certificate, index int) {
|
go func(entry *Certificate, cert *tls.Certificate, index int) {
|
||||||
t := time.NewTicker(time.Duration(hotReloadCertInterval) * time.Second)
|
t := time.NewTicker(time.Duration(hotReloadCertInterval) * time.Second)
|
||||||
for {
|
for {
|
||||||
if entry.CertificatePath != "" && entry.KeyPath != "" {
|
if entry.CertificatePath != "" && entry.KeyPath != "" {
|
||||||
@ -107,7 +107,7 @@ func (c *Config) BuildCertificates() []*tls.Certificate {
|
|||||||
certs[index] = cert
|
certs[index] = cert
|
||||||
<-t.C
|
<-t.C
|
||||||
}
|
}
|
||||||
}(certs[len(certs)-1], index)
|
}(entry, certs[index], index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return certs
|
return certs
|
||||||
|
@ -67,7 +67,7 @@ func (c *Config) BuildCertificates() []*xtls.Certificate {
|
|||||||
isOcspstapling = true
|
isOcspstapling = true
|
||||||
}
|
}
|
||||||
index := len(certs) - 1
|
index := len(certs) - 1
|
||||||
go func(cert *xtls.Certificate, index int) {
|
go func(entry *Certificate, cert *xtls.Certificate, index int) {
|
||||||
t := time.NewTicker(time.Duration(hotRelodaInterval) * time.Second)
|
t := time.NewTicker(time.Duration(hotRelodaInterval) * time.Second)
|
||||||
for {
|
for {
|
||||||
if entry.CertificatePath != "" && entry.KeyPath != "" {
|
if entry.CertificatePath != "" && entry.KeyPath != "" {
|
||||||
@ -108,7 +108,7 @@ func (c *Config) BuildCertificates() []*xtls.Certificate {
|
|||||||
certs[index] = cert
|
certs[index] = cert
|
||||||
<-t.C
|
<-t.C
|
||||||
}
|
}
|
||||||
}(certs[len(certs)-1], index)
|
}(entry, certs[index], index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return certs
|
return certs
|
||||||
|
Loading…
Reference in New Issue
Block a user