Rename CommandConfiguration to Configuration

This commit is contained in:
NI
2019-08-19 21:34:25 +08:00
parent 1070c2bcf2
commit 0becf0d7fc
9 changed files with 16 additions and 16 deletions

View File

@@ -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,

View File

@@ -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
}

View File

@@ -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,

View File

@@ -78,7 +78,7 @@ func TestHandlerHandleEcho(t *testing.T) {
}
lock := sync.Mutex{}
handler := newHandler(
CommandConfiguration{},
Configuration{},
nil,
rw.NewFetchReader(testDummyFetchGen(s)),
&w,

View File

@@ -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,

View File

@@ -341,7 +341,7 @@ func (c *stream) reinit(
w streamHandlerSender,
l log.Logger,
cc *Commands,
cfg CommandConfiguration,
cfg Configuration,
b []byte,
) error {
hd := streamInitialHeader{}

View File

@@ -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,

View File

@@ -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,

View File

@@ -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),
},