𐲓𐳛𐳪𐳂𐳐 𐲀𐳢𐳦𐳫𐳢 𐲥𐳔𐳛𐳪𐳌𐳑𐳖𐳇 2025-09-13 20:11:24 +08:00 committed by GitHub
parent 83c5370eec
commit 8add78c02b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 12 deletions

View File

@ -64,12 +64,21 @@ type HTTPClientConfig struct {
func (v *HTTPClientConfig) Build() (proto.Message, error) {
config := new(http.ClientConfig)
if v.Address != nil {
v.Servers = []*HTTPRemoteConfig{
{
Address: v.Address,
Port: v.Port,
Users: []json.RawMessage{{}},
},
if len(v.Username) == 0 {
v.Servers = []*HTTPRemoteConfig{
{
Address: v.Address,
Port: v.Port,
},
}
} else {
v.Servers = []*HTTPRemoteConfig{
{
Address: v.Address,
Port: v.Port,
Users: []json.RawMessage{{}},
},
}
}
}
config.Server = make([]*protocol.ServerEndpoint, len(v.Servers))

View File

@ -82,12 +82,21 @@ type SocksClientConfig struct {
func (v *SocksClientConfig) Build() (proto.Message, error) {
config := new(socks.ClientConfig)
if v.Address != nil {
v.Servers = []*SocksRemoteConfig{
{
Address: v.Address,
Port: v.Port,
Users: []json.RawMessage{{}},
},
if len(v.Username) == 0 {
v.Servers = []*SocksRemoteConfig{
{
Address: v.Address,
Port: v.Port,
},
}
} else {
v.Servers = []*SocksRemoteConfig{
{
Address: v.Address,
Port: v.Port,
Users: []json.RawMessage{{}},
},
}
}
}
config.Server = make([]*protocol.ServerEndpoint, len(v.Servers))