add metrics

This commit is contained in:
ginuerzh
2022-04-05 17:56:36 +08:00
parent 6aa1cc7401
commit 1444ebc1ee
26 changed files with 405 additions and 29 deletions

View File

@ -6,11 +6,11 @@ import (
"net"
"time"
netpkg "github.com/go-gost/core/common/net"
"github.com/go-gost/core/handler"
md "github.com/go-gost/core/metadata"
"github.com/go-gost/gosocks4"
"github.com/go-gost/gosocks5"
netpkg "github.com/go-gost/x/internal/net"
"github.com/go-gost/x/registry"
)

View File

@ -8,9 +8,9 @@ import (
"time"
"github.com/go-gost/core/chain"
netpkg "github.com/go-gost/core/common/net"
"github.com/go-gost/core/handler"
md "github.com/go-gost/core/metadata"
netpkg "github.com/go-gost/x/internal/net"
"github.com/go-gost/x/registry"
)

View File

@ -8,9 +8,9 @@ import (
"time"
"github.com/go-gost/core/chain"
netpkg "github.com/go-gost/core/common/net"
"github.com/go-gost/core/handler"
md "github.com/go-gost/core/metadata"
netpkg "github.com/go-gost/x/internal/net"
"github.com/go-gost/x/registry"
)

View File

@ -17,10 +17,10 @@ import (
"github.com/asaskevich/govalidator"
"github.com/go-gost/core/chain"
netpkg "github.com/go-gost/core/common/net"
"github.com/go-gost/core/handler"
"github.com/go-gost/core/logger"
md "github.com/go-gost/core/metadata"
netpkg "github.com/go-gost/x/internal/net"
"github.com/go-gost/x/registry"
)

View File

@ -8,8 +8,8 @@ import (
"net/http/httputil"
"time"
"github.com/go-gost/core/common/net/relay"
"github.com/go-gost/core/logger"
"github.com/go-gost/x/internal/net/udp"
"github.com/go-gost/x/internal/util/socks"
)
@ -65,7 +65,7 @@ func (h *httpHandler) handleUDP(ctx context.Context, conn net.Conn, log logger.L
return err
}
relay := relay.NewUDPRelay(socks.UDPTunServerConn(conn), pc).
relay := udp.NewRelay(socks.UDPTunServerConn(conn), pc).
WithBypass(h.options.Bypass).
WithLogger(log)

View File

@ -19,10 +19,10 @@ import (
"time"
"github.com/go-gost/core/chain"
netpkg "github.com/go-gost/core/common/net"
"github.com/go-gost/core/handler"
"github.com/go-gost/core/logger"
md "github.com/go-gost/core/metadata"
netpkg "github.com/go-gost/x/internal/net"
"github.com/go-gost/x/registry"
)

View File

@ -14,11 +14,11 @@ import (
"time"
"github.com/go-gost/core/chain"
netpkg "github.com/go-gost/core/common/net"
"github.com/go-gost/core/handler"
"github.com/go-gost/core/logger"
md "github.com/go-gost/core/metadata"
dissector "github.com/go-gost/tls-dissector"
netpkg "github.com/go-gost/x/internal/net"
"github.com/go-gost/x/registry"
)

View File

@ -7,9 +7,9 @@ import (
"time"
"github.com/go-gost/core/chain"
netpkg "github.com/go-gost/core/common/net"
"github.com/go-gost/core/handler"
md "github.com/go-gost/core/metadata"
netpkg "github.com/go-gost/x/internal/net"
"github.com/go-gost/x/registry"
)

View File

@ -6,10 +6,10 @@ import (
"net"
"time"
netpkg "github.com/go-gost/core/common/net"
net_relay "github.com/go-gost/core/common/net/relay"
"github.com/go-gost/core/logger"
"github.com/go-gost/relay"
netpkg "github.com/go-gost/x/internal/net"
"github.com/go-gost/x/internal/net/udp"
"github.com/go-gost/x/internal/util/mux"
relay_util "github.com/go-gost/x/internal/util/relay"
)
@ -113,7 +113,7 @@ func (h *relayHandler) bindUDP(ctx context.Context, conn net.Conn, network, addr
})
log.Debugf("bind on %s OK", pc.LocalAddr())
r := net_relay.NewUDPRelay(relay_util.UDPTunServerConn(conn), pc).
r := udp.NewRelay(relay_util.UDPTunServerConn(conn), pc).
WithBypass(h.options.Bypass).
WithLogger(log)
r.SetBufferSize(h.md.udpBufferSize)

View File

@ -7,9 +7,9 @@ import (
"net"
"time"
netpkg "github.com/go-gost/core/common/net"
"github.com/go-gost/core/logger"
"github.com/go-gost/relay"
netpkg "github.com/go-gost/x/internal/net"
)
func (h *relayHandler) handleConnect(ctx context.Context, conn net.Conn, network, address string, log logger.Logger) error {

View File

@ -7,9 +7,9 @@ import (
"net"
"time"
netpkg "github.com/go-gost/core/common/net"
"github.com/go-gost/core/logger"
"github.com/go-gost/relay"
netpkg "github.com/go-gost/x/internal/net"
)
func (h *relayHandler) handleForward(ctx context.Context, conn net.Conn, network string, log logger.Logger) error {

View File

@ -13,10 +13,10 @@ import (
"github.com/go-gost/core/chain"
"github.com/go-gost/core/common/bufpool"
netpkg "github.com/go-gost/core/common/net"
"github.com/go-gost/core/handler"
md "github.com/go-gost/core/metadata"
dissector "github.com/go-gost/tls-dissector"
netpkg "github.com/go-gost/x/internal/net"
"github.com/go-gost/x/registry"
)

View File

@ -7,11 +7,11 @@ import (
"time"
"github.com/go-gost/core/chain"
netpkg "github.com/go-gost/core/common/net"
"github.com/go-gost/core/handler"
"github.com/go-gost/core/logger"
md "github.com/go-gost/core/metadata"
"github.com/go-gost/gosocks4"
netpkg "github.com/go-gost/x/internal/net"
"github.com/go-gost/x/registry"
)

View File

@ -6,9 +6,9 @@ import (
"net"
"time"
netpkg "github.com/go-gost/core/common/net"
"github.com/go-gost/core/logger"
"github.com/go-gost/gosocks5"
netpkg "github.com/go-gost/x/internal/net"
)
func (h *socks5Handler) handleBind(ctx context.Context, conn net.Conn, network, address string, log logger.Logger) error {

View File

@ -6,9 +6,9 @@ import (
"net"
"time"
netpkg "github.com/go-gost/core/common/net"
"github.com/go-gost/core/logger"
"github.com/go-gost/gosocks5"
netpkg "github.com/go-gost/x/internal/net"
)
func (h *socks5Handler) handleConnect(ctx context.Context, conn net.Conn, network, address string, log logger.Logger) error {

View File

@ -6,9 +6,9 @@ import (
"net"
"time"
netpkg "github.com/go-gost/core/common/net"
"github.com/go-gost/core/logger"
"github.com/go-gost/gosocks5"
netpkg "github.com/go-gost/x/internal/net"
"github.com/go-gost/x/internal/util/mux"
)

View File

@ -9,9 +9,9 @@ import (
"net"
"time"
"github.com/go-gost/core/common/net/relay"
"github.com/go-gost/core/logger"
"github.com/go-gost/gosocks5"
"github.com/go-gost/x/internal/net/udp"
"github.com/go-gost/x/internal/util/socks"
)
@ -68,7 +68,7 @@ func (h *socks5Handler) handleUDP(ctx context.Context, conn net.Conn, log logger
return err
}
r := relay.NewUDPRelay(socks.UDPConn(cc, h.md.udpBufferSize), pc).
r := udp.NewRelay(socks.UDPConn(cc, h.md.udpBufferSize), pc).
WithBypass(h.options.Bypass).
WithLogger(log)
r.SetBufferSize(h.md.udpBufferSize)

View File

@ -5,9 +5,9 @@ import (
"net"
"time"
"github.com/go-gost/core/common/net/relay"
"github.com/go-gost/core/logger"
"github.com/go-gost/gosocks5"
"github.com/go-gost/x/internal/net/udp"
"github.com/go-gost/x/internal/util/socks"
)
@ -56,7 +56,7 @@ func (h *socks5Handler) handleUDPTun(ctx context.Context, conn net.Conn, network
log.Debug(reply)
log.Debugf("bind on %s OK", pc.LocalAddr())
r := relay.NewUDPRelay(socks.UDPTunServerConn(conn), pc).
r := udp.NewRelay(socks.UDPTunServerConn(conn), pc).
WithBypass(h.options.Bypass).
WithLogger(log)
r.SetBufferSize(h.md.udpBufferSize)

View File

@ -8,10 +8,10 @@ import (
"time"
"github.com/go-gost/core/chain"
netpkg "github.com/go-gost/core/common/net"
"github.com/go-gost/core/handler"
md "github.com/go-gost/core/metadata"
"github.com/go-gost/gosocks5"
netpkg "github.com/go-gost/x/internal/net"
"github.com/go-gost/x/internal/util/ss"
"github.com/go-gost/x/registry"
"github.com/shadowsocks/go-shadowsocks2/core"

View File

@ -10,10 +10,10 @@ import (
"time"
"github.com/go-gost/core/chain"
netpkg "github.com/go-gost/core/common/net"
"github.com/go-gost/core/handler"
"github.com/go-gost/core/logger"
md "github.com/go-gost/core/metadata"
netpkg "github.com/go-gost/x/internal/net"
sshd_util "github.com/go-gost/x/internal/util/sshd"
"github.com/go-gost/x/registry"
"golang.org/x/crypto/ssh"