update github actions (#3538)

This commit is contained in:
fatedier 2023-07-21 10:30:46 +08:00 committed by GitHub
parent efcc028a3d
commit 46ff40543a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 72 additions and 108 deletions

View File

@ -61,7 +61,7 @@ jobs:
echo "TAG_FRPS_GPR=ghcr.io/fatedier/frps:${{ env.TAG_NAME }}" >> $GITHUB_ENV echo "TAG_FRPS_GPR=ghcr.io/fatedier/frps:${{ env.TAG_NAME }}" >> $GITHUB_ENV
- name: Build and push frpc - name: Build and push frpc
uses: docker/build-push-action@v3 uses: docker/build-push-action@v4
with: with:
context: . context: .
file: ./dockerfiles/Dockerfile-for-frpc file: ./dockerfiles/Dockerfile-for-frpc
@ -72,7 +72,7 @@ jobs:
${{ env.TAG_FRPC_GPR }} ${{ env.TAG_FRPC_GPR }}
- name: Build and push frps - name: Build and push frps
uses: docker/build-push-action@v3 uses: docker/build-push-action@v4
with: with:
context: . context: .
file: ./dockerfiles/Dockerfile-for-frps file: ./dockerfiles/Dockerfile-for-frps

View File

@ -14,7 +14,7 @@ jobs:
name: lint name: lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/setup-go@v3 - uses: actions/setup-go@v4
with: with:
go-version: '1.20' go-version: '1.20'
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -22,7 +22,7 @@ jobs:
uses: golangci/golangci-lint-action@v3 uses: golangci/golangci-lint-action@v3
with: with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.51 version: v1.53
# Optional: golangci-lint command line arguments. # Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0 # args: --issues-exit-code=0

View File

@ -13,7 +13,7 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v3 uses: actions/setup-go@v4
with: with:
go-version: '1.20' go-version: '1.20'
@ -22,9 +22,9 @@ jobs:
./package.sh ./package.sh
- name: Run GoReleaser - name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3 uses: goreleaser/goreleaser-action@v4
with: with:
version: latest version: latest
args: release --rm-dist --release-notes=./Release.md args: release --clean --release-notes=./Release.md
env: env:
GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }} GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }}

View File

@ -18,7 +18,7 @@ jobs:
pull-requests: write # for actions/stale to close stale PRs pull-requests: write # for actions/stale to close stale PRs
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/stale@v6 - uses: actions/stale@v8
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.' stale-issue-message: 'Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.'

View File

@ -39,12 +39,12 @@ type GeneralResponse struct {
} }
// /healthz // /healthz
func (svr *Service) healthz(w http.ResponseWriter, r *http.Request) { func (svr *Service) healthz(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(200) w.WriteHeader(200)
} }
// GET /api/reload // GET /api/reload
func (svr *Service) apiReload(w http.ResponseWriter, r *http.Request) { func (svr *Service) apiReload(w http.ResponseWriter, _ *http.Request) {
res := GeneralResponse{Code: 200} res := GeneralResponse{Code: 200}
log.Info("api request [/api/reload]") log.Info("api request [/api/reload]")
@ -74,7 +74,7 @@ func (svr *Service) apiReload(w http.ResponseWriter, r *http.Request) {
} }
// POST /api/stop // POST /api/stop
func (svr *Service) apiStop(w http.ResponseWriter, r *http.Request) { func (svr *Service) apiStop(w http.ResponseWriter, _ *http.Request) {
res := GeneralResponse{Code: 200} res := GeneralResponse{Code: 200}
log.Info("api request [/api/stop]") log.Info("api request [/api/stop]")
@ -124,7 +124,7 @@ func NewProxyStatusResp(status *proxy.WorkingStatus, serverAddr string) ProxySta
} }
// GET /api/status // GET /api/status
func (svr *Service) apiStatus(w http.ResponseWriter, r *http.Request) { func (svr *Service) apiStatus(w http.ResponseWriter, _ *http.Request) {
var ( var (
buf []byte buf []byte
res StatusResp = make(map[string][]ProxyStatusResp) res StatusResp = make(map[string][]ProxyStatusResp)
@ -153,7 +153,7 @@ func (svr *Service) apiStatus(w http.ResponseWriter, r *http.Request) {
} }
// GET /api/config // GET /api/config
func (svr *Service) apiGetConfig(w http.ResponseWriter, r *http.Request) { func (svr *Service) apiGetConfig(w http.ResponseWriter, _ *http.Request) {
res := GeneralResponse{Code: 200} res := GeneralResponse{Code: 200}
log.Info("Http get request [/api/config]") log.Info("Http get request [/api/config]")

View File

@ -124,7 +124,7 @@ func (ctl *Control) Run() {
go ctl.vm.Run() go ctl.vm.Run()
} }
func (ctl *Control) HandleReqWorkConn(inMsg *msg.ReqWorkConn) { func (ctl *Control) HandleReqWorkConn(_ *msg.ReqWorkConn) {
xl := ctl.xl xl := ctl.xl
workConn, err := ctl.connectServer() workConn, err := ctl.connectServer()
if err != nil { if err != nil {

View File

@ -40,7 +40,7 @@ type GeneralTCPProxy struct {
*BaseProxy *BaseProxy
} }
func NewGeneralTCPProxy(baseProxy *BaseProxy, cfg config.ProxyConf) Proxy { func NewGeneralTCPProxy(baseProxy *BaseProxy, _ config.ProxyConf) Proxy {
return &GeneralTCPProxy{ return &GeneralTCPProxy{
BaseProxy: baseProxy, BaseProxy: baseProxy,
} }

View File

@ -77,7 +77,7 @@ func (pxy *SUDPProxy) Close() {
} }
} }
func (pxy *SUDPProxy) InWorkConn(conn net.Conn, m *msg.StartWorkConn) { func (pxy *SUDPProxy) InWorkConn(conn net.Conn, _ *msg.StartWorkConn) {
xl := pxy.xl xl := pxy.xl
xl.Info("incoming a new work connection for sudp proxy, %s", conn.RemoteAddr().String()) xl.Info("incoming a new work connection for sudp proxy, %s", conn.RemoteAddr().String())

View File

@ -86,7 +86,7 @@ func (pxy *UDPProxy) Close() {
} }
} }
func (pxy *UDPProxy) InWorkConn(conn net.Conn, m *msg.StartWorkConn) { func (pxy *UDPProxy) InWorkConn(conn net.Conn, _ *msg.StartWorkConn) {
xl := pxy.xl xl := pxy.xl
xl.Info("incoming a new work connection for udp proxy, %s", conn.RemoteAddr().String()) xl.Info("incoming a new work connection for udp proxy, %s", conn.RemoteAddr().String())
// close resources releated with old workConn // close resources releated with old workConn

View File

@ -370,7 +370,7 @@ func (ks *KCPTunnelSession) Init(listenConn *net.UDPConn, raddr *net.UDPAddr) er
return nil return nil
} }
func (ks *KCPTunnelSession) OpenConn(ctx context.Context) (net.Conn, error) { func (ks *KCPTunnelSession) OpenConn(_ context.Context) (net.Conn, error) {
ks.mu.RLock() ks.mu.RLock()
defer ks.mu.RUnlock() defer ks.mu.RUnlock()
session := ks.session session := ks.session

View File

@ -527,11 +527,8 @@ func (cfg *TCPProxyConf) ValidateForClient() (err error) {
return return
} }
func (cfg *TCPProxyConf) ValidateForServer(serverCfg ServerCommonConf) error { func (cfg *TCPProxyConf) ValidateForServer(_ ServerCommonConf) error {
if err := cfg.BaseProxyConf.validateForServer(); err != nil { return cfg.BaseProxyConf.validateForServer()
return err
}
return nil
} }
// TCPMux // TCPMux
@ -644,11 +641,8 @@ func (cfg *UDPProxyConf) ValidateForClient() (err error) {
return return
} }
func (cfg *UDPProxyConf) ValidateForServer(serverCfg ServerCommonConf) error { func (cfg *UDPProxyConf) ValidateForServer(_ ServerCommonConf) error {
if err := cfg.BaseProxyConf.validateForServer(); err != nil { return cfg.BaseProxyConf.validateForServer()
return err
}
return nil
} }
// HTTP // HTTP
@ -821,11 +815,8 @@ func (cfg *SUDPProxyConf) ValidateForClient() (err error) {
return nil return nil
} }
func (cfg *SUDPProxyConf) ValidateForServer(serverCfg ServerCommonConf) error { func (cfg *SUDPProxyConf) ValidateForServer(_ ServerCommonConf) error {
if err := cfg.BaseProxyConf.validateForServer(); err != nil { return cfg.BaseProxyConf.validateForServer()
return err
}
return nil
} }
// STCP // STCP
@ -875,11 +866,8 @@ func (cfg *STCPProxyConf) ValidateForClient() (err error) {
return return
} }
func (cfg *STCPProxyConf) ValidateForServer(serverCfg ServerCommonConf) error { func (cfg *STCPProxyConf) ValidateForServer(_ ServerCommonConf) error {
if err := cfg.BaseProxyConf.validateForServer(); err != nil { return cfg.BaseProxyConf.validateForServer()
return err
}
return nil
} }
// XTCP // XTCP
@ -928,9 +916,6 @@ func (cfg *XTCPProxyConf) ValidateForClient() (err error) {
return return
} }
func (cfg *XTCPProxyConf) ValidateForServer(serverCfg ServerCommonConf) error { func (cfg *XTCPProxyConf) ValidateForServer(_ ServerCommonConf) error {
if err := cfg.BaseProxyConf.validateForServer(); err != nil { return cfg.BaseProxyConf.validateForServer()
return err
}
return nil
} }

View File

@ -35,7 +35,7 @@ var (
testProxyPrefix = "test." testProxyPrefix = "test."
) )
func Test_Proxy_Interface(t *testing.T) { func Test_Proxy_Interface(_ *testing.T) {
for name := range proxyConfTypeMap { for name := range proxyConfTypeMap {
NewConfByType(name) NewConfByType(name)
} }

View File

@ -25,7 +25,7 @@ import (
const testVisitorPrefix = "test." const testVisitorPrefix = "test."
func Test_Visitor_Interface(t *testing.T) { func Test_Visitor_Interface(_ *testing.T) {
for name := range visitorConfTypeMap { for name := range visitorConfTypeMap {
DefaultVisitorConf(name) DefaultVisitorConf(name)
} }

View File

@ -129,7 +129,7 @@ func (m *serverMetrics) CloseProxy(name string, proxyType string) {
} }
} }
func (m *serverMetrics) OpenConnection(name string, proxyType string) { func (m *serverMetrics) OpenConnection(name string, _ string) {
m.info.CurConns.Inc(1) m.info.CurConns.Inc(1)
m.mu.Lock() m.mu.Lock()
@ -141,7 +141,7 @@ func (m *serverMetrics) OpenConnection(name string, proxyType string) {
} }
} }
func (m *serverMetrics) CloseConnection(name string, proxyType string) { func (m *serverMetrics) CloseConnection(name string, _ string) {
m.info.CurConns.Dec(1) m.info.CurConns.Dec(1)
m.mu.Lock() m.mu.Lock()
@ -153,7 +153,7 @@ func (m *serverMetrics) CloseConnection(name string, proxyType string) {
} }
} }
func (m *serverMetrics) AddTrafficIn(name string, proxyType string, trafficBytes int64) { func (m *serverMetrics) AddTrafficIn(name string, _ string, trafficBytes int64) {
m.info.TotalTrafficIn.Inc(trafficBytes) m.info.TotalTrafficIn.Inc(trafficBytes)
m.mu.Lock() m.mu.Lock()
@ -166,7 +166,7 @@ func (m *serverMetrics) AddTrafficIn(name string, proxyType string, trafficBytes
} }
} }
func (m *serverMetrics) AddTrafficOut(name string, proxyType string, trafficBytes int64) { func (m *serverMetrics) AddTrafficOut(name string, _ string, trafficBytes int64) {
m.info.TotalTrafficOut.Inc(trafficBytes) m.info.TotalTrafficOut.Inc(trafficBytes)
m.mu.Lock() m.mu.Lock()

View File

@ -29,11 +29,11 @@ func (m *serverMetrics) CloseClient() {
m.clientCount.Dec() m.clientCount.Dec()
} }
func (m *serverMetrics) NewProxy(name string, proxyType string) { func (m *serverMetrics) NewProxy(_ string, proxyType string) {
m.proxyCount.WithLabelValues(proxyType).Inc() m.proxyCount.WithLabelValues(proxyType).Inc()
} }
func (m *serverMetrics) CloseProxy(name string, proxyType string) { func (m *serverMetrics) CloseProxy(_ string, proxyType string) {
m.proxyCount.WithLabelValues(proxyType).Dec() m.proxyCount.WithLabelValues(proxyType).Dec()
} }

View File

@ -45,10 +45,7 @@ func DecodeMessageInto(data, key []byte, m msg.Message) error {
return err return err
} }
if err := msg.ReadMsgInto(bytes.NewReader(buf), m); err != nil { return msg.ReadMsgInto(bytes.NewReader(buf), m)
return err
}
return nil
} }
type ChangedAddress struct { type ChangedAddress struct {

View File

@ -97,7 +97,7 @@ func NewHTTP2HTTPSPlugin(params map[string]string) (Plugin, error) {
return p, nil return p, nil
} }
func (p *HTTP2HTTPSPlugin) Handle(conn io.ReadWriteCloser, realConn net.Conn, extraBufToLocal []byte) { func (p *HTTP2HTTPSPlugin) Handle(conn io.ReadWriteCloser, realConn net.Conn, _ []byte) {
wrapConn := utilnet.WrapReadWriteCloserToConn(conn, realConn) wrapConn := utilnet.WrapReadWriteCloserToConn(conn, realConn)
_ = p.l.PutConn(wrapConn) _ = p.l.PutConn(wrapConn)
} }
@ -107,8 +107,5 @@ func (p *HTTP2HTTPSPlugin) Name() string {
} }
func (p *HTTP2HTTPSPlugin) Close() error { func (p *HTTP2HTTPSPlugin) Close() error {
if err := p.s.Close(); err != nil { return p.s.Close()
return err
}
return nil
} }

View File

@ -68,7 +68,7 @@ func (hp *HTTPProxy) Name() string {
return PluginHTTPProxy return PluginHTTPProxy
} }
func (hp *HTTPProxy) Handle(conn io.ReadWriteCloser, realConn net.Conn, extraBufToLocal []byte) { func (hp *HTTPProxy) Handle(conn io.ReadWriteCloser, realConn net.Conn, _ []byte) {
wrapConn := utilnet.WrapReadWriteCloserToConn(conn, realConn) wrapConn := utilnet.WrapReadWriteCloserToConn(conn, realConn)
sc, rd := libnet.NewSharedConn(wrapConn) sc, rd := libnet.NewSharedConn(wrapConn)

View File

@ -122,7 +122,7 @@ func (p *HTTPS2HTTPPlugin) genTLSConfig() (*tls.Config, error) {
return config, nil return config, nil
} }
func (p *HTTPS2HTTPPlugin) Handle(conn io.ReadWriteCloser, realConn net.Conn, extraBufToLocal []byte) { func (p *HTTPS2HTTPPlugin) Handle(conn io.ReadWriteCloser, realConn net.Conn, _ []byte) {
wrapConn := utilnet.WrapReadWriteCloserToConn(conn, realConn) wrapConn := utilnet.WrapReadWriteCloserToConn(conn, realConn)
_ = p.l.PutConn(wrapConn) _ = p.l.PutConn(wrapConn)
} }
@ -132,8 +132,5 @@ func (p *HTTPS2HTTPPlugin) Name() string {
} }
func (p *HTTPS2HTTPPlugin) Close() error { func (p *HTTPS2HTTPPlugin) Close() error {
if err := p.s.Close(); err != nil { return p.s.Close()
return err
}
return nil
} }

View File

@ -127,7 +127,7 @@ func (p *HTTPS2HTTPSPlugin) genTLSConfig() (*tls.Config, error) {
return config, nil return config, nil
} }
func (p *HTTPS2HTTPSPlugin) Handle(conn io.ReadWriteCloser, realConn net.Conn, extraBufToLocal []byte) { func (p *HTTPS2HTTPSPlugin) Handle(conn io.ReadWriteCloser, realConn net.Conn, _ []byte) {
wrapConn := utilnet.WrapReadWriteCloserToConn(conn, realConn) wrapConn := utilnet.WrapReadWriteCloserToConn(conn, realConn)
_ = p.l.PutConn(wrapConn) _ = p.l.PutConn(wrapConn)
} }
@ -137,8 +137,5 @@ func (p *HTTPS2HTTPSPlugin) Name() string {
} }
func (p *HTTPS2HTTPSPlugin) Close() error { func (p *HTTPS2HTTPSPlugin) Close() error {
if err := p.s.Close(); err != nil { return p.s.Close()
return err
}
return nil
} }

View File

@ -50,7 +50,7 @@ func NewSocks5Plugin(params map[string]string) (p Plugin, err error) {
return return
} }
func (sp *Socks5Plugin) Handle(conn io.ReadWriteCloser, realConn net.Conn, extraBufToLocal []byte) { func (sp *Socks5Plugin) Handle(conn io.ReadWriteCloser, realConn net.Conn, _ []byte) {
defer conn.Close() defer conn.Close()
wrapConn := utilnet.WrapReadWriteCloserToConn(conn, realConn) wrapConn := utilnet.WrapReadWriteCloserToConn(conn, realConn)
_ = sp.Server.ServeConn(wrapConn) _ = sp.Server.ServeConn(wrapConn)

View File

@ -76,7 +76,7 @@ func NewStaticFilePlugin(params map[string]string) (Plugin, error) {
return sp, nil return sp, nil
} }
func (sp *StaticFilePlugin) Handle(conn io.ReadWriteCloser, realConn net.Conn, extraBufToLocal []byte) { func (sp *StaticFilePlugin) Handle(conn io.ReadWriteCloser, realConn net.Conn, _ []byte) {
wrapConn := utilnet.WrapReadWriteCloserToConn(conn, realConn) wrapConn := utilnet.WrapReadWriteCloserToConn(conn, realConn)
_ = sp.l.PutConn(wrapConn) _ = sp.l.PutConn(wrapConn)
} }

View File

@ -51,7 +51,7 @@ func NewUnixDomainSocketPlugin(params map[string]string) (p Plugin, err error) {
return return
} }
func (uds *UnixDomainSocketPlugin) Handle(conn io.ReadWriteCloser, realConn net.Conn, extraBufToLocal []byte) { func (uds *UnixDomainSocketPlugin) Handle(conn io.ReadWriteCloser, _ net.Conn, extraBufToLocal []byte) {
localConn, err := net.DialUnix("unix", nil, uds.UnixAddr) localConn, err := net.DialUnix("unix", nil, uds.UnixAddr)
if err != nil { if err != nil {
return return

View File

@ -120,8 +120,5 @@ func (p *httpPlugin) do(ctx context.Context, r *Request, res *Response) error {
if err != nil { if err != nil {
return err return err
} }
if err = json.Unmarshal(buf, res); err != nil { return json.Unmarshal(buf, res)
return err
}
return nil
} }

View File

@ -103,9 +103,7 @@ func NewServerTLSConfig(certPath, keyPath, caPath string) (*tls.Config, error) {
func NewClientTLSConfig(certPath, keyPath, caPath, serverName string) (*tls.Config, error) { func NewClientTLSConfig(certPath, keyPath, caPath, serverName string) (*tls.Config, error) {
base := &tls.Config{} base := &tls.Config{}
if certPath == "" || keyPath == "" { if certPath != "" && keyPath != "" {
// client will not generate tls conf by itself
} else {
cert, err := newCustomTLSKeyPair(certPath, keyPath) cert, err := newCustomTLSKeyPair(certPath, keyPath)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -140,15 +140,15 @@ func (c *FakeUDPConn) RemoteAddr() net.Addr {
return c.remoteAddr return c.remoteAddr
} }
func (c *FakeUDPConn) SetDeadline(t time.Time) error { func (c *FakeUDPConn) SetDeadline(_ time.Time) error {
return nil return nil
} }
func (c *FakeUDPConn) SetReadDeadline(t time.Time) error { func (c *FakeUDPConn) SetReadDeadline(_ time.Time) error {
return nil return nil
} }
func (c *FakeUDPConn) SetWriteDeadline(t time.Time) error { func (c *FakeUDPConn) SetWriteDeadline(_ time.Time) error {
return nil return nil
} }
@ -263,4 +263,4 @@ func (l *UDPListener) Addr() net.Addr {
type ConnectedUDPConn struct{ *net.UDPConn } type ConnectedUDPConn struct{ *net.UDPConn }
// WriteTo redirects all writes to the Write syscall, which is 4 times faster. // WriteTo redirects all writes to the Write syscall, which is 4 times faster.
func (c *ConnectedUDPConn) WriteTo(b []byte, addr net.Addr) (int, error) { return c.Write(b) } func (c *ConnectedUDPConn) WriteTo(b []byte, _ net.Addr) (int, error) { return c.Write(b) }

View File

@ -66,7 +66,7 @@ func (muxer *HTTPConnectTCPMuxer) readHTTPConnectRequest(rd io.Reader) (host, ht
return return
} }
func (muxer *HTTPConnectTCPMuxer) sendConnectResponse(c net.Conn, reqInfo map[string]string) error { func (muxer *HTTPConnectTCPMuxer) sendConnectResponse(c net.Conn, _ map[string]string) error {
if muxer.passthrough { if muxer.passthrough {
return nil return nil
} }

View File

@ -74,10 +74,10 @@ type readOnlyConn struct {
} }
func (conn readOnlyConn) Read(p []byte) (int, error) { return conn.reader.Read(p) } func (conn readOnlyConn) Read(p []byte) (int, error) { return conn.reader.Read(p) }
func (conn readOnlyConn) Write(p []byte) (int, error) { return 0, io.ErrClosedPipe } func (conn readOnlyConn) Write(_ []byte) (int, error) { return 0, io.ErrClosedPipe }
func (conn readOnlyConn) Close() error { return nil } func (conn readOnlyConn) Close() error { return nil }
func (conn readOnlyConn) LocalAddr() net.Addr { return nil } func (conn readOnlyConn) LocalAddr() net.Addr { return nil }
func (conn readOnlyConn) RemoteAddr() net.Addr { return nil } func (conn readOnlyConn) RemoteAddr() net.Addr { return nil }
func (conn readOnlyConn) SetDeadline(t time.Time) error { return nil } func (conn readOnlyConn) SetDeadline(_ time.Time) error { return nil }
func (conn readOnlyConn) SetReadDeadline(t time.Time) error { return nil } func (conn readOnlyConn) SetReadDeadline(_ time.Time) error { return nil }
func (conn readOnlyConn) SetWriteDeadline(t time.Time) error { return nil } func (conn readOnlyConn) SetWriteDeadline(_ time.Time) error { return nil }

View File

@ -434,10 +434,9 @@ func (ctl *Control) manager() {
defer ctl.managerShutdown.Done() defer ctl.managerShutdown.Done()
var heartbeatCh <-chan time.Time var heartbeatCh <-chan time.Time
if ctl.serverCfg.TCPMux || ctl.serverCfg.HeartbeatTimeout <= 0 { // Don't need application heartbeat if TCPMux is enabled,
// Don't need application heartbeat here. // yamux will do same thing.
// yamux will do same thing. if !ctl.serverCfg.TCPMux && ctl.serverCfg.HeartbeatTimeout > 0 {
} else {
heartbeat := time.NewTicker(time.Second) heartbeat := time.NewTicker(time.Second)
defer heartbeat.Stop() defer heartbeat.Stop()
heartbeatCh = heartbeat.C heartbeatCh = heartbeat.C

View File

@ -55,7 +55,7 @@ type serverInfoResp struct {
} }
// /healthz // /healthz
func (svr *Service) Healthz(w http.ResponseWriter, r *http.Request) { func (svr *Service) Healthz(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(200) w.WriteHeader(200)
} }

View File

@ -43,7 +43,7 @@ func (ctl *HTTPGroupController) Register(
return g.Register(proxyName, group, groupKey, routeConfig) return g.Register(proxyName, group, groupKey, routeConfig)
} }
func (ctl *HTTPGroupController) UnRegister(proxyName, group string, routeConfig vhost.RouteConfig) { func (ctl *HTTPGroupController) UnRegister(proxyName, group string, _ vhost.RouteConfig) {
indexKey := group indexKey := group
ctl.mu.Lock() ctl.mu.Lock()
defer ctl.mu.Unlock() defer ctl.mu.Unlock()

View File

@ -27,11 +27,11 @@ func Register(m ServerMetrics) {
type noopServerMetrics struct{} type noopServerMetrics struct{}
func (noopServerMetrics) NewClient() {} func (noopServerMetrics) NewClient() {}
func (noopServerMetrics) CloseClient() {} func (noopServerMetrics) CloseClient() {}
func (noopServerMetrics) NewProxy(name string, proxyType string) {} func (noopServerMetrics) NewProxy(string, string) {}
func (noopServerMetrics) CloseProxy(name string, proxyType string) {} func (noopServerMetrics) CloseProxy(string, string) {}
func (noopServerMetrics) OpenConnection(name string, proxyType string) {} func (noopServerMetrics) OpenConnection(string, string) {}
func (noopServerMetrics) CloseConnection(name string, proxyType string) {} func (noopServerMetrics) CloseConnection(string, string) {}
func (noopServerMetrics) AddTrafficIn(name string, proxyType string, trafficBytes int64) {} func (noopServerMetrics) AddTrafficIn(string, string, int64) {}
func (noopServerMetrics) AddTrafficOut(name string, proxyType string, trafficBytes int64) {} func (noopServerMetrics) AddTrafficOut(string, string, int64) {}

View File

@ -56,10 +56,7 @@ func (m *MockServers) Run() error {
if err := m.udsEchoServer.Run(); err != nil { if err := m.udsEchoServer.Run(); err != nil {
return err return err
} }
if err := m.httpSimpleServer.Run(); err != nil { return m.httpSimpleServer.Run()
return err
}
return nil
} }
func (m *MockServers) Close() { func (m *MockServers) Close() {