1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-02-20 23:47:21 -05:00
v2fly/proxy/http/config.go

45 lines
858 B
Go
Raw Normal View History

2015-12-14 16:26:29 +00:00
package http
2016-05-29 16:46:31 +02:00
import "crypto/tls"
2016-01-26 10:28:09 +00:00
2016-05-29 16:46:31 +02:00
// CertificateConfig is the config for TLS certificates used in HTTP proxy.
2016-05-07 10:06:12 +02:00
type CertificateConfig struct {
Domain string
Certificate tls.Certificate
}
2016-05-29 16:46:31 +02:00
// TlsConfig is the config for TLS connections.
type TLSConfig struct {
2016-05-07 10:06:12 +02:00
Enabled bool
Certs []*CertificateConfig
2016-04-25 15:30:28 +02:00
}
2016-05-29 16:46:31 +02:00
// GetConfig returns corresponding tls.Config.
func (this *TLSConfig) GetConfig() *tls.Config {
2016-05-07 10:36:36 +02:00
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
}
2016-05-29 16:46:31 +02:00
// Config for HTTP proxy server.
type Config struct {
2016-05-29 16:46:31 +02:00
TLSConfig *TLSConfig
2015-12-14 16:26:29 +00:00
}
2016-05-28 13:44:11 +02:00
2016-05-29 16:46:31 +02:00
// ClientConfig for HTTP proxy client.
2016-05-28 13:44:11 +02:00
type ClientConfig struct {
}