1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-18 18:36:11 -05:00

allow insecure connections

This commit is contained in:
v2ray 2016-07-10 15:30:48 +02:00
parent be81d246f2
commit 5e7d413404
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
2 changed files with 6 additions and 3 deletions

View File

@ -28,12 +28,13 @@ const (
) )
type TLSSettings struct { type TLSSettings struct {
AllowInsecure bool
Certs []tls.Certificate 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

View File

@ -17,6 +17,7 @@ func (this *TLSSettings) UnmarshalJSON(data []byte) error {
KeyFile string `json:"keyFile"` KeyFile string `json:"keyFile"`
} }
type JSONConfig struct { type JSONConfig struct {
Insecure bool `json:"allowInsecure"`
Certs []*JSONCertConfig `json:"certificates"` Certs []*JSONCertConfig `json:"certificates"`
} }
jsonConfig := new(JSONConfig) jsonConfig := new(JSONConfig)
@ -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
} }