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:
@@ -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 {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user