1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-12-27 20:45:28 -05:00

cleanup http proxy package

This commit is contained in:
v2ray
2016-05-29 16:46:31 +02:00
parent b47c1ca609
commit 9b07ffd68f
5 changed files with 31 additions and 75 deletions

View File

@@ -1,22 +1,21 @@
package http
import (
"crypto/tls"
v2net "github.com/v2ray/v2ray-core/common/net"
)
import "crypto/tls"
// CertificateConfig is the config for TLS certificates used in HTTP proxy.
type CertificateConfig struct {
Domain string
Certificate tls.Certificate
}
type TlsConfig struct {
// TlsConfig is the config for TLS connections.
type TLSConfig struct {
Enabled bool
Certs []*CertificateConfig
}
func (this *TlsConfig) GetConfig() *tls.Config {
// GetConfig returns corresponding tls.Config.
func (this *TLSConfig) GetConfig() *tls.Config {
if !this.Enabled {
return nil
}
@@ -35,19 +34,11 @@ func (this *TlsConfig) GetConfig() *tls.Config {
return config
}
// Config for HTTP proxy server.
type Config struct {
OwnHosts []v2net.Address
TlsConfig *TlsConfig
}
func (this *Config) IsOwnHost(host v2net.Address) bool {
for _, ownHost := range this.OwnHosts {
if ownHost.Equals(host) {
return true
}
}
return false
TLSConfig *TLSConfig
}
// ClientConfig for HTTP proxy client.
type ClientConfig struct {
}