mirror of https://github.com/XTLS/Xray-core
pull/5144/head
parent
83c5370eec
commit
8add78c02b
|
@ -64,6 +64,14 @@ type HTTPClientConfig struct {
|
||||||
func (v *HTTPClientConfig) Build() (proto.Message, error) {
|
func (v *HTTPClientConfig) Build() (proto.Message, error) {
|
||||||
config := new(http.ClientConfig)
|
config := new(http.ClientConfig)
|
||||||
if v.Address != nil {
|
if v.Address != nil {
|
||||||
|
if len(v.Username) == 0 {
|
||||||
|
v.Servers = []*HTTPRemoteConfig{
|
||||||
|
{
|
||||||
|
Address: v.Address,
|
||||||
|
Port: v.Port,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
} else {
|
||||||
v.Servers = []*HTTPRemoteConfig{
|
v.Servers = []*HTTPRemoteConfig{
|
||||||
{
|
{
|
||||||
Address: v.Address,
|
Address: v.Address,
|
||||||
|
@ -72,6 +80,7 @@ func (v *HTTPClientConfig) Build() (proto.Message, error) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
config.Server = make([]*protocol.ServerEndpoint, len(v.Servers))
|
config.Server = make([]*protocol.ServerEndpoint, len(v.Servers))
|
||||||
for idx, serverConfig := range v.Servers {
|
for idx, serverConfig := range v.Servers {
|
||||||
server := &protocol.ServerEndpoint{
|
server := &protocol.ServerEndpoint{
|
||||||
|
|
|
@ -82,6 +82,14 @@ type SocksClientConfig struct {
|
||||||
func (v *SocksClientConfig) Build() (proto.Message, error) {
|
func (v *SocksClientConfig) Build() (proto.Message, error) {
|
||||||
config := new(socks.ClientConfig)
|
config := new(socks.ClientConfig)
|
||||||
if v.Address != nil {
|
if v.Address != nil {
|
||||||
|
if len(v.Username) == 0 {
|
||||||
|
v.Servers = []*SocksRemoteConfig{
|
||||||
|
{
|
||||||
|
Address: v.Address,
|
||||||
|
Port: v.Port,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
} else {
|
||||||
v.Servers = []*SocksRemoteConfig{
|
v.Servers = []*SocksRemoteConfig{
|
||||||
{
|
{
|
||||||
Address: v.Address,
|
Address: v.Address,
|
||||||
|
@ -90,6 +98,7 @@ func (v *SocksClientConfig) Build() (proto.Message, error) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
config.Server = make([]*protocol.ServerEndpoint, len(v.Servers))
|
config.Server = make([]*protocol.ServerEndpoint, len(v.Servers))
|
||||||
for idx, serverConfig := range v.Servers {
|
for idx, serverConfig := range v.Servers {
|
||||||
server := &protocol.ServerEndpoint{
|
server := &protocol.ServerEndpoint{
|
||||||
|
|
Loading…
Reference in New Issue