|
|
|
@ -19,7 +19,7 @@ type ZipBlock struct { |
|
|
|
Basepath string // 基础路径
|
|
|
|
Curpath string // 当前路径
|
|
|
|
SelFile []string // 选中的文件
|
|
|
|
RemoteIp string // 远程主机地址,带端口
|
|
|
|
RemoteAddr string // 远程主机地址,带端口
|
|
|
|
RemotePath string // 远程主机的存储路径
|
|
|
|
} |
|
|
|
|
|
|
|
@ -49,14 +49,26 @@ func SendZip(w http.ResponseWriter, r *http.Request) { |
|
|
|
return |
|
|
|
} |
|
|
|
// 获取远程服务器信息
|
|
|
|
remoteaddr := r.Form["remoteaddr"] |
|
|
|
if remoteaddr[0] == "" { |
|
|
|
http.Error(w, "remote server addr is blank!", http.StatusInternalServerError) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 远程的路径信息
|
|
|
|
remotepath := r.Form["remotepath"] |
|
|
|
if remotepath[0] == "" { |
|
|
|
http.Error(w, "remote server path is blank!", http.StatusInternalServerError) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 构建
|
|
|
|
zipblock := ZipBlock{ |
|
|
|
Basepath: "/www/wwwroot", |
|
|
|
Curpath: wtculpath[0], |
|
|
|
SelFile: zipfarr, |
|
|
|
RemoteIp: serip[0], |
|
|
|
RemotePath: "/www/wwwroot/sync_zips", |
|
|
|
RemoteAddr: remoteaddr[0], |
|
|
|
RemotePath: remotepath[0], |
|
|
|
} |
|
|
|
// 从serip 切割出ip 和端口
|
|
|
|
splitip := strings.Split(serip[0], ":") |
|
|
|
|