server

package
v0.0.0-...-35419fc Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBloomCheckFailure = errors.New("fail to check Bloom, which means noise loss and adversary possibility")
View Source
var ErrBootstrapInvalidPConfigOKSignal = errors.New("invalid bootstrap_pconfig_ok signal: not 1")
View Source
var ErrPublicIPNotFound = errors.New("public IP not found in body returned by Cloudflare")

Functions

This section is empty.

Types

type Client

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

TODO: Replace this dummy Client as real impl

func NewClient

func NewClient(c ClientConfig) *Client

func (*Client) RunRound

func (c *Client) RunRound() ([]byte, error)

TODO: Replace this dummy runRound as real impl

type ClientConfig

type ClientConfig struct {
	PK, SK *[32]byte

	PCs      map[string]rpc.PConfig
	LayerIdx map[int][]string
}

type Server

type Server struct {
	rpc.UnimplementedServerRPCServer
	// contains filtered or unexported fields
}

func NewServer

func NewServer(c ServerConfig) *Server

func (*Server) Bootstrap

func (s *Server) Bootstrap(ctx context.Context) error

func (*Server) CheckBloom

func (s *Server) CheckBloom(ctx context.Context, req *rpc.CheckBloomReq) (*rpc.CheckBloomRes, error)

func (*Server) Close

func (s *Server) Close(ctx context.Context) error

func (*Server) FwdOnions

func (s *Server) FwdOnions(ss rpc.ServerRPC_FwdOnionsServer) error

func (*Server) Listen

func (s *Server) Listen(ctx context.Context) error

TODO: Ctx stop

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

type ServerConfig

type ServerConfig struct {
	Layer int
	// Addr is the endpoint accessible by other servers.
	// If empty, use the port of [LAddr] and the public IP by detection.
	// At that time [LAddr] must be in ":%d" format.
	Addr string
	// LAddr is for gRPC Listening
	LAddr string
	// PK, SK can be left empty to atomically gen
	// TODO: PK/SK rotation
	PK, SK *[32]byte

	// RAddr is Redis addr
	RAddr string
	// MURI is MongoDB URI
	MURI string

	BloomFP float64
}

Jump to

Keyboard shortcuts

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