Documentation ¶
Index ¶
- Constants
- func AddPathToAllOtherClients(UserCollection *mgo.Collection, username string, Source_RSA_Public_Key string, ...) error
- func AddPathToReceive(UserCollection *mgo.Collection, username string, RSA_Public_Key string, ...) error
- func ClientExists(UserCollection *mgo.Collection, username string, RSA_Public_Key string) (bool, error)
- func EmailExists(UserCollection *mgo.Collection, email string) bool
- func GetActivationKey(UserCollection *mgo.Collection, username string) (activation_key string, err error)
- func InitClient(UserCollection *mgo.Collection, username string, RSA_Public_Key string) (int64, error)
- func InsertClient(UserCollection *mgo.Collection, username string, client Client) error
- func RemovePathFromClient(UserCollection *mgo.Collection, username string, RSA_Public_Key string, ...) error
- func SignupUser(UserCollection, MetadataCollection *mgo.Collection, ...) error
- func UpdateCurrentlyBeingUsed(UserCollection *mgo.Collection, username string, RSA_Public_Key string, ...) error
- func UpdateLastAccessedTime(UserCollection *mgo.Collection, username string, public_key string, ...) error
- func UsernameExists(UserCollection *mgo.Collection, username string) bool
- func ValidatePassword(collection *mgo.Collection, username string, password string) (bool, error)
- type Client
- type ClientContainer
- type FileMetadata
- type FileQueue
- type User
- type UserFiles
Constants ¶
const (
DEFAULT_STORAGE_BYTES = 1073741824 // 1 gigabyte
)
Variables ¶
This section is empty.
Functions ¶
func AddPathToAllOtherClients ¶
func AddPathToAllOtherClients(UserCollection *mgo.Collection, username string, Source_RSA_Public_Key string, metadata FileMetadata, operation_int int) error
AddPathToAllOtherClients queues the files to be sent to all other clients.
func AddPathToReceive ¶
func AddPathToReceive(UserCollection *mgo.Collection, username string, RSA_Public_Key string, metadata FileMetadata, operation_int int) error
AddPathToReceive queues a file to be sent to the client.
func ClientExists ¶
func ClientExists(UserCollection *mgo.Collection, username string, RSA_Public_Key string) (bool, error)
ClientExists returns true if the given client has already been used by the user.
func EmailExists ¶
UsernameExists checks if the given email already exists in the collection.
func GetActivationKey ¶
func GetActivationKey(UserCollection *mgo.Collection, username string) (activation_key string, err error)
GetActivationKey returns the activation key for the given account.
func InitClient ¶
func InsertClient ¶
InsertClient inserts a client with the given information into the clients list of the user.
func RemovePathFromClient ¶
func RemovePathFromClient(UserCollection *mgo.Collection, username string, RSA_Public_Key string, path string) error
AddPathToReceive removes a file from the queue.
func SignupUser ¶
func SignupUser(UserCollection, MetadataCollection *mgo.Collection, username, email, password_hash string) error
SignupUser creates a user with the given username, email, and password hash.
func UpdateCurrentlyBeingUsed ¶
func UpdateCurrentlyBeingUsed(UserCollection *mgo.Collection, username string, RSA_Public_Key string, currently_being_used bool) error
UpdateCurrentlyBeingUsed sets the current state of the currently_being_used variable to the value given.
func UpdateLastAccessedTime ¶
func UpdateLastAccessedTime(UserCollection *mgo.Collection, username string, public_key string, timeout int64) error
UpdateLastAccessedTime updates the last accessed time of the client.
func UsernameExists ¶
UsernameExists checks if the given username already exists in the collection.
Types ¶
type Client ¶
type Client struct { Public_Key string `bson: "public_key"` Currently_being_used bool `bson: "currently_being_used"` Last_accessed int64 `bson: "last_accessed"` Files_to_receive []FileQueue `bson: "files_to_receive"` }
Client stores the name, IP address, and usage time of a computer.
func GetAllClients ¶
GetAllClients returns a list of all clients for a user.
type ClientContainer ¶
type ClientContainer struct {
Clients []Client `bson: "client"`
}
A container used for internal functions.
type FileMetadata ¶
type FileMetadata struct { Path string `bson: "path"` Is_dir bool `bson: "is_dir"` Modification_time int64 `bson: "modification_time"` Size int64 `bson: "size"` }
FileMetadata stores the metadata for each file.
type FileQueue ¶
type FileQueue struct { Path string `bson: "path"` Is_dir bool `bson: "is_dir"` Modification_time int64 `bson: "modification_time"` Size int64 `bson: "size"` Operation_int int `bson: "operation_int"` }
FileQueue is the information the server needs to send a file to client.
type User ¶
type User struct { // Auth info Username string `bson: "username"` Password_hash string `bson: "password_hash"` Email string `bson: "email"` // A key that symmetrically encrypts the user's encryption key. // Sent to user over TLS on session start, decrypts their file key. Activation_key string `bson: "activation_key"` // Usage info Clients []Client `bson: "clients"` Current_storage_usage int64 `bson: "current_storage_usage"` Max_storage_possible int64 `bson: "max_storage_possible"` }
User (collection item) specifies the information kept for each user.
type UserFiles ¶
type UserFiles struct { Username string `bson: "username"` User_file_metadata []FileMetadata `bson: "user_file_metadata"` }
UserFiles stores all the metadata for a user's files.