1
This commit is contained in:
parent
a8c104912a
commit
278bb81dd8
@ -9,8 +9,15 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type downStreamHost struct {
|
||||||
|
host string
|
||||||
|
port int32
|
||||||
|
url string
|
||||||
|
}
|
||||||
|
|
||||||
type sApiForward struct {
|
type sApiForward struct {
|
||||||
userCache []*SApiForwardLockCache
|
userCache []*SApiForwardLockCache
|
||||||
|
downStreams []*downStreamHost
|
||||||
insessTimes int32
|
insessTimes int32
|
||||||
total int32
|
total int32
|
||||||
getTimes int32
|
getTimes int32
|
||||||
@ -35,6 +42,7 @@ type SApiForwardLock struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *sApiForward) init() {
|
func (this *sApiForward) init() {
|
||||||
|
q5.NewSlice(&this.downStreams, 0, 20)
|
||||||
q5.NewSlice(&this.userCache, 1024, 1024)
|
q5.NewSlice(&this.userCache, 1024, 1024)
|
||||||
for i := 0; i < len(this.userCache); i++ {
|
for i := 0; i < len(this.userCache); i++ {
|
||||||
p := new(SApiForwardLockCache)
|
p := new(SApiForwardLockCache)
|
||||||
@ -176,6 +184,11 @@ func (this *sApiForward) outputMonitorLog() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *sApiForward) GetDownStreamHost() (string, string) {
|
func (this *sApiForward) GetDownStreamHost() (string, string) {
|
||||||
newUrl := mt.Table.Config.GetById(0).GetRedirectUrl()
|
downStreams := this.downStreams
|
||||||
return newUrl, ""
|
if len(downStreams) <= 0 {
|
||||||
|
newUrl := mt.Table.Config.GetById(0).GetRedirectUrl()
|
||||||
|
return newUrl, ""
|
||||||
|
}
|
||||||
|
downStream := downStreams[0]
|
||||||
|
return downStream.url, downStream.host
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user