Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fumiama/simple-storage
Simple Golang storage server
https://github.com/fumiama/simple-storage
Last synced: 16 days ago
JSON representation
Simple Golang storage server
- Host: GitHub
- URL: https://github.com/fumiama/simple-storage
- Owner: fumiama
- License: gpl-3.0
- Created: 2022-01-05T08:48:44.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-20T14:26:30.000Z (almost 3 years ago)
- Last Synced: 2024-10-30T17:08:51.645Z (2 months ago)
- Language: Go
- Size: 52.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# simple-storage
Simple Golang storage server## Command Line
```bash
./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
```bash
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```go
// 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
```go
// 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)
```