mirror of
https://github.com/bolucat/Archive.git
synced 2025-12-24 13:28:37 +08:00
Update On Fri Jul 5 20:32:55 CEST 2024
This commit is contained in:
@@ -87,6 +87,11 @@ func (b *baseTransporter) RelayTCPConn(c net.Conn, handshakeF TCPHandShakeF) err
|
||||
}
|
||||
}
|
||||
|
||||
// rate limit
|
||||
if b.cfg.MaxReadRateKbps > 0 {
|
||||
c = conn.NewRateLimitedConn(c, b.cfg.MaxReadRateKbps)
|
||||
}
|
||||
|
||||
clonedRemote := remote.Clone()
|
||||
rc, err := handshakeF(clonedRemote)
|
||||
if err != nil {
|
||||
@@ -94,11 +99,6 @@ func (b *baseTransporter) RelayTCPConn(c net.Conn, handshakeF TCPHandShakeF) err
|
||||
}
|
||||
defer rc.Close()
|
||||
|
||||
// rate limit
|
||||
if b.cfg.MaxReadRateKbps > 0 {
|
||||
c = conn.NewRateLimitedConn(c, b.cfg.MaxReadRateKbps)
|
||||
}
|
||||
|
||||
b.l.Infof("RelayTCPConn from %s to %s", c.LocalAddr(), remote.Address)
|
||||
relayConn := conn.NewRelayConn(
|
||||
b.cfg.Label, c, rc, conn.WithHandshakeDuration(clonedRemote.HandShakeDuration))
|
||||
|
||||
@@ -59,8 +59,7 @@ func (raw *RawClient) HealthCheck(ctx context.Context, remote *lb.Node) error {
|
||||
|
||||
type RawServer struct {
|
||||
*baseTransporter
|
||||
localTCPAddr *net.TCPAddr
|
||||
lis *net.TCPListener
|
||||
lis *net.TCPListener
|
||||
}
|
||||
|
||||
func newRawServer(base *baseTransporter) (*RawServer, error) {
|
||||
@@ -75,7 +74,6 @@ func newRawServer(base *baseTransporter) (*RawServer, error) {
|
||||
return &RawServer{
|
||||
lis: lis,
|
||||
baseTransporter: base,
|
||||
localTCPAddr: addr,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user