|
|
@@ -27,6 +27,7 @@ type Proxy struct {
|
|
27
|
27
|
|
|
28
|
28
|
allowFallbackOnUnknownDC bool
|
|
29
|
29
|
tolerateTimeSkewness time.Duration
|
|
|
30
|
+ idleTimeout time.Duration
|
|
30
|
31
|
domainFrontingPort int
|
|
31
|
32
|
domainFrontingIP string
|
|
32
|
33
|
domainFrontingProxyProtocol bool
|
|
|
@@ -151,6 +152,7 @@ func (p *Proxy) Serve(listener net.Listener) error {
|
|
151
|
152
|
case errors.Is(err, ants.ErrPoolClosed):
|
|
152
|
153
|
return nil
|
|
153
|
154
|
case errors.Is(err, ants.ErrPoolOverload):
|
|
|
155
|
+ conn.Close() //nolint: errcheck
|
|
154
|
156
|
logger.Info("connection was concurrency limited")
|
|
155
|
157
|
p.eventStream.Send(p.ctx, NewEventConcurrencyLimited())
|
|
156
|
158
|
}
|
|
|
@@ -306,8 +308,8 @@ func (p *Proxy) doDomainFronting(ctx *streamContext, conn *connRewind) {
|
|
306
|
308
|
relay.Relay(
|
|
307
|
309
|
ctx,
|
|
308
|
310
|
ctx.logger.Named("domain-fronting"),
|
|
309
|
|
- frontConn,
|
|
310
|
|
- conn,
|
|
|
311
|
+ connIdleTimeout{Conn: frontConn, timeout: p.idleTimeout},
|
|
|
312
|
+ connIdleTimeout{Conn: conn, timeout: p.idleTimeout},
|
|
311
|
313
|
)
|
|
312
|
314
|
}
|
|
313
|
315
|
|
|
|
@@ -339,6 +341,7 @@ func NewProxy(opts ProxyOpts) (*Proxy, error) {
|
|
339
|
341
|
domainFrontingPort: opts.getDomainFrontingPort(),
|
|
340
|
342
|
domainFrontingIP: opts.DomainFrontingIP,
|
|
341
|
343
|
tolerateTimeSkewness: opts.getTolerateTimeSkewness(),
|
|
|
344
|
+ idleTimeout: opts.getIdleTimeout(),
|
|
342
|
345
|
allowFallbackOnUnknownDC: opts.AllowFallbackOnUnknownDC,
|
|
343
|
346
|
telegram: tg,
|
|
344
|
347
|
doppelGanger: doppel.NewGanger(
|