mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-25 22:56:04 +03:00
improve balancer_info.go
fix balancer args
This commit is contained in:
parent
2cafb3ef89
commit
bd38578978
@ -43,12 +43,16 @@ Example:
|
|||||||
func executeBalancerInfo(cmd *base.Command, args []string) {
|
func executeBalancerInfo(cmd *base.Command, args []string) {
|
||||||
setSharedFlags(cmd)
|
setSharedFlags(cmd)
|
||||||
cmd.Flag.Parse(args)
|
cmd.Flag.Parse(args)
|
||||||
|
unnamedArgs := cmd.Flag.Args()
|
||||||
|
if len(unnamedArgs) == 0 {
|
||||||
|
fmt.Println("set balancer tag")
|
||||||
|
unnamedArgs = []string{""}
|
||||||
|
}
|
||||||
|
|
||||||
conn, ctx, close := dialAPIServer()
|
conn, ctx, close := dialAPIServer()
|
||||||
defer close()
|
defer close()
|
||||||
|
|
||||||
client := routerService.NewRoutingServiceClient(conn)
|
client := routerService.NewRoutingServiceClient(conn)
|
||||||
r := &routerService.GetBalancerInfoRequest{Tag: args[0]}
|
r := &routerService.GetBalancerInfoRequest{Tag: unnamedArgs[0]}
|
||||||
resp, err := client.GetBalancerInfo(ctx, r)
|
resp, err := client.GetBalancerInfo(ctx, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
base.Fatalf("failed to get health information: %s", err)
|
base.Fatalf("failed to get health information: %s", err)
|
||||||
@ -75,10 +79,11 @@ func showBalancerInfo(b *routerService.BalancerMsg) {
|
|||||||
}
|
}
|
||||||
// Selects
|
// Selects
|
||||||
sb.WriteString(" - Selects:\n")
|
sb.WriteString(" - Selects:\n")
|
||||||
|
if b.PrincipleTarget != nil {
|
||||||
for i, o := range b.PrincipleTarget.Tag {
|
for i, o := range b.PrincipleTarget.Tag {
|
||||||
writeRow(sb, tableIndent, i+1, []string{o}, nil)
|
writeRow(sb, tableIndent, i+1, []string{o}, nil)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
os.Stdout.WriteString(sb.String())
|
os.Stdout.WriteString(sb.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user