From 3c431ee6e1b3ec87ca4fbae322dae2b85298b559 Mon Sep 17 00:00:00 2001 From: nadoo <287492+nadoo@users.noreply.github.com> Date: Fri, 10 Dec 2021 21:24:39 +0800 Subject: [PATCH] group: show the count of enabled proxies (#292) --- go.mod | 2 +- go.sum | 4 ++-- rule/group.go | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 44ef97cc..473ac945 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/nadoo/ipset v0.3.0 github.com/xtaci/kcp-go/v5 v5.6.1 golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b - golang.org/x/sys v0.0.0-20211209171907-798191bca915 + golang.org/x/sys v0.0.0-20211210111614-af8b64212486 ) require ( diff --git a/go.sum b/go.sum index 9e0e5bfc..00b9bcd7 100644 --- a/go.sum +++ b/go.sum @@ -157,8 +157,8 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210525143221-35b2ab0089ea/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211209171907-798191bca915 h1:P+8mCzuEpyszAT6T42q0sxU+eveBAF/cJ2Kp0x6/8+0= -golang.org/x/sys v0.0.0-20211209171907-798191bca915/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211210111614-af8b64212486 h1:5hpz5aRr+W1erYCL5JRhSUBJRph7l9XkNveoExlrKYk= +golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/rule/group.go b/rule/group.go index 439cf79b..ad1cb830 100644 --- a/rule/group.go +++ b/rule/group.go @@ -159,20 +159,22 @@ func (p *FwdrGroup) onStatusChanged(fwdr *Forwarder) { defer p.mu.Unlock() if fwdr.Enabled() { - log.F("[group] %s(%d) changed status from DISABLED to ENABLED ", fwdr.Addr(), fwdr.Priority()) if fwdr.Priority() == p.Priority() { p.avail = append(p.avail, fwdr) } else if fwdr.Priority() > p.Priority() { p.init() } + log.F("[group] %s(%d) changed status from DISABLED to ENABLED (%d of %d currently enabled)", + fwdr.Addr(), fwdr.Priority(), len(p.avail), len(p.fwdrs)) } else { - log.F("[group] %s(%d) changed status from ENABLED to DISABLED", fwdr.Addr(), fwdr.Priority()) for i, f := range p.avail { if f == fwdr { p.avail[i], p.avail = p.avail[len(p.avail)-1], p.avail[:len(p.avail)-1] break } } + log.F("[group] %s(%d) changed status from ENABLED to DISABLED (%d of %d currently enabled)", + fwdr.Addr(), fwdr.Priority(), len(p.avail), len(p.fwdrs)) } if len(p.avail) == 0 {