1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-30 07:46:41 -04:00
v2fly/proxy/http/config.go

45 lines
858 B
Go
Raw Normal View History

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