server

package
v0.0.0-...-1fd911f Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2016 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server contains all the necessary information for a running server.

func CreateServer

func CreateServer(numClients, lenMS, lenSalt int, directory string, fpRate float64, numUniqWords uint64) (s *Server, err error)

CreateServer initializes a server with `numClients` clients with a master secret of length `lenMS`, and generate salts with length `lenSalt`. The number of salts is given by `r = -log2(fpRate)`, where `fpRate` is the desired false positive rate of the system. `directory` determines where the server files will be stored. Returns an error if the salt cannot be properly generated.

func CreateServerWithNetConfig

func CreateServerWithNetConfig(numClients, lenMS, lenSalt int, directory string, fpRate float64, numUniqWords uint64, latency time.Duration, bandwidth int) (*Server, error)

CreateServerWithNetConfig behaves the same as `CreateServer`, except for that it also sets the network parameters for the server.

func LoadServer

func LoadServer(directory string) *Server

LoadServer initializes a Server by reading the metadata stored at `directory` and restoring the server status.

func (*Server) AddFile

func (s *Server) AddFile(content []byte) (int, error)

AddFile adds a file with `content` to the server with the document ID equal to the number of files currently in the server and updates the count. Returns the document ID.

func (*Server) GetFile

func (s *Server) GetFile(docID int) ([]byte, error)

GetFile returns the content of the document with `docID`. Behavior is undefined if the docID is invalid (out of range).

func (*Server) GetKeyHalf

func (s *Server) GetKeyHalf(clientNum int) []byte

GetKeyHalf returns the server-side key half for client with `clientNum`. Behavior is undefined if `clientNum` is invalid (out of range).

func (*Server) GetNumClients

func (s *Server) GetNumClients() int

GetNumClients returns the number of clients for this server.

func (*Server) GetSalts

func (s *Server) GetSalts() [][]byte

GetSalts returns the salts to the client.

func (*Server) GetSize

func (s *Server) GetSize() uint64

GetSize returns the size of the indexes on the server.

func (*Server) PrintServerInfo

func (s *Server) PrintServerInfo()

PrintServerInfo prints out the basic information of the server.

func (*Server) ReadLookupTable

func (s *Server) ReadLookupTable() ([]byte, bool)

ReadLookupTable reads the content in the file "lookupTable" and returns it in a byte slice. If not found, returns false as the second return value.

func (*Server) SearchWord

func (s *Server) SearchWord(trapdoors [][]byte) []int

SearchWord searches the server for a word with `trapdoors`. Returns a list of document ids of files possibly containing the word in increasing order.

func (*Server) WriteIndex

func (s *Server) WriteIndex(si index.SecureIndex) error

WriteIndex writes a SecureIndex to the disk of the server.

func (*Server) WriteLookupTable

func (s *Server) WriteLookupTable(content []byte)

WriteLookupTable writes `content` to the file "lookupTable".

Jump to

Keyboard shortcuts

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