mirror of
https://github.com/zrepl/zrepl.git
synced 2025-08-16 18:01:02 +02:00
cmd: support logging reads & writes from sshbytestream to a file.
This commit is contained in:
@ -7,6 +7,7 @@ import (
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"github.com/zrepl/zrepl/rpc"
|
||||
"github.com/zrepl/zrepl/sshbytestream"
|
||||
. "github.com/zrepl/zrepl/util"
|
||||
"github.com/zrepl/zrepl/zfs"
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
"io"
|
||||
@ -37,6 +38,8 @@ type SSHTransport struct {
|
||||
TransportOpenCommand []string `mapstructure:"transport_open_command"`
|
||||
SSHCommand string `mapstructure:"ssh_command"`
|
||||
Options []string
|
||||
ConnLogReadFile string `mapstructure:"connlog_read_file"`
|
||||
ConnLogWriteFile string `mapstructure:"connlog_write_file"`
|
||||
}
|
||||
|
||||
type InitialReplPolicy string
|
||||
@ -393,6 +396,10 @@ func (t SSHTransport) Connect() (r rpc.RPCRequester, err error) {
|
||||
if stream, err = sshbytestream.Outgoing(rpcTransport); err != nil {
|
||||
return
|
||||
}
|
||||
stream, err = NewReadWriteCloserLogger(stream, t.ConnLogReadFile, t.ConnLogWriteFile)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return rpc.ConnectByteStreamRPC(stream)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user