From 0becf0d7fcb4c0da8faa80aca67d3c3b92e871e2 Mon Sep 17 00:00:00 2001 From: NI Date: Mon, 19 Aug 2019 21:34:25 +0800 Subject: [PATCH] Rename CommandConfiguration to Configuration --- application/command/commander.go | 6 +++--- application/command/commands.go | 4 ++-- application/command/handler.go | 4 ++-- application/command/handler_echo_test.go | 2 +- application/command/handler_stream_test.go | 4 ++-- application/command/streams.go | 2 +- application/commands/ssh.go | 4 ++-- application/commands/telnet.go | 4 ++-- application/controller/socket.go | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/application/command/commander.go b/application/command/commander.go index 174f676a..e94291e0 100644 --- a/application/command/commander.go +++ b/application/command/commander.go @@ -27,8 +27,8 @@ import ( "github.com/niruix/sshwifty/application/rw" ) -// CommandConfiguration contains configuration data needed to run command -type CommandConfiguration struct { +// Configuration contains configuration data needed to run command +type Configuration struct { Dial network.Dial DialTimeout time.Duration } @@ -47,7 +47,7 @@ func New(cs Commands) Commander { // New Adds a new client func (c Commander) New( - cfg CommandConfiguration, + cfg Configuration, receiver rw.FetchReader, sender io.Writer, senderLock *sync.Mutex, diff --git a/application/command/commands.go b/application/command/commands.go index 8e20942a..63f8ed6f 100644 --- a/application/command/commands.go +++ b/application/command/commands.go @@ -39,7 +39,7 @@ var ( type Command func( l log.Logger, w StreamResponder, - cfg CommandConfiguration, + cfg Configuration, ) FSMMachine // Commands contains data of all commands @@ -63,7 +63,7 @@ func (c Commands) Run( id byte, l log.Logger, w StreamResponder, - cfg CommandConfiguration) (FSM, error) { + cfg Configuration) (FSM, error) { if id > MaxCommandID { return FSM{}, ErrCommandRunUndefinedCommand } diff --git a/application/command/handler.go b/application/command/handler.go index 7fddb7a4..95a7049e 100644 --- a/application/command/handler.go +++ b/application/command/handler.go @@ -104,7 +104,7 @@ func (h streamHandlerSender) Write(b []byte) (int, error) { // Handler client stream control type Handler struct { - cfg CommandConfiguration + cfg Configuration commands *Commands receiver rw.FetchReader sender handlerSender @@ -117,7 +117,7 @@ type Handler struct { } func newHandler( - cfg CommandConfiguration, + cfg Configuration, commands *Commands, receiver rw.FetchReader, sender io.Writer, diff --git a/application/command/handler_echo_test.go b/application/command/handler_echo_test.go index e3a657f3..9ef0fc94 100644 --- a/application/command/handler_echo_test.go +++ b/application/command/handler_echo_test.go @@ -78,7 +78,7 @@ func TestHandlerHandleEcho(t *testing.T) { } lock := sync.Mutex{} handler := newHandler( - CommandConfiguration{}, + Configuration{}, nil, rw.NewFetchReader(testDummyFetchGen(s)), &w, diff --git a/application/command/handler_stream_test.go b/application/command/handler_stream_test.go index 406334c2..2bf112e2 100644 --- a/application/command/handler_stream_test.go +++ b/application/command/handler_stream_test.go @@ -68,7 +68,7 @@ type dummyStreamCommand struct { func newDummyStreamCommand( l log.Logger, w StreamResponder, - cfg CommandConfiguration, + cfg Configuration, ) FSMMachine { return &dummyStreamCommand{ lock: sync.Mutex{}, @@ -180,7 +180,7 @@ func TestHandlerHandleStream(t *testing.T) { lock := sync.Mutex{} hhd := newHandler( - CommandConfiguration{}, + Configuration{}, &cmds, rw.NewFetchReader(readerSource), wBuffer, diff --git a/application/command/streams.go b/application/command/streams.go index 475cbfb2..31ca9ff2 100644 --- a/application/command/streams.go +++ b/application/command/streams.go @@ -341,7 +341,7 @@ func (c *stream) reinit( w streamHandlerSender, l log.Logger, cc *Commands, - cfg CommandConfiguration, + cfg Configuration, b []byte, ) error { hd := streamInitialHeader{} diff --git a/application/commands/ssh.go b/application/commands/ssh.go index e482f8ea..5910aafc 100644 --- a/application/commands/ssh.go +++ b/application/commands/ssh.go @@ -166,7 +166,7 @@ func (s sshRemoteConn) isValid() bool { type sshClient struct { w command.StreamResponder l log.Logger - cfg command.CommandConfiguration + cfg command.Configuration remoteCloseWait sync.WaitGroup credentialReceive chan []byte credentialProcessed bool @@ -181,7 +181,7 @@ type sshClient struct { func newSSH( l log.Logger, w command.StreamResponder, - cfg command.CommandConfiguration, + cfg command.Configuration, ) command.FSMMachine { return &sshClient{ w: w, diff --git a/application/commands/telnet.go b/application/commands/telnet.go index 08b33680..7e50ddff 100644 --- a/application/commands/telnet.go +++ b/application/commands/telnet.go @@ -48,7 +48,7 @@ const ( type telnetClient struct { l log.Logger w command.StreamResponder - cfg command.CommandConfiguration + cfg command.Configuration remoteChan chan io.WriteCloser remoteConn io.WriteCloser closeWait sync.WaitGroup @@ -57,7 +57,7 @@ type telnetClient struct { func newTelnet( l log.Logger, w command.StreamResponder, - cfg command.CommandConfiguration, + cfg command.Configuration, ) command.FSMMachine { return &telnetClient{ l: l, diff --git a/application/controller/socket.go b/application/controller/socket.go index cfe59d5e..4b792137 100644 --- a/application/controller/socket.go +++ b/application/controller/socket.go @@ -362,7 +362,7 @@ func (s socket) Get( senderLock := sync.Mutex{} cmdExec, cmdExecErr := s.commander.New( - command.CommandConfiguration{ + command.Configuration{ Dial: s.commonCfg.Dialer, DialTimeout: s.commonCfg.DecideDialTimeout(s.serverCfg.ReadTimeout), },