mirror of
https://github.com/MatsuriDayo/NekoBoxForAndroid.git
synced 2025-12-18 22:20:06 +08:00
25 lines
506 B
Go
25 lines
506 B
Go
package libcore
|
|
|
|
import (
|
|
"crypto/x509"
|
|
"log"
|
|
_ "unsafe" // for go:linkname
|
|
)
|
|
|
|
//go:linkname systemRoots crypto/x509.systemRoots
|
|
var systemRoots *x509.CertPool
|
|
|
|
func updateRootCACerts(pem []byte) {
|
|
x509.SystemCertPool()
|
|
roots := x509.NewCertPool()
|
|
if !roots.AppendCertsFromPEM(pem) {
|
|
log.Println("failed to append certificates from pem")
|
|
return
|
|
}
|
|
systemRoots = roots
|
|
log.Println("external ca.pem was loaded")
|
|
}
|
|
|
|
//go:linkname initSystemRoots crypto/x509.initSystemRoots
|
|
func initSystemRoots()
|