tls config

This commit is contained in:
v2ray committed 2016-07-10 15:27:58 +02:00
1 parent 1e3ebeef59
commit 754e8b6e78
7 files changed
+119 -83

No files matched your search

-35
View File
@@ -1,42 +1,7 @@
package http
import "crypto/tls"
// CertificateConfig is the config for TLS certificates used in HTTP proxy.
type CertificateConfig struct {
Domain string
Certificate tls.Certificate
}
// TlsConfig is the config for TLS connections.
type TLSConfig struct {
Enabled bool
Certs []*CertificateConfig
}
// GetConfig returns corresponding tls.Config.
func (this *TLSConfig) GetConfig() *tls.Config {
if !this.Enabled {
return nil
}
config := &tls.Config{
InsecureSkipVerify: false,
}
config.Certificates = make([]tls.Certificate, len(this.Certs))
for index, cert := range this.Certs {
config.Certificates[index] = cert.Certificate
}
config.BuildNameToCertificate()
return config
}
// Config for HTTP proxy server.
type Config struct {
TLSConfig *TLSConfig
}
// ClientConfig for HTTP proxy client.