Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert conn time limit #95

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,6 @@ Usage of /home/user/go/bin/dumbproxy:
enable TLS and use certificate
-ciphers string
colon-separated list of enabled ciphers
-conn-time-limit duration
hard time limit for connections (default 6h0m0s)
-disable-http2
disable HTTP2
-hmac-genkey
Expand Down
12 changes: 0 additions & 12 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"bytes"
"context"
"crypto/rand"
"crypto/tls"
"crypto/x509"
Expand Down Expand Up @@ -156,7 +155,6 @@ type CLIArgs struct {
bwLimit uint64
bwBuckets uint
bwSeparate bool
connTimeLimit time.Duration
reqHeaderTimeout time.Duration
}

Expand Down Expand Up @@ -199,7 +197,6 @@ func parse_args() CLIArgs {
flag.Uint64Var(&args.bwLimit, "bw-limit", 0, "per-user bandwidth limit in bytes per second")
flag.UintVar(&args.bwBuckets, "bw-limit-buckets", 1024*1024, "number of buckets of bandwidth limit")
flag.BoolVar(&args.bwSeparate, "bw-limit-separate", false, "separate upload and download bandwidth limits")
flag.DurationVar(&args.connTimeLimit, "conn-time-limit", 6*time.Hour, "hard time limit for connections")
flag.DurationVar(&args.reqHeaderTimeout, "req-header-timeout", 30*time.Second, "amount of time allowed to read request headers")
flag.Parse()
args.positionalArgs = flag.Args()
Expand Down Expand Up @@ -270,14 +267,6 @@ func run() int {
d = newDialer
}

var srvConnContext func(ctx context.Context, c net.Conn) context.Context
if args.connTimeLimit > 0 {
srvConnContext = func(ctx context.Context, c net.Conn) context.Context {
newCtx, _ := context.WithTimeout(ctx, args.connTimeLimit)
return newCtx
}
}

forwarder := forward.PairConnections
if args.bwLimit != 0 {
forwarder = forward.NewBWLimit(
Expand All @@ -301,7 +290,6 @@ func run() int {
ReadHeaderTimeout: args.reqHeaderTimeout,
WriteTimeout: 0,
IdleTimeout: 0,
ConnContext: srvConnContext,
}

if args.disableHTTP2 {
Expand Down
Loading