mirror of
https://github.com/fatedier/frp.git
synced 2024-12-22 17:34:49 +07:00
update github actions (#3538)
This commit is contained in:
parent
efcc028a3d
commit
46ff40543a
4
.github/workflows/build-and-push-image.yml
vendored
4
.github/workflows/build-and-push-image.yml
vendored
@ -61,7 +61,7 @@ jobs:
|
||||
echo "TAG_FRPS_GPR=ghcr.io/fatedier/frps:${{ env.TAG_NAME }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Build and push frpc
|
||||
uses: docker/build-push-action@v3
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./dockerfiles/Dockerfile-for-frpc
|
||||
@ -72,7 +72,7 @@ jobs:
|
||||
${{ env.TAG_FRPC_GPR }}
|
||||
|
||||
- name: Build and push frps
|
||||
uses: docker/build-push-action@v3
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./dockerfiles/Dockerfile-for-frps
|
||||
|
4
.github/workflows/golangci-lint.yml
vendored
4
.github/workflows/golangci-lint.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
||||
name: lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/setup-go@v3
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.20'
|
||||
- uses: actions/checkout@v3
|
||||
@ -22,7 +22,7 @@ jobs:
|
||||
uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
# 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.
|
||||
# args: --issues-exit-code=0
|
||||
|
6
.github/workflows/goreleaser.yml
vendored
6
.github/workflows/goreleaser.yml
vendored
@ -13,7 +13,7 @@ jobs:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.20'
|
||||
|
||||
@ -22,9 +22,9 @@ jobs:
|
||||
./package.sh
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v3
|
||||
uses: goreleaser/goreleaser-action@v4
|
||||
with:
|
||||
version: latest
|
||||
args: release --rm-dist --release-notes=./Release.md
|
||||
args: release --clean --release-notes=./Release.md
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }}
|
||||
|
2
.github/workflows/stale.yml
vendored
2
.github/workflows/stale.yml
vendored
@ -18,7 +18,7 @@ jobs:
|
||||
pull-requests: write # for actions/stale to close stale PRs
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v6
|
||||
- uses: actions/stale@v8
|
||||
with:
|
||||
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.'
|
||||
|
@ -39,12 +39,12 @@ type GeneralResponse struct {
|
||||
}
|
||||
|
||||
// /healthz
|
||||
func (svr *Service) healthz(w http.ResponseWriter, r *http.Request) {
|
||||
func (svr *Service) healthz(w http.ResponseWriter, _ *http.Request) {
|
||||
w.WriteHeader(200)
|
||||
}
|
||||
|
||||
// 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}
|
||||
|
||||
log.Info("api request [/api/reload]")
|
||||
@ -74,7 +74,7 @@ func (svr *Service) apiReload(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// 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}
|
||||
|
||||
log.Info("api request [/api/stop]")
|
||||
@ -124,7 +124,7 @@ func NewProxyStatusResp(status *proxy.WorkingStatus, serverAddr string) ProxySta
|
||||
}
|
||||
|
||||
// GET /api/status
|
||||
func (svr *Service) apiStatus(w http.ResponseWriter, r *http.Request) {
|
||||
func (svr *Service) apiStatus(w http.ResponseWriter, _ *http.Request) {
|
||||
var (
|
||||
buf []byte
|
||||
res StatusResp = make(map[string][]ProxyStatusResp)
|
||||
@ -153,7 +153,7 @@ func (svr *Service) apiStatus(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// 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}
|
||||
|
||||
log.Info("Http get request [/api/config]")
|
||||
|
@ -124,7 +124,7 @@ func (ctl *Control) Run() {
|
||||
go ctl.vm.Run()
|
||||
}
|
||||
|
||||
func (ctl *Control) HandleReqWorkConn(inMsg *msg.ReqWorkConn) {
|
||||
func (ctl *Control) HandleReqWorkConn(_ *msg.ReqWorkConn) {
|
||||
xl := ctl.xl
|
||||
workConn, err := ctl.connectServer()
|
||||
if err != nil {
|
||||
|
@ -40,7 +40,7 @@ type GeneralTCPProxy struct {
|
||||
*BaseProxy
|
||||
}
|
||||
|
||||
func NewGeneralTCPProxy(baseProxy *BaseProxy, cfg config.ProxyConf) Proxy {
|
||||
func NewGeneralTCPProxy(baseProxy *BaseProxy, _ config.ProxyConf) Proxy {
|
||||
return &GeneralTCPProxy{
|
||||
BaseProxy: baseProxy,
|
||||
}
|
||||
|
@ -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.Info("incoming a new work connection for sudp proxy, %s", conn.RemoteAddr().String())
|
||||
|
||||
|
@ -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.Info("incoming a new work connection for udp proxy, %s", conn.RemoteAddr().String())
|
||||
// close resources releated with old workConn
|
||||
|
@ -370,7 +370,7 @@ func (ks *KCPTunnelSession) Init(listenConn *net.UDPConn, raddr *net.UDPAddr) er
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ks *KCPTunnelSession) OpenConn(ctx context.Context) (net.Conn, error) {
|
||||
func (ks *KCPTunnelSession) OpenConn(_ context.Context) (net.Conn, error) {
|
||||
ks.mu.RLock()
|
||||
defer ks.mu.RUnlock()
|
||||
session := ks.session
|
||||
|
@ -527,11 +527,8 @@ func (cfg *TCPProxyConf) ValidateForClient() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (cfg *TCPProxyConf) ValidateForServer(serverCfg ServerCommonConf) error {
|
||||
if err := cfg.BaseProxyConf.validateForServer(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
func (cfg *TCPProxyConf) ValidateForServer(_ ServerCommonConf) error {
|
||||
return cfg.BaseProxyConf.validateForServer()
|
||||
}
|
||||
|
||||
// TCPMux
|
||||
@ -644,11 +641,8 @@ func (cfg *UDPProxyConf) ValidateForClient() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (cfg *UDPProxyConf) ValidateForServer(serverCfg ServerCommonConf) error {
|
||||
if err := cfg.BaseProxyConf.validateForServer(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
func (cfg *UDPProxyConf) ValidateForServer(_ ServerCommonConf) error {
|
||||
return cfg.BaseProxyConf.validateForServer()
|
||||
}
|
||||
|
||||
// HTTP
|
||||
@ -821,11 +815,8 @@ func (cfg *SUDPProxyConf) ValidateForClient() (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cfg *SUDPProxyConf) ValidateForServer(serverCfg ServerCommonConf) error {
|
||||
if err := cfg.BaseProxyConf.validateForServer(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
func (cfg *SUDPProxyConf) ValidateForServer(_ ServerCommonConf) error {
|
||||
return cfg.BaseProxyConf.validateForServer()
|
||||
}
|
||||
|
||||
// STCP
|
||||
@ -875,11 +866,8 @@ func (cfg *STCPProxyConf) ValidateForClient() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (cfg *STCPProxyConf) ValidateForServer(serverCfg ServerCommonConf) error {
|
||||
if err := cfg.BaseProxyConf.validateForServer(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
func (cfg *STCPProxyConf) ValidateForServer(_ ServerCommonConf) error {
|
||||
return cfg.BaseProxyConf.validateForServer()
|
||||
}
|
||||
|
||||
// XTCP
|
||||
@ -928,9 +916,6 @@ func (cfg *XTCPProxyConf) ValidateForClient() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (cfg *XTCPProxyConf) ValidateForServer(serverCfg ServerCommonConf) error {
|
||||
if err := cfg.BaseProxyConf.validateForServer(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
func (cfg *XTCPProxyConf) ValidateForServer(_ ServerCommonConf) error {
|
||||
return cfg.BaseProxyConf.validateForServer()
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ var (
|
||||
testProxyPrefix = "test."
|
||||
)
|
||||
|
||||
func Test_Proxy_Interface(t *testing.T) {
|
||||
func Test_Proxy_Interface(_ *testing.T) {
|
||||
for name := range proxyConfTypeMap {
|
||||
NewConfByType(name)
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import (
|
||||
|
||||
const testVisitorPrefix = "test."
|
||||
|
||||
func Test_Visitor_Interface(t *testing.T) {
|
||||
func Test_Visitor_Interface(_ *testing.T) {
|
||||
for name := range visitorConfTypeMap {
|
||||
DefaultVisitorConf(name)
|
||||
}
|
||||
|
@ -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.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.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.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.mu.Lock()
|
||||
|
@ -29,11 +29,11 @@ func (m *serverMetrics) CloseClient() {
|
||||
m.clientCount.Dec()
|
||||
}
|
||||
|
||||
func (m *serverMetrics) NewProxy(name string, proxyType string) {
|
||||
func (m *serverMetrics) NewProxy(_ string, proxyType string) {
|
||||
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()
|
||||
}
|
||||
|
||||
|
@ -45,10 +45,7 @@ func DecodeMessageInto(data, key []byte, m msg.Message) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := msg.ReadMsgInto(bytes.NewReader(buf), m); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return msg.ReadMsgInto(bytes.NewReader(buf), m)
|
||||
}
|
||||
|
||||
type ChangedAddress struct {
|
||||
|
@ -97,7 +97,7 @@ func NewHTTP2HTTPSPlugin(params map[string]string) (Plugin, error) {
|
||||
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)
|
||||
_ = p.l.PutConn(wrapConn)
|
||||
}
|
||||
@ -107,8 +107,5 @@ func (p *HTTP2HTTPSPlugin) Name() string {
|
||||
}
|
||||
|
||||
func (p *HTTP2HTTPSPlugin) Close() error {
|
||||
if err := p.s.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return p.s.Close()
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ func (hp *HTTPProxy) Name() string {
|
||||
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)
|
||||
|
||||
sc, rd := libnet.NewSharedConn(wrapConn)
|
||||
|
@ -122,7 +122,7 @@ func (p *HTTPS2HTTPPlugin) genTLSConfig() (*tls.Config, error) {
|
||||
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)
|
||||
_ = p.l.PutConn(wrapConn)
|
||||
}
|
||||
@ -132,8 +132,5 @@ func (p *HTTPS2HTTPPlugin) Name() string {
|
||||
}
|
||||
|
||||
func (p *HTTPS2HTTPPlugin) Close() error {
|
||||
if err := p.s.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return p.s.Close()
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ func (p *HTTPS2HTTPSPlugin) genTLSConfig() (*tls.Config, error) {
|
||||
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)
|
||||
_ = p.l.PutConn(wrapConn)
|
||||
}
|
||||
@ -137,8 +137,5 @@ func (p *HTTPS2HTTPSPlugin) Name() string {
|
||||
}
|
||||
|
||||
func (p *HTTPS2HTTPSPlugin) Close() error {
|
||||
if err := p.s.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return p.s.Close()
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ func NewSocks5Plugin(params map[string]string) (p Plugin, err error) {
|
||||
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()
|
||||
wrapConn := utilnet.WrapReadWriteCloserToConn(conn, realConn)
|
||||
_ = sp.Server.ServeConn(wrapConn)
|
||||
|
@ -76,7 +76,7 @@ func NewStaticFilePlugin(params map[string]string) (Plugin, error) {
|
||||
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)
|
||||
_ = sp.l.PutConn(wrapConn)
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ func NewUnixDomainSocketPlugin(params map[string]string) (p Plugin, err error) {
|
||||
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)
|
||||
if err != nil {
|
||||
return
|
||||
|
@ -120,8 +120,5 @@ func (p *httpPlugin) do(ctx context.Context, r *Request, res *Response) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = json.Unmarshal(buf, res); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return json.Unmarshal(buf, res)
|
||||
}
|
||||
|
@ -103,9 +103,7 @@ func NewServerTLSConfig(certPath, keyPath, caPath string) (*tls.Config, error) {
|
||||
func NewClientTLSConfig(certPath, keyPath, caPath, serverName string) (*tls.Config, error) {
|
||||
base := &tls.Config{}
|
||||
|
||||
if certPath == "" || keyPath == "" {
|
||||
// client will not generate tls conf by itself
|
||||
} else {
|
||||
if certPath != "" && keyPath != "" {
|
||||
cert, err := newCustomTLSKeyPair(certPath, keyPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -140,15 +140,15 @@ func (c *FakeUDPConn) RemoteAddr() net.Addr {
|
||||
return c.remoteAddr
|
||||
}
|
||||
|
||||
func (c *FakeUDPConn) SetDeadline(t time.Time) error {
|
||||
func (c *FakeUDPConn) SetDeadline(_ time.Time) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *FakeUDPConn) SetReadDeadline(t time.Time) error {
|
||||
func (c *FakeUDPConn) SetReadDeadline(_ time.Time) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *FakeUDPConn) SetWriteDeadline(t time.Time) error {
|
||||
func (c *FakeUDPConn) SetWriteDeadline(_ time.Time) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -263,4 +263,4 @@ func (l *UDPListener) Addr() net.Addr {
|
||||
type ConnectedUDPConn struct{ *net.UDPConn }
|
||||
|
||||
// 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) }
|
||||
|
@ -66,7 +66,7 @@ func (muxer *HTTPConnectTCPMuxer) readHTTPConnectRequest(rd io.Reader) (host, ht
|
||||
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 {
|
||||
return nil
|
||||
}
|
||||
|
@ -74,10 +74,10 @@ type readOnlyConn struct {
|
||||
}
|
||||
|
||||
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) LocalAddr() 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) SetReadDeadline(t time.Time) error { return nil }
|
||||
func (conn readOnlyConn) SetWriteDeadline(t time.Time) error { return nil }
|
||||
func (conn readOnlyConn) SetDeadline(_ time.Time) error { return nil }
|
||||
func (conn readOnlyConn) SetReadDeadline(_ time.Time) error { return nil }
|
||||
func (conn readOnlyConn) SetWriteDeadline(_ time.Time) error { return nil }
|
||||
|
@ -434,10 +434,9 @@ func (ctl *Control) manager() {
|
||||
defer ctl.managerShutdown.Done()
|
||||
|
||||
var heartbeatCh <-chan time.Time
|
||||
if ctl.serverCfg.TCPMux || ctl.serverCfg.HeartbeatTimeout <= 0 {
|
||||
// Don't need application heartbeat here.
|
||||
// yamux will do same thing.
|
||||
} else {
|
||||
// Don't need application heartbeat if TCPMux is enabled,
|
||||
// yamux will do same thing.
|
||||
if !ctl.serverCfg.TCPMux && ctl.serverCfg.HeartbeatTimeout > 0 {
|
||||
heartbeat := time.NewTicker(time.Second)
|
||||
defer heartbeat.Stop()
|
||||
heartbeatCh = heartbeat.C
|
||||
|
@ -55,7 +55,7 @@ type serverInfoResp struct {
|
||||
}
|
||||
|
||||
// /healthz
|
||||
func (svr *Service) Healthz(w http.ResponseWriter, r *http.Request) {
|
||||
func (svr *Service) Healthz(w http.ResponseWriter, _ *http.Request) {
|
||||
w.WriteHeader(200)
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ func (ctl *HTTPGroupController) Register(
|
||||
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
|
||||
ctl.mu.Lock()
|
||||
defer ctl.mu.Unlock()
|
||||
|
@ -27,11 +27,11 @@ func Register(m ServerMetrics) {
|
||||
|
||||
type noopServerMetrics struct{}
|
||||
|
||||
func (noopServerMetrics) NewClient() {}
|
||||
func (noopServerMetrics) CloseClient() {}
|
||||
func (noopServerMetrics) NewProxy(name string, proxyType string) {}
|
||||
func (noopServerMetrics) CloseProxy(name string, proxyType string) {}
|
||||
func (noopServerMetrics) OpenConnection(name string, proxyType string) {}
|
||||
func (noopServerMetrics) CloseConnection(name string, proxyType string) {}
|
||||
func (noopServerMetrics) AddTrafficIn(name string, proxyType string, trafficBytes int64) {}
|
||||
func (noopServerMetrics) AddTrafficOut(name string, proxyType string, trafficBytes int64) {}
|
||||
func (noopServerMetrics) NewClient() {}
|
||||
func (noopServerMetrics) CloseClient() {}
|
||||
func (noopServerMetrics) NewProxy(string, string) {}
|
||||
func (noopServerMetrics) CloseProxy(string, string) {}
|
||||
func (noopServerMetrics) OpenConnection(string, string) {}
|
||||
func (noopServerMetrics) CloseConnection(string, string) {}
|
||||
func (noopServerMetrics) AddTrafficIn(string, string, int64) {}
|
||||
func (noopServerMetrics) AddTrafficOut(string, string, int64) {}
|
||||
|
@ -56,10 +56,7 @@ func (m *MockServers) Run() error {
|
||||
if err := m.udsEchoServer.Run(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := m.httpSimpleServer.Run(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return m.httpSimpleServer.Run()
|
||||
}
|
||||
|
||||
func (m *MockServers) Close() {
|
||||
|
Loading…
Reference in New Issue
Block a user