This commit is contained in:
aozhiwei 2024-08-30 16:37:31 +08:00
parent a8c104912a
commit 278bb81dd8

View File

@ -9,8 +9,15 @@ import (
"time"
)
type downStreamHost struct {
host string
port int32
url string
}
type sApiForward struct {
userCache []*SApiForwardLockCache
downStreams []*downStreamHost
insessTimes int32
total int32
getTimes int32
@ -35,6 +42,7 @@ type SApiForwardLock struct {
}
func (this *sApiForward) init() {
q5.NewSlice(&this.downStreams, 0, 20)
q5.NewSlice(&this.userCache, 1024, 1024)
for i := 0; i < len(this.userCache); i++ {
p := new(SApiForwardLockCache)
@ -176,6 +184,11 @@ func (this *sApiForward) outputMonitorLog() {
}
func (this *sApiForward) GetDownStreamHost() (string, string) {
newUrl := mt.Table.Config.GetById(0).GetRedirectUrl()
return newUrl, ""
downStreams := this.downStreams
if len(downStreams) <= 0 {
newUrl := mt.Table.Config.GetById(0).GetRedirectUrl()
return newUrl, ""
}
downStream := downStreams[0]
return downStream.url, downStream.host
}