Пример #1
0
func removeSharedFile(hash string) (err error) {
	err = readConfig()
	if err != nil {
		return
	}

	err = tcp.SendAndClose(*socketPort, []byte("RM::"+hash))
	if err != nil {
		return
	}

	return
}
Пример #2
0
func shareFile(filePath string) (err error) {
	err = readConfig()
	if err != nil {
		return
	}

	err = tcp.SendAndClose(*socketPort, []byte("SHARE::"+filePath))
	if err != nil {
		return
	}

	pathHash := util.Encrypt(filePath, md.UserKey)
	fmt.Println(md.UserID + pathHash)

	return
}