1
This commit is contained in:
parent
254c5fca12
commit
a44aaa1cba
@ -13,9 +13,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type downStreamHost struct {
|
type downStreamHost struct {
|
||||||
host string
|
Host string `json:"host"`
|
||||||
port int32
|
Port int32 `json:"port"`
|
||||||
url string
|
Url string `json:"url"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type sApiForward struct {
|
type sApiForward struct {
|
||||||
@ -205,9 +205,9 @@ func (this *sApiForward) LoadDownStreams() error {
|
|||||||
enable := q5.ToInt32(ds.GetByName("enable"))
|
enable := q5.ToInt32(ds.GetByName("enable"))
|
||||||
if enable != 0 {
|
if enable != 0 {
|
||||||
downSteam := *q5.NewSliceElement(&downStreams)
|
downSteam := *q5.NewSliceElement(&downStreams)
|
||||||
downSteam.host = host
|
downSteam.Host = host
|
||||||
downSteam.port = port
|
downSteam.Port = port
|
||||||
downSteam.url = fmt.Sprintf("http://%s:%d", downSteam.host, downSteam.port)
|
downSteam.Url = fmt.Sprintf("http://%s:%d", downSteam.Host, downSteam.Port)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(downStreams) > 0 {
|
if len(downStreams) > 0 {
|
||||||
@ -226,5 +226,5 @@ func (this *sApiForward) GetDownStreamHost() (string, string) {
|
|||||||
return mt.Table.Config.GetRedirectUrl(), ""
|
return mt.Table.Config.GetRedirectUrl(), ""
|
||||||
}
|
}
|
||||||
downStream := downStreams[rand.Intn(len(downStreams))]
|
downStream := downStreams[rand.Intn(len(downStreams))]
|
||||||
return downStream.url, mt.Table.Config.GetRedirectHost()
|
return downStream.Url, mt.Table.Config.GetRedirectHost()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user