Rename CommandConfiguration to Configuration
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -78,7 +78,7 @@ func TestHandlerHandleEcho(t *testing.T) {
|
||||
}
|
||||
lock := sync.Mutex{}
|
||||
handler := newHandler(
|
||||
CommandConfiguration{},
|
||||
Configuration{},
|
||||
nil,
|
||||
rw.NewFetchReader(testDummyFetchGen(s)),
|
||||
&w,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -341,7 +341,7 @@ func (c *stream) reinit(
|
||||
w streamHandlerSender,
|
||||
l log.Logger,
|
||||
cc *Commands,
|
||||
cfg CommandConfiguration,
|
||||
cfg Configuration,
|
||||
b []byte,
|
||||
) error {
|
||||
hd := streamInitialHeader{}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user