refactor: replace experimental.fingerprints with custom-certificates and Change the fingerprint verification logic to SSL pinning

This commit is contained in:
Skyxim
2023-01-14 21:08:06 +08:00
parent 2095f4f670
commit b6b6413d04
19 changed files with 91 additions and 97 deletions

View File

@ -18,7 +18,7 @@ import (
"github.com/Dreamacro/clash/component/profile/cachefile"
"github.com/Dreamacro/clash/component/resolver"
SNI "github.com/Dreamacro/clash/component/sniffer"
"github.com/Dreamacro/clash/component/tls"
CTLS "github.com/Dreamacro/clash/component/tls"
"github.com/Dreamacro/clash/component/trie"
"github.com/Dreamacro/clash/config"
C "github.com/Dreamacro/clash/constant"
@ -146,10 +146,9 @@ func updateExperimental(c *config.Config) {
}
func preUpdateExperimental(c *config.Config) {
for _, fingerprint := range c.Experimental.Fingerprints {
if err := tls.AddCertFingerprint(fingerprint); err != nil {
log.Warnln("fingerprint[%s] is err, %s", fingerprint, err.Error())
}
CTLS.AddCertificate(c.TLS.PrivateKey, c.TLS.Certificate)
for _, c := range c.TLS.CustomTrustCert {
CTLS.AddCertificate(c.PrivateKey, c.Certificate)
}
}

View File

@ -42,8 +42,8 @@ func Parse(options ...Option) error {
}
if cfg.General.ExternalController != "" {
go route.Start(cfg.General.ExternalController,cfg.General.ExternalControllerTLS,
cfg.General.Secret,cfg.TLS.Certificate,cfg.TLS.PrivateKey)
go route.Start(cfg.General.ExternalController, cfg.General.ExternalControllerTLS,
cfg.General.Secret, cfg.TLS.Certificate, cfg.TLS.PrivateKey)
}
executor.ApplyConfig(cfg, true)