|
|
|
@ -24,6 +24,8 @@ type UpFileClient struct { |
|
|
|
rpcClient *rpc.Client |
|
|
|
} |
|
|
|
|
|
|
|
// todo 后续增加安全验证
|
|
|
|
|
|
|
|
// 主入口
|
|
|
|
func main() { |
|
|
|
// 启用日志
|
|
|
|
@ -66,12 +68,12 @@ func NewUpFileClient(addr string) (*UpFileClient, error) { |
|
|
|
} |
|
|
|
|
|
|
|
// 传输文件
|
|
|
|
func transferFile(c *UpFileClient, filePath string, uploadPath string) error { |
|
|
|
func transferFile(c *UpFileClient, curPath string, uploadPath string) error { |
|
|
|
|
|
|
|
// 发送文件信息
|
|
|
|
fmt.Printf("TransferFile filePath: %s, uploadPath: %s\n", filePath, uploadPath) |
|
|
|
fmt.Printf("TransferFile filePath: %s, uploadPath: %s\n", curPath, uploadPath) |
|
|
|
// 获取文件信息
|
|
|
|
fileInfo, err := os.Stat(filePath) |
|
|
|
fileInfo, err := os.Stat(curPath) |
|
|
|
if err != nil { |
|
|
|
// panic(err)
|
|
|
|
fmt.Printf("获取文件信息失败: %v\n", err) |
|
|
|
|