Skip to content

Commit

Permalink
Rename CommandConfiguration to Configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
NI committed Aug 19, 2019
1 parent 1070c2b commit 0becf0d
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions application/command/commander.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions application/command/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var (
type Command func(
l log.Logger,
w StreamResponder,
cfg CommandConfiguration,
cfg Configuration,
) FSMMachine

// Commands contains data of all commands
Expand All @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions application/command/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -117,7 +117,7 @@ type Handler struct {
}

func newHandler(
cfg CommandConfiguration,
cfg Configuration,
commands *Commands,
receiver rw.FetchReader,
sender io.Writer,
Expand Down
2 changes: 1 addition & 1 deletion application/command/handler_echo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestHandlerHandleEcho(t *testing.T) {
}
lock := sync.Mutex{}
handler := newHandler(
CommandConfiguration{},
Configuration{},
nil,
rw.NewFetchReader(testDummyFetchGen(s)),
&w,
Expand Down
4 changes: 2 additions & 2 deletions application/command/handler_stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ type dummyStreamCommand struct {
func newDummyStreamCommand(
l log.Logger,
w StreamResponder,
cfg CommandConfiguration,
cfg Configuration,
) FSMMachine {
return &dummyStreamCommand{
lock: sync.Mutex{},
Expand Down Expand Up @@ -180,7 +180,7 @@ func TestHandlerHandleStream(t *testing.T) {

lock := sync.Mutex{}
hhd := newHandler(
CommandConfiguration{},
Configuration{},
&cmds,
rw.NewFetchReader(readerSource),
wBuffer,
Expand Down
2 changes: 1 addition & 1 deletion application/command/streams.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func (c *stream) reinit(
w streamHandlerSender,
l log.Logger,
cc *Commands,
cfg CommandConfiguration,
cfg Configuration,
b []byte,
) error {
hd := streamInitialHeader{}
Expand Down
4 changes: 2 additions & 2 deletions application/commands/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions application/commands/telnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion application/controller/socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
},
Expand Down

0 comments on commit 0becf0d

Please sign in to comment.