forked from v2ray/v2ray-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
44 lines (34 loc) · 858 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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.
type ClientConfig struct {
}