1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-04 16:37:12 -05:00
v2fly/features/routing/strategy.go
Jebbs fa0cf6db26
v5: Health Check & LeastLoad Strategy (rebased from 2c5a714903)
Some changes will be necessary to integrate it into V2Ray
2021-09-04 11:11:45 +01:00

23 lines
836 B
Go

package routing
import "time"
// BalancingStrategy is the interface for balancing strategies
type BalancingStrategy interface {
// Pick pick one outbound from candidates. Unlike the SelectAndPick(),
// it skips the select procedure (select all & pick one).
Pick(candidates []string) string
// SelectAndPick selects qualified nodes from candidates then pick one.
SelectAndPick(candidates []string) string
// GetInformation gets information of the strategy
GetInformation(tags []string) *StrategyInfo
}
// BalancingOverrider is the interface of those who can override
// the selecting of its balancers
type BalancingOverrider interface {
// OverrideSelecting overrides the selects of specified balancer, for 'validity'
// duration of time.
OverrideSelecting(balancer string, selects []string, validity time.Duration) error
}