mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 12:42:34 +02:00
22 lines
407 B
Go
Executable file
22 lines
407 B
Go
Executable file
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
|
|
}
|