add observer
This commit is contained in:
@ -17,6 +17,7 @@ import (
|
||||
md "github.com/go-gost/core/metadata"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
|
||||
@ -117,6 +118,7 @@ func (l *dnsListener) Accept() (conn net.Conn, err error) {
|
||||
select {
|
||||
case conn = <-l.cqueue:
|
||||
conn = metrics.WrapConn(l.options.Service, conn)
|
||||
conn = stats.WrapConn(conn, l.options.Stats)
|
||||
conn = admission.WrapConn(l.options.Admission, conn)
|
||||
conn = limiter.WrapConn(l.options.TrafficLimiter, conn)
|
||||
case err, ok = <-l.errChan:
|
||||
|
@ -17,6 +17,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
"github.com/pion/dtls/v2"
|
||||
)
|
||||
|
||||
@ -79,6 +80,7 @@ func (l *dtlsListener) Init(md md.Metadata) (err error) {
|
||||
}
|
||||
ln = proxyproto.WrapListener(l.options.ProxyProtocol, ln, 10*time.Second)
|
||||
ln = metrics.WrapListener(l.options.Service, ln)
|
||||
ln = stats.WrapListener(ln, l.options.Stats)
|
||||
ln = admission.WrapListener(l.options.Admission, ln)
|
||||
ln = limiter.WrapListener(l.options.TrafficLimiter, ln)
|
||||
ln = climiter.WrapListener(l.options.ConnLimiter, ln)
|
||||
|
@ -12,6 +12,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
"github.com/xtaci/tcpraw"
|
||||
)
|
||||
|
||||
@ -52,6 +53,7 @@ func (l *ftcpListener) Init(md md.Metadata) (err error) {
|
||||
return
|
||||
}
|
||||
conn = metrics.WrapPacketConn(l.options.Service, conn)
|
||||
conn = stats.WrapPacketConn(conn, l.options.Stats)
|
||||
conn = admission.WrapPacketConn(l.options.Admission, conn)
|
||||
conn = limiter.WrapPacketConn(l.options.TrafficLimiter, conn)
|
||||
|
||||
|
@ -16,6 +16,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
"google.golang.org/grpc/keepalive"
|
||||
@ -66,6 +67,7 @@ func (l *grpcListener) Init(md md.Metadata) (err error) {
|
||||
}
|
||||
ln = proxyproto.WrapListener(l.options.ProxyProtocol, ln, 10*time.Second)
|
||||
ln = metrics.WrapListener(l.options.Service, ln)
|
||||
ln = stats.WrapListener(ln, l.options.Stats)
|
||||
ln = admission.WrapListener(l.options.Admission, ln)
|
||||
ln = limiter.WrapListener(l.options.TrafficLimiter, ln)
|
||||
ln = climiter.WrapListener(l.options.ConnLimiter, ln)
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
"golang.org/x/net/http2"
|
||||
"golang.org/x/net/http2/h2c"
|
||||
)
|
||||
@ -87,6 +88,7 @@ func (l *h2Listener) Init(md md.Metadata) (err error) {
|
||||
l.addr = ln.Addr()
|
||||
ln = proxyproto.WrapListener(l.options.ProxyProtocol, ln, 10*time.Second)
|
||||
ln = metrics.WrapListener(l.options.Service, ln)
|
||||
ln = stats.WrapListener(ln, l.options.Stats)
|
||||
ln = admission.WrapListener(l.options.Admission, ln)
|
||||
ln = limiter.WrapListener(l.options.TrafficLimiter, ln)
|
||||
ln = climiter.WrapListener(l.options.ConnLimiter, ln)
|
||||
|
@ -18,6 +18,7 @@ import (
|
||||
mdx "github.com/go-gost/x/metadata"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
"golang.org/x/net/http2"
|
||||
)
|
||||
|
||||
@ -76,6 +77,7 @@ func (l *http2Listener) Init(md md.Metadata) (err error) {
|
||||
l.addr = ln.Addr()
|
||||
ln = proxyproto.WrapListener(l.options.ProxyProtocol, ln, 10*time.Second)
|
||||
ln = metrics.WrapListener(l.options.Service, ln)
|
||||
ln = stats.WrapListener(ln, l.options.Stats)
|
||||
ln = admission.WrapListener(l.options.Admission, ln)
|
||||
ln = limiter.WrapListener(l.options.TrafficLimiter, ln)
|
||||
ln = climiter.WrapListener(l.options.ConnLimiter, ln)
|
||||
|
@ -12,6 +12,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
"github.com/quic-go/quic-go"
|
||||
)
|
||||
|
||||
@ -85,6 +86,7 @@ func (l *http3Listener) Accept() (conn net.Conn, err error) {
|
||||
}
|
||||
|
||||
conn = metrics.WrapConn(l.options.Service, conn)
|
||||
conn = stats.WrapConn(conn, l.options.Stats)
|
||||
conn = admission.WrapConn(l.options.Admission, conn)
|
||||
conn = limiter.WrapConn(l.options.TrafficLimiter, conn)
|
||||
return conn, nil
|
||||
|
@ -8,9 +8,13 @@ import (
|
||||
"github.com/go-gost/core/listener"
|
||||
"github.com/go-gost/core/logger"
|
||||
md "github.com/go-gost/core/metadata"
|
||||
admission "github.com/go-gost/x/admission/wrapper"
|
||||
xnet "github.com/go-gost/x/internal/net"
|
||||
wt_util "github.com/go-gost/x/internal/util/wt"
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
"github.com/quic-go/quic-go"
|
||||
"github.com/quic-go/quic-go/http3"
|
||||
wt "github.com/quic-go/webtransport-go"
|
||||
@ -95,6 +99,10 @@ func (l *wtListener) Accept() (conn net.Conn, err error) {
|
||||
var ok bool
|
||||
select {
|
||||
case conn = <-l.cqueue:
|
||||
conn = metrics.WrapConn(l.options.Service, conn)
|
||||
conn = stats.WrapConn(conn, l.options.Stats)
|
||||
conn = admission.WrapConn(l.options.Admission, conn)
|
||||
conn = limiter.WrapConn(l.options.TrafficLimiter, conn)
|
||||
case err, ok = <-l.errChan:
|
||||
if !ok {
|
||||
err = listener.ErrClosed
|
||||
|
@ -12,6 +12,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
"github.com/quic-go/quic-go"
|
||||
"golang.org/x/net/icmp"
|
||||
)
|
||||
@ -57,6 +58,7 @@ func (l *icmpListener) Init(md md.Metadata) (err error) {
|
||||
}
|
||||
conn = icmp_pkg.ServerConn(conn)
|
||||
conn = metrics.WrapPacketConn(l.options.Service, conn)
|
||||
conn = stats.WrapPacketConn(conn, l.options.Stats)
|
||||
conn = admission.WrapPacketConn(l.options.Admission, conn)
|
||||
conn = limiter.WrapPacketConn(l.options.TrafficLimiter, conn)
|
||||
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
"github.com/xtaci/kcp-go/v5"
|
||||
"github.com/xtaci/smux"
|
||||
"github.com/xtaci/tcpraw"
|
||||
@ -75,6 +76,7 @@ func (l *kcpListener) Init(md md.Metadata) (err error) {
|
||||
}
|
||||
|
||||
conn = metrics.WrapUDPConn(l.options.Service, conn)
|
||||
conn = stats.WrapUDPConn(conn, l.options.Stats)
|
||||
conn = admission.WrapUDPConn(l.options.Admission, conn)
|
||||
conn = limiter.WrapUDPConn(l.options.TrafficLimiter, conn)
|
||||
|
||||
|
@ -16,6 +16,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -66,6 +67,7 @@ func (l *mtcpListener) Init(md md.Metadata) (err error) {
|
||||
|
||||
ln = proxyproto.WrapListener(l.options.ProxyProtocol, ln, 10*time.Second)
|
||||
ln = metrics.WrapListener(l.options.Service, ln)
|
||||
ln = stats.WrapListener(ln, l.options.Stats)
|
||||
ln = admission.WrapListener(l.options.Admission, ln)
|
||||
ln = limiter.WrapListener(l.options.TrafficLimiter, ln)
|
||||
ln = climiter.WrapListener(l.options.ConnLimiter, ln)
|
||||
|
@ -17,6 +17,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -65,6 +66,7 @@ func (l *mtlsListener) Init(md md.Metadata) (err error) {
|
||||
|
||||
ln = proxyproto.WrapListener(l.options.ProxyProtocol, ln, 10*time.Second)
|
||||
ln = metrics.WrapListener(l.options.Service, ln)
|
||||
ln = stats.WrapListener(ln, l.options.Stats)
|
||||
ln = admission.WrapListener(l.options.Admission, ln)
|
||||
ln = limiter.WrapListener(l.options.TrafficLimiter, ln)
|
||||
ln = climiter.WrapListener(l.options.ConnLimiter, ln)
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
"github.com/gorilla/websocket"
|
||||
)
|
||||
|
||||
@ -107,6 +108,7 @@ func (l *mwsListener) Init(md md.Metadata) (err error) {
|
||||
}
|
||||
ln = proxyproto.WrapListener(l.options.ProxyProtocol, ln, 10*time.Second)
|
||||
ln = metrics.WrapListener(l.options.Service, ln)
|
||||
ln = stats.WrapListener(ln, l.options.Stats)
|
||||
ln = admission.WrapListener(l.options.Admission, ln)
|
||||
ln = limiter.WrapListener(l.options.TrafficLimiter, ln)
|
||||
ln = climiter.WrapListener(l.options.ConnLimiter, ln)
|
||||
|
@ -9,13 +9,13 @@ import (
|
||||
"github.com/go-gost/core/logger"
|
||||
md "github.com/go-gost/core/metadata"
|
||||
admission "github.com/go-gost/x/admission/wrapper"
|
||||
xnet "github.com/go-gost/x/internal/net"
|
||||
"github.com/go-gost/x/internal/net/proxyproto"
|
||||
climiter "github.com/go-gost/x/limiter/conn/wrapper"
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
|
||||
xnet "github.com/go-gost/x/internal/net"
|
||||
"github.com/go-gost/x/internal/net/proxyproto"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -61,6 +61,7 @@ func (l *obfsListener) Init(md md.Metadata) (err error) {
|
||||
}
|
||||
ln = proxyproto.WrapListener(l.options.ProxyProtocol, ln, 10*time.Second)
|
||||
ln = metrics.WrapListener(l.options.Service, ln)
|
||||
ln = stats.WrapListener(ln, l.options.Stats)
|
||||
ln = admission.WrapListener(l.options.Admission, ln)
|
||||
ln = limiter.WrapListener(l.options.TrafficLimiter, ln)
|
||||
ln = climiter.WrapListener(l.options.ConnLimiter, ln)
|
||||
|
@ -15,6 +15,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -60,6 +61,7 @@ func (l *obfsListener) Init(md md.Metadata) (err error) {
|
||||
}
|
||||
ln = proxyproto.WrapListener(l.options.ProxyProtocol, ln, 10*time.Second)
|
||||
ln = metrics.WrapListener(l.options.Service, ln)
|
||||
ln = stats.WrapListener(ln, l.options.Stats)
|
||||
ln = admission.WrapListener(l.options.Admission, ln)
|
||||
ln = limiter.WrapListener(l.options.TrafficLimiter, ln)
|
||||
ln = climiter.WrapListener(l.options.ConnLimiter, ln)
|
||||
|
@ -14,6 +14,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -92,6 +93,7 @@ func (l *phtListener) Accept() (conn net.Conn, err error) {
|
||||
return
|
||||
}
|
||||
conn = metrics.WrapConn(l.options.Service, conn)
|
||||
conn = stats.WrapConn(conn, l.options.Stats)
|
||||
conn = admission.WrapConn(l.options.Admission, conn)
|
||||
conn = limiter.WrapConn(l.options.TrafficLimiter, conn)
|
||||
return
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
"github.com/quic-go/quic-go"
|
||||
)
|
||||
|
||||
@ -102,6 +103,7 @@ func (l *quicListener) Accept() (conn net.Conn, err error) {
|
||||
select {
|
||||
case conn = <-l.cqueue:
|
||||
conn = metrics.WrapConn(l.options.Service, conn)
|
||||
conn = stats.WrapConn(conn, l.options.Stats)
|
||||
conn = admission.WrapConn(l.options.Admission, conn)
|
||||
conn = limiter.WrapConn(l.options.TrafficLimiter, conn)
|
||||
case err, ok = <-l.errChan:
|
||||
|
@ -15,6 +15,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -65,6 +66,7 @@ func (l *redirectListener) Init(md md.Metadata) (err error) {
|
||||
|
||||
ln = proxyproto.WrapListener(l.options.ProxyProtocol, ln, 10*time.Second)
|
||||
ln = metrics.WrapListener(l.options.Service, ln)
|
||||
ln = stats.WrapListener(ln, l.options.Stats)
|
||||
ln = admission.WrapListener(l.options.Admission, ln)
|
||||
ln = limiter.WrapListener(l.options.TrafficLimiter, ln)
|
||||
ln = climiter.WrapListener(l.options.ConnLimiter, ln)
|
||||
|
@ -10,6 +10,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -54,6 +55,7 @@ func (l *redirectListener) Accept() (conn net.Conn, err error) {
|
||||
return
|
||||
}
|
||||
conn = metrics.WrapConn(l.options.Service, conn)
|
||||
conn = stats.WrapConn(conn, l.options.Stats)
|
||||
conn = admission.WrapConn(l.options.Admission, conn)
|
||||
conn = limiter.WrapConn(l.options.TrafficLimiter, conn)
|
||||
return
|
||||
|
@ -15,6 +15,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -84,6 +85,7 @@ func (l *rtcpListener) Accept() (conn net.Conn, err error) {
|
||||
return nil, listener.NewAcceptError(err)
|
||||
}
|
||||
ln = metrics.WrapListener(l.options.Service, ln)
|
||||
ln = stats.WrapListener(ln, l.options.Stats)
|
||||
ln = admission.WrapListener(l.options.Admission, ln)
|
||||
ln = limiter.WrapListener(l.options.TrafficLimiter, ln)
|
||||
ln = climiter.WrapListener(l.options.ConnLimiter, ln)
|
||||
|
@ -14,6 +14,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -105,6 +106,7 @@ func (l *rudpListener) Accept() (conn net.Conn, err error) {
|
||||
|
||||
if pc, ok := conn.(net.PacketConn); ok {
|
||||
uc := metrics.WrapUDPConn(l.options.Service, pc)
|
||||
uc = stats.WrapUDPConn(uc, l.options.Stats)
|
||||
uc = admission.WrapUDPConn(l.options.Admission, uc)
|
||||
conn = limiter.WrapUDPConn(l.options.TrafficLimiter, uc)
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -95,6 +96,7 @@ func (l *serialListener) listenLoop() {
|
||||
|
||||
c := serial.NewConn(port, l.addr, cancel)
|
||||
c = metrics.WrapConn(l.options.Service, c)
|
||||
c = stats.WrapConn(c, l.options.Stats)
|
||||
c = limiter.WrapConn(l.options.TrafficLimiter, c)
|
||||
|
||||
l.cqueue <- c
|
||||
|
@ -17,6 +17,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
"golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
@ -67,6 +68,7 @@ func (l *sshListener) Init(md md.Metadata) (err error) {
|
||||
|
||||
ln = proxyproto.WrapListener(l.options.ProxyProtocol, ln, 10*time.Second)
|
||||
ln = metrics.WrapListener(l.options.Service, ln)
|
||||
ln = stats.WrapListener(ln, l.options.Stats)
|
||||
ln = admission.WrapListener(l.options.Admission, ln)
|
||||
ln = limiter.WrapListener(l.options.TrafficLimiter, ln)
|
||||
ln = climiter.WrapListener(l.options.ConnLimiter, ln)
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
"golang.org/x/crypto/ssh"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
)
|
||||
|
||||
// Applicable SSH Request types for Port Forwarding - RFC 4254 7.X
|
||||
@ -75,6 +76,7 @@ func (l *sshdListener) Init(md md.Metadata) (err error) {
|
||||
|
||||
ln = proxyproto.WrapListener(l.options.ProxyProtocol, ln, 10*time.Second)
|
||||
ln = metrics.WrapListener(l.options.Service, ln)
|
||||
ln = stats.WrapListener(ln, l.options.Stats)
|
||||
ln = admission.WrapListener(l.options.Admission, ln)
|
||||
ln = limiter.WrapListener(l.options.TrafficLimiter, ln)
|
||||
ln = climiter.WrapListener(l.options.ConnLimiter, ln)
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
mdx "github.com/go-gost/x/metadata"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -90,6 +91,7 @@ func (l *tapListener) listenLoop() {
|
||||
cancel: cancel,
|
||||
}
|
||||
c = metrics.WrapConn(l.options.Service, c)
|
||||
c = stats.WrapConn(c, l.options.Stats)
|
||||
c = limiter.WrapConn(l.options.TrafficLimiter, c)
|
||||
c = withMetadata(mdx.NewMetadata(map[string]any{
|
||||
"config": l.md.config,
|
||||
|
@ -15,6 +15,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -63,6 +64,7 @@ func (l *tcpListener) Init(md md.Metadata) (err error) {
|
||||
|
||||
ln = proxyproto.WrapListener(l.options.ProxyProtocol, ln, 10*time.Second)
|
||||
ln = metrics.WrapListener(l.options.Service, ln)
|
||||
ln = stats.WrapListener(ln, l.options.Stats)
|
||||
ln = admission.WrapListener(l.options.Admission, ln)
|
||||
ln = limiter.WrapListener(l.options.TrafficLimiter, ln)
|
||||
ln = climiter.WrapListener(l.options.ConnLimiter, ln)
|
||||
|
@ -16,6 +16,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -61,6 +62,7 @@ func (l *tlsListener) Init(md md.Metadata) (err error) {
|
||||
}
|
||||
ln = proxyproto.WrapListener(l.options.ProxyProtocol, ln, 10*time.Second)
|
||||
ln = metrics.WrapListener(l.options.Service, ln)
|
||||
ln = stats.WrapListener(ln, l.options.Stats)
|
||||
ln = admission.WrapListener(l.options.Admission, ln)
|
||||
ln = limiter.WrapListener(l.options.TrafficLimiter, ln)
|
||||
ln = climiter.WrapListener(l.options.ConnLimiter, ln)
|
||||
|
@ -14,6 +14,7 @@ import (
|
||||
mdx "github.com/go-gost/x/metadata"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -27,7 +28,7 @@ type tunListener struct {
|
||||
logger logger.Logger
|
||||
md metadata
|
||||
options listener.Options
|
||||
routes []*router.Route
|
||||
routes []*router.Route
|
||||
}
|
||||
|
||||
func NewListener(opts ...listener.Option) listener.Listener {
|
||||
@ -91,6 +92,7 @@ func (l *tunListener) listenLoop() {
|
||||
cancel: cancel,
|
||||
}
|
||||
c = metrics.WrapConn(l.options.Service, c)
|
||||
c = stats.WrapConn(c, l.options.Stats)
|
||||
c = limiter.WrapConn(l.options.TrafficLimiter, c)
|
||||
c = withMetadata(mdx.NewMetadata(map[string]any{
|
||||
"config": l.md.config,
|
||||
|
@ -12,6 +12,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -56,6 +57,7 @@ func (l *udpListener) Init(md md.Metadata) (err error) {
|
||||
return
|
||||
}
|
||||
conn = metrics.WrapPacketConn(l.options.Service, conn)
|
||||
conn = stats.WrapPacketConn(conn, l.options.Stats)
|
||||
conn = admission.WrapPacketConn(l.options.Admission, conn)
|
||||
conn = limiter.WrapPacketConn(l.options.TrafficLimiter, conn)
|
||||
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -46,6 +47,7 @@ func (l *unixListener) Init(md md.Metadata) (err error) {
|
||||
}
|
||||
|
||||
ln = metrics.WrapListener(l.options.Service, ln)
|
||||
ln = stats.WrapListener(ln, l.options.Stats)
|
||||
ln = admission.WrapListener(l.options.Admission, ln)
|
||||
ln = limiter.WrapListener(l.options.TrafficLimiter, ln)
|
||||
ln = climiter.WrapListener(l.options.ConnLimiter, ln)
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
limiter "github.com/go-gost/x/limiter/traffic/wrapper"
|
||||
metrics "github.com/go-gost/x/metrics/wrapper"
|
||||
"github.com/go-gost/x/registry"
|
||||
stats "github.com/go-gost/x/stats/wrapper"
|
||||
"github.com/gorilla/websocket"
|
||||
)
|
||||
|
||||
@ -102,6 +103,7 @@ func (l *wsListener) Init(md md.Metadata) (err error) {
|
||||
}
|
||||
ln = proxyproto.WrapListener(l.options.ProxyProtocol, ln, 10*time.Second)
|
||||
ln = metrics.WrapListener(l.options.Service, ln)
|
||||
ln = stats.WrapListener(ln, l.options.Stats)
|
||||
ln = admission.WrapListener(l.options.Admission, ln)
|
||||
ln = limiter.WrapListener(l.options.TrafficLimiter, ln)
|
||||
ln = climiter.WrapListener(l.options.ConnLimiter, ln)
|
||||
|
Reference in New Issue
Block a user