mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-07-26 11:44:22 -04:00
added json loading of the PinnedPeerCertificateChainSha256
This commit is contained in:
parent
50bdcc24a7
commit
0c6a2e06b9
@ -1,6 +1,7 @@
|
|||||||
package conf
|
package conf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -297,6 +298,7 @@ type TLSConfig struct {
|
|||||||
ALPN *StringList `json:"alpn"`
|
ALPN *StringList `json:"alpn"`
|
||||||
EnableSessionResumption bool `json:"enableSessionResumption"`
|
EnableSessionResumption bool `json:"enableSessionResumption"`
|
||||||
DisableSystemRoot bool `json:"disableSystemRoot"`
|
DisableSystemRoot bool `json:"disableSystemRoot"`
|
||||||
|
PinnedPeerCertificateChainSha256 *[]string `json:"pinnedPeerCertificateChainSha256"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build implements Buildable.
|
// Build implements Buildable.
|
||||||
@ -320,6 +322,18 @@ func (c *TLSConfig) Build() (proto.Message, error) {
|
|||||||
}
|
}
|
||||||
config.EnableSessionResumption = c.EnableSessionResumption
|
config.EnableSessionResumption = c.EnableSessionResumption
|
||||||
config.DisableSystemRoot = c.DisableSystemRoot
|
config.DisableSystemRoot = c.DisableSystemRoot
|
||||||
|
|
||||||
|
if c.PinnedPeerCertificateChainSha256 != nil {
|
||||||
|
config.PinnedPeerCertificateChainSha256 = [][]byte{}
|
||||||
|
for _, v := range *c.PinnedPeerCertificateChainSha256 {
|
||||||
|
hashValue, err := base64.StdEncoding.DecodeString(v)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
config.PinnedPeerCertificateChainSha256 = append(config.PinnedPeerCertificateChainSha256, hashValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return config, nil
|
return config, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user