diff options
Diffstat (limited to 'clients/tailclient.go')
| -rw-r--r-- | clients/tailclient.go | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/clients/tailclient.go b/clients/tailclient.go deleted file mode 100644 index cb93258..0000000 --- a/clients/tailclient.go +++ /dev/null @@ -1,44 +0,0 @@ -package clients - -import ( - "dtail/clients/handlers" - "dtail/clients/remote" - "dtail/ssh/client" - "fmt" - "strings" - - gossh "golang.org/x/crypto/ssh" -) - -// TailClient is used for tailing remote log files (opening, seeking to the end and returning only new incoming lines). -type TailClient struct { - baseClient -} - -// NewTailClient returns a new TailClient. -func NewTailClient(args Args) (*TailClient, error) { - c := TailClient{ - baseClient: baseClient{ - Args: args, - stop: make(chan struct{}), - stopped: make(chan struct{}), - throttleCh: make(chan struct{}, args.MaxInitConnections), - retry: true, - }, - } - - c.init(c) - - return &c, nil -} - -func (c TailClient) makeConnection(server string, sshAuthMethods []gossh.AuthMethod, hostKeyCallback *client.HostKeyCallback) *remote.Connection { - conn := remote.NewConnection(server, c.UserName, sshAuthMethods, hostKeyCallback) - conn.Handler = handlers.NewClientHandler(server, c.PingTimeout) - - for _, file := range strings.Split(c.Files, ",") { - conn.Commands = append(conn.Commands, fmt.Sprintf("%s %s regex %s", c.Mode.String(), file, c.Regex)) - } - - return conn -} |
