mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-24 10:01:04 +01:00
added load balance support and verbose level
This commit is contained in:
22
src/go-proxy/http_lbpool.go
Executable file
22
src/go-proxy/http_lbpool.go
Executable file
@@ -0,0 +1,22 @@
|
||||
package main
|
||||
|
||||
import "sync/atomic"
|
||||
|
||||
type httpLoadBalancePool struct {
|
||||
pool []*HTTPRoute
|
||||
curentIndex atomic.Int32
|
||||
}
|
||||
|
||||
func NewHTTPLoadBalancePool() *httpLoadBalancePool {
|
||||
return &httpLoadBalancePool{
|
||||
pool: make([]*HTTPRoute, 0),
|
||||
}
|
||||
}
|
||||
|
||||
func (p *httpLoadBalancePool) Add(route *HTTPRoute) {
|
||||
p.pool = append(p.pool, route)
|
||||
}
|
||||
|
||||
func (p *httpLoadBalancePool) Iterator() []*HTTPRoute {
|
||||
return p.pool
|
||||
}
|
||||
Reference in New Issue
Block a user