Make DialTimeout configurable.

This commit is contained in:
NI
2019-08-12 23:50:24 +08:00
parent db633f59bd
commit f3336d61a0
17 changed files with 173 additions and 119 deletions

View File

@@ -27,6 +27,12 @@ import (
"github.com/niruix/sshwifty/application/rw"
)
// CommandConfiguration contains configuration data needed to run command
type CommandConfiguration struct {
Dial network.Dial
DialTimeout time.Duration
}
// Commander command control
type Commander struct {
commands Commands
@@ -41,7 +47,7 @@ func New(cs Commands) Commander {
// New Adds a new client
func (c Commander) New(
dialer network.Dial,
cfg CommandConfiguration,
receiver rw.FetchReader,
sender io.Writer,
senderLock *sync.Mutex,
@@ -50,7 +56,7 @@ func (c Commander) New(
l log.Logger,
) (Handler, error) {
return newHandler(
dialer,
cfg,
&c.commands,
receiver,
sender,