2021-01-30 00:31:11 +00:00
|
|
|
package routing
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
|
|
|
|
// HealthChecker is the interface for health checkers
|
|
|
|
type HealthChecker interface {
|
|
|
|
// StartScheduler starts the check scheduler
|
|
|
|
StartScheduler(selector func() ([]string, error))
|
|
|
|
// StopScheduler stops the check scheduler
|
|
|
|
StopScheduler()
|
|
|
|
// Check start the health checking for given tags.
|
|
|
|
Check(tags []string) error
|
|
|
|
}
|
|
|
|
|
|
|
|
// OutboundInfo holds information of an outbound
|
|
|
|
type OutboundInfo struct {
|
|
|
|
Tag string // Tag of the outbound
|
|
|
|
Values []string // Information of the outbound, which can be different between strategies, like health ping RTT
|
|
|
|
}
|
|
|
|
|
|
|
|
// StrategyInfo holds strategy running information, like selected handlers and others
|
|
|
|
type StrategyInfo struct {
|
|
|
|
Settings []string // Strategy settings
|
|
|
|
ValueTitles []string // Value titles of OutboundInfo.Values
|
|
|
|
Selects []*OutboundInfo // Selects of the strategy
|
|
|
|
Others []*OutboundInfo // Other outbounds
|
|
|
|
}
|
|
|
|
|
improve commands (#648)
* stat show json refactor
> will show {} since scripts should expect it, its the json style of blank value
* combine statistics commands to one
* code optimize
* fix runtime flag
* remove json indent
* change overridden to override
* api bi -json
* convert stdin support
code optimize
* writeRow() code optimize
add stats tittle
revert back to restartlogger
* api log -restart
* follow log
* codeql
* move -json to shared flags
* flags optimize
* update flag descriptions
* change "-v" of "api bo" to duration
* change "-expire" of "tls cert" to days
* cmds short description optimize
* fix multiple log followers
* Format loader refactor
* "infra/conf/merge" refactor
* "LoadConfig" refactor
* add "infra/conf/mergers"
* contribute to it will benifit `v2ray run`,`v2ray test`,`v2ray convert`
* easily add new formats, by just adding a converter like json.FromTOML
* default format auto, to all cmds above
* auto detect input format
* mixed formats support
* better stdin behavior
* don't wait if no content
* don't use 'stdin:' placeholder
* `v2ray test` now behaves exactly the same with `v2ray run`, including stdin reading
* api ado, adi, rmo, rmi refactor
* support folders to files resolving, mixed formats
* remove remaining 'stdin:' placeholders
* fix tests
* os.Stdin.Stat() behaves different in platforms, removed
* code optimize
Co-authored-by: loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
2021-02-21 15:02:42 +00:00
|
|
|
// BalancingOverrideInfo holds balancing override information
|
2021-01-30 00:31:11 +00:00
|
|
|
type BalancingOverrideInfo struct {
|
|
|
|
Until time.Time
|
|
|
|
Selects []string
|
|
|
|
}
|
|
|
|
|
|
|
|
// BalancerInfo holds information of a balancer
|
|
|
|
type BalancerInfo struct {
|
|
|
|
Tag string // Tag of the balancer
|
|
|
|
Override *BalancingOverrideInfo
|
|
|
|
Strategy *StrategyInfo // Strategy and its running information
|
|
|
|
}
|
|
|
|
|
|
|
|
// RouterChecker represents a router that is able to perform checks for its balancers, and get statistics.
|
|
|
|
type RouterChecker interface {
|
|
|
|
// CheckHanlders performs a health check for specified outbound hanlders.
|
|
|
|
CheckHanlders(tags []string) error
|
|
|
|
// CheckBalancers performs health checks for specified balancers,
|
|
|
|
// if not specified, check them all.
|
|
|
|
CheckBalancers(tags []string) error
|
|
|
|
// GetBalancersInfo get health info of specific balancer, if balancer not specified, get all
|
|
|
|
GetBalancersInfo(tags []string) ([]*BalancerInfo, error)
|
|
|
|
}
|