mirror of https://github.com/v2ray/v2ray-core
allow insecure connections
parent
be81d246f2
commit
5e7d413404
|
@ -28,12 +28,13 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
type TLSSettings struct {
|
type TLSSettings struct {
|
||||||
Certs []tls.Certificate
|
AllowInsecure bool
|
||||||
|
Certs []tls.Certificate
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *TLSSettings) GetTLSConfig() *tls.Config {
|
func (this *TLSSettings) GetTLSConfig() *tls.Config {
|
||||||
config := &tls.Config{
|
config := &tls.Config{
|
||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: this.AllowInsecure,
|
||||||
}
|
}
|
||||||
|
|
||||||
config.Certificates = this.Certs
|
config.Certificates = this.Certs
|
||||||
|
|
|
@ -17,7 +17,8 @@ func (this *TLSSettings) UnmarshalJSON(data []byte) error {
|
||||||
KeyFile string `json:"keyFile"`
|
KeyFile string `json:"keyFile"`
|
||||||
}
|
}
|
||||||
type JSONConfig struct {
|
type JSONConfig struct {
|
||||||
Certs []*JSONCertConfig `json:"certificates"`
|
Insecure bool `json:"allowInsecure"`
|
||||||
|
Certs []*JSONCertConfig `json:"certificates"`
|
||||||
}
|
}
|
||||||
jsonConfig := new(JSONConfig)
|
jsonConfig := new(JSONConfig)
|
||||||
if err := json.Unmarshal(data, jsonConfig); err != nil {
|
if err := json.Unmarshal(data, jsonConfig); err != nil {
|
||||||
|
@ -31,6 +32,7 @@ func (this *TLSSettings) UnmarshalJSON(data []byte) error {
|
||||||
}
|
}
|
||||||
this.Certs[idx] = cert
|
this.Certs[idx] = cert
|
||||||
}
|
}
|
||||||
|
this.AllowInsecure = jsonConfig.Insecure
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue