Documentation ¶
Index ¶
- type Server
- func (s *Server) AddFile(content []byte) (int, error)
- func (s *Server) GetFile(docID int) ([]byte, error)
- func (s *Server) GetKeyHalf(clientNum int) []byte
- func (s *Server) GetNumClients() int
- func (s *Server) GetSalts() [][]byte
- func (s *Server) GetSize() uint64
- func (s *Server) PrintServerInfo()
- func (s *Server) ReadLookupTable() ([]byte, bool)
- func (s *Server) SearchWord(trapdoors [][]byte) []int
- func (s *Server) WriteIndex(si index.SecureIndex) error
- func (s *Server) WriteLookupTable(content []byte)
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 ¶
LoadServer initializes a Server by reading the metadata stored at `directory` and restoring the server status.
func (*Server) AddFile ¶
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 ¶
GetFile returns the content of the document with `docID`. Behavior is undefined if the docID is invalid (out of range).
func (*Server) GetKeyHalf ¶
GetKeyHalf returns the server-side key half for client with `clientNum`. Behavior is undefined if `clientNum` is invalid (out of range).
func (*Server) GetNumClients ¶
GetNumClients returns the number of clients for this server.
func (*Server) PrintServerInfo ¶
func (s *Server) PrintServerInfo()
PrintServerInfo prints out the basic information of the server.
func (*Server) ReadLookupTable ¶
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 ¶
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 ¶
WriteLookupTable writes `content` to the file "lookupTable".