Categorygithub.com/cydev/hath
modulepackage
0.0.22
Repository: https://github.com/cydev/hath.git
Documentation: pkg.go.dev

# README

hath

Hath client in golang

Build status Build Status Coverage Status GoDoc License

Status

Near alpha stage, client is already usable, but lacks testing

Tested by me Client stats

Unit-tested on linux and windows;

Tested on real workload by ernado on ubuntu 15.04 and windows 8.1 x64

Using

Download client, copy to cache folder and start.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

FileFromBytes deserializes byte slice into file.
FileFromBytesTo deserializes byte slice into file by pointer.
FileFromID generates new File from provided ID.
FromRequest extracts the user IP address from req, if present.
GetRoughCacheSize is cache size estimation based on average file size.
IsUnexpected return true if err is ErrUnexpected or ErrClientUnexpectedResponse.
NewClient creates new client for api.
NewDB new db.
NewDirectFrontend create direct frontend.
No description provided by the author
NewServer cleares default server with provided client and frontend.
ParseArgs parses arguments from string arg1=val1;arg2=val2.
ParseFileType returns FileType from string.
ParseStaticRange parses hex string static range start.
UnmarshalFile deserializes file info fron byte array.
UnmarshalFileTo deserializes file info fron byte array by pointer.

# Constants

EventAdded issued when file is added to cache.
EventDownloaded issued when file is downloaded by server from hath.
EventRemoved issued when file is removed from cache.
EventSent issued when file is sent to hath network.
FileMaximumSize is maximum image size in hath.
GIF animation.
HashSize is length of sha1 hash in bytes.
JPG image.
PNG image.
5.
4.
starts with 1.
3.
2.
UnknownImage is not supported format.

# Variables

ContentTypes is map of file types to conent types.
ErrClientFailedConnectionTest client failed to response on test correctly.
ErrClientKeyExpired timestampt drift occured.
ErrClientOtherConnected other client with same clientID connected.
ErrClientStartupFlood api rpc server flood protection is enabled client should wait.
ErrClientUnexpectedResponse unexpected/unhandler error.
ErrClientVersionOld api outdated.
ErrFileBadLength means that file size does not equals read size.
ErrFileInconsistent should be returned if file failed to check sha1 hash.
ErrFileNotFound should be returned when file does not exist in frontend.
ErrFileTypeUnknown when FileType is UnknownImage.
ErrHashBadLength when hash size is not HashSize.
ErrNoFilesToRemove is flag that there is 0 files to remove.
ErrTimeDesync timestamp delta too bit.
FileTypes list for allowerd images.
FileTypesN count of FileTypes.
LocalNetworks is slice of net.IPNet for all local networks subnets.

# Structs

APIResponse represents response from rpc api.
BoltDB stores info about files in cache stores data in b-tree structure stores index on LastUsage+Hash implements DataBase interface.
Client is api for hath rpc.
ClientConfig is configuration for client.
Credentials of hath client.
DefaultServer uses hard drive to respond.
DirectFrontend is frontend that uses DirectCache.
ErrUnexpected error while processing request/response.
Event from server.
File is hath file representation total 20 + 4 + 2 + 2 + 1 + 8 + 1 = 38 bytes in memory = 56 bytes.
FileCache serves files from disk no internal buffering, caching or rate limiting is done and should be implement separetaly.
FileGenerator is factory for random files.
Progress represents status of some ongoing operation.
ServerConfig cfg for server.
Settings of hath client.
Stats for server.

# Interfaces

DataBase is interface for storing info about files in some DB.
DirectCache is engine for serving files in hath directly from block devices i.e.
Frontend is cache backend that should processes requests to specidif files, returning them with correct headers and processing IO errors.
HTTPClient is underlying http client.
Server should handle requests from users (and rpc?) speedtests server commands: /servercmd/<command>/<additional:kwds>/<timestamp:int>/<key>' image file request: /h/<fileid>/<additional:kwds>/<filename>.

# Type aliases

Args represents additional arguments in request string.
EventType is type of event from server.
FileType represents file format of image.
ProxyMode sets proxy security politics.
StaticRange is prefix for static ranges assigned to user.
StaticRanges contain ranges.
Vars represents k-v map from APIResponse.Data.