소스 검색

allow insecure connections

v2ray 9 년 전
부모
커밋
5e7d413404
2개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 2
      transport/internet/connection.go
  2. 3 1
      transport/internet/connection_json.go

+ 3 - 2
transport/internet/connection.go

@@ -28,12 +28,13 @@ const (
 )
 
 type TLSSettings struct {
-	Certs []tls.Certificate
+	AllowInsecure bool
+	Certs         []tls.Certificate
 }
 
 func (this *TLSSettings) GetTLSConfig() *tls.Config {
 	config := &tls.Config{
-		InsecureSkipVerify: true,
+		InsecureSkipVerify: this.AllowInsecure,
 	}
 
 	config.Certificates = this.Certs

+ 3 - 1
transport/internet/connection_json.go

@@ -17,7 +17,8 @@ func (this *TLSSettings) UnmarshalJSON(data []byte) error {
 		KeyFile  string `json:"keyFile"`
 	}
 	type JSONConfig struct {
-		Certs []*JSONCertConfig `json:"certificates"`
+		Insecure bool              `json:"allowInsecure"`
+		Certs    []*JSONCertConfig `json:"certificates"`
 	}
 	jsonConfig := new(JSONConfig)
 	if err := json.Unmarshal(data, jsonConfig); err != nil {
@@ -31,6 +32,7 @@ func (this *TLSSettings) UnmarshalJSON(data []byte) error {
 		}
 		this.Certs[idx] = cert
 	}
+	this.AllowInsecure = jsonConfig.Insecure
 	return nil
 }