mirror of
https://github.com/gravitational/teleport.git
synced 2026-11-01 21:52:02 +08:00
* switch underlying protocol used for 'tsh scp' to SFTP * address TODO * appease linter * add method to make it easier for other callers to transfer files * add tests * print transfer progress with progress bar by default Also allow a SIGINT to gracefully stop the SFTP connection. This is necessary because the progress bar will ignore signals and prevent the process from exiting. * address SFTP fork issues * make tests less flakey * fix specifying dir for dst not copying files to correct paths * make tests less flakey (again) * don't check file access times, often differs when run in CI * few small fixes from review, simplify Create method now that HTTP FS isn't needed * create dst files and dirs with src mode * improved error messages when doing file operations * expand home dirs in remote paths * addressed more feedback * add license to get_home_dir.go * address minor feedback of tests, add home dir expansion test * update sftp fork to point to latest commit on master branch * addressed feedback * don't cache home dir lookups, only one remote path can ever be used
29 lines
786 B
Go
29 lines
786 B
Go
/*
|
|
Copyright 2020 Gravitational, Inc.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package scp
|
|
|
|
import (
|
|
"os"
|
|
"syscall"
|
|
"time"
|
|
)
|
|
|
|
// Source: os/types_windows.go
|
|
func GetAtime(fi os.FileInfo) time.Time {
|
|
return time.Unix(0, fi.Sys().(*syscall.Win32FileAttributeData).LastAccessTime.Nanoseconds())
|
|
}
|