This commit is contained in:
aozhiwei 2024-08-30 17:39:35 +08:00
parent 254c5fca12
commit a44aaa1cba

View File

@ -13,9 +13,9 @@ import (
)
type downStreamHost struct {
host string
port int32
url string
Host string `json:"host"`
Port int32 `json:"port"`
Url string `json:"url"`
}
type sApiForward struct {
@ -205,9 +205,9 @@ func (this *sApiForward) LoadDownStreams() error {
enable := q5.ToInt32(ds.GetByName("enable"))
if enable != 0 {
downSteam := *q5.NewSliceElement(&downStreams)
downSteam.host = host
downSteam.port = port
downSteam.url = fmt.Sprintf("http://%s:%d", downSteam.host, downSteam.port)
downSteam.Host = host
downSteam.Port = port
downSteam.Url = fmt.Sprintf("http://%s:%d", downSteam.Host, downSteam.Port)
}
}
if len(downStreams) > 0 {
@ -226,5 +226,5 @@ func (this *sApiForward) GetDownStreamHost() (string, string) {
return mt.Table.Config.GetRedirectUrl(), ""
}
downStream := downStreams[rand.Intn(len(downStreams))]
return downStream.url, mt.Table.Config.GetRedirectHost()
return downStream.Url, mt.Table.Config.GetRedirectHost()
}