utils

package
v0.0.0-...-ba7cae4 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServerPort      = 1234
	ServerPort2     = 1235
	CoordinatorPort = 1237

	EmbServerPortStart = 1240
	UrlServerPortStart = 1450
)

Variables

This section is empty.

Functions

func AllFilesExist

func AllFilesExist(files []string) bool

func BytesToKB

func BytesToKB(bytes uint64) float64

func BytesToMB

func BytesToMB(bytes uint64) float64

func CallTCP

func CallTCP(c *rpc.Client, rpcname string, args interface{}, reply interface{})

func CallTLS

func CallTLS(c *rpc.Client, rpcname string, args interface{}, reply interface{})

func DialTCP

func DialTCP(addr string) *rpc.Client

func DialTLS

func DialTLS(address string) *rpc.Client

* callTLS and callTCP send an RPC to the server; then wait for the response.

func FileExists

func FileExists(file string) bool

func ListenAndServeTCP

func ListenAndServeTCP(server *rpc.Server, port int)

* serveTLS and serveTCP implement the server-side networking logic.

func ListenAndServeTLS

func ListenAndServeTLS(server *rpc.Server, port int)

func LocalAddr

func LocalAddr(port int) string

func Max

func Max(arr []uint64) uint64

func MergeHints

func MergeHints[T matrix.Elem](h *PIR_hint[T], nh PIR_hint[T])

func MessageSizeBytes

func MessageSizeBytes(m interface{}) uint64

func MessageSizeKB

func MessageSizeKB(m interface{}) float64

func MessageSizeMB

func MessageSizeMB(m interface{}) float64

func NewPirClient

func NewPirClient[T matrix.Elem](h *PIR_hint[T]) *pir.Client[T]

func NewUnderhoodClient

func NewUnderhoodClient[T matrix.Elem](h *PIR_hint[T]) *underhood.Client[T]

func OpenAppendFile

func OpenAppendFile(file string) *os.File

func OpenFile

func OpenFile(file string) *os.File

func PrintParams

func PrintParams(i *pir.DBInfo) string

func RandString

func RandString(n int) string

func RandomIndex

func RandomIndex[N Number](max N) uint64

func ReadFromChannel

func ReadFromChannel(ch chan bool, num int, verbose bool)

func ReadLineFromStdin

func ReadLineFromStdin() string

func RemoteAddr

func RemoteAddr(ip string, port int) string

func SortByScores

func SortByScores(scores []int) []uint64

func WriteFileToStdout

func WriteFileToStdout(file string)

Types

type Number

type Number interface {
	int | int64 | uint | uint64
}

type PIR_hint

type PIR_hint[T matrix.Elem] struct {
	Info pir.DBInfo
	Hint matrix.Matrix[T]

	Seeds   []rand.PRGKey
	Offsets []uint64
}

func (*PIR_hint[T]) IsEmpty

func (h *PIR_hint[T]) IsEmpty() bool

Jump to

Keyboard shortcuts

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