Skip to content

Commit

Permalink
ADD: relay dial timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
go-compile committed May 12, 2022
1 parent c33c1c0 commit f6b7b22
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions cmd/localrelay/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import (
"os"
"strconv"
"strings"
"time"

"github.com/go-compile/localrelay"
"github.com/pkg/errors"
)

var (
// ErrFailedCheckUpdate is returned when the latest version could not be fetched
ErrFailedCheckUpdate = errors.New("failed to check for updates")
)

Expand Down Expand Up @@ -59,6 +61,19 @@ func parseArgs() (*options, error) {
}

opt.host = value
case "timeout":
value, err := getAnswer(args, arg, &i)
if err != nil {
return nil, err
}

dur, err := time.ParseDuration(value)
if err != nil {
return nil, err
}

fmt.Printf("Timeout set to: %dms\n", dur.Milliseconds())
localrelay.Timeout = dur
case "destination", "d", "dst", "rhost":
value, err := getAnswer(args, arg, &i)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const (
ProxyFailOverTCP

// VERSION uses semantic versioning
VERSION = "v1.0.0"
VERSION = "v1.1.0"
)

var (
Expand Down

0 comments on commit f6b7b22

Please sign in to comment.