simple-storage

command module
v0.0.0-...-f6a5d6d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2022 License: GPL-3.0 Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

simple-storage

Simple Golang storage server

Command Line

./simple-storage -l ip:port -k authkeyhex -p /route1=/path1 -s /route2=/path2 ...
  • -l: listening ip&port
  • -k: 16 bytes hex key for TEA encryption
  • -p: add a set-encrypted route to serve files under path
  • -s: add an all-encrypted route to serve files under path

Query

http://server.com/routex?arg=[argument]&name=[filename]&key=[filemd5]
  • argument: has/lst/get/set
  • name: filename to has/lst/get/set
  • key: md5 of file to set
Request
  • set: post method with TEA encrypted data in body
  • others: get method with query above
Response
  • has: 17 bytes data, the first byte is 00(not exist) or 01(exist), others are file md5
  • lst: json object of {filename: md5 bytes}
  • get: file data in body and md5 in header
  • set: success or exist
Secure Response
  • has: tea-encrypted data
  • lst: tea-encrypted data
  • get: tea-encrypted data in body and md5 in header
  • set: success or exist

Client

There is a client at ./client, you should use it to access simple-storage

// NewClient key is 16 bytes hex string
func NewClient(apiurl, key string) *Client

// IsFileExist return status, md5, error
func (c *Client) IsFileExist(folder, name string) (bool, *[16]byte, error)

// ListFiles return map[name]md5, error
func (c *Client) ListFiles(folder string) (m map[string][16]byte, err error)

// GetFile return data, md5, error
func (c *Client) GetFile(folder, name string) ([]byte, *[16]byte, error)

// SetFile return error
func (c *Client) SetFile(folder, name string, data []byte) error

secure version

// IsFileExist return status, md5, error
func (c *Client) IsSecureFileExist(folder, name string) (bool, *[16]byte, error)

// ListFiles return map[name]md5, error
func (c *Client) ListSecureFiles(folder string) (m map[string][16]byte, err error)

// GetFile return data, md5, error
func (c *Client) GetSecureFile(folder, name string) ([]byte, *[16]byte, error)

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址