| 1234567891011121314151617 |
- package router
- import (
- "github.com/v2fly/v2ray-core/v4/common/dice"
- )
- // RandomStrategy represents a random balancing strategy
- type RandomStrategy struct{}
- func (s *RandomStrategy) PickOutbound(candidates []string) string {
- count := len(candidates)
- if count == 0 {
- // goes to fallbackTag
- return ""
- }
- return candidates[dice.Roll(count)]
- }
|