server

package
v0.0.0-...-5663511 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetID      = 1
	SetID      = 2
	Check      = 3
	Publish    = 4
	Lookup     = 5
	Clean      = 6
	Disconnect = 7
)

Variables

This section is empty.

Functions

func LogHealthPeriodically

func LogHealthPeriodically()

func NewServer

func NewServer(ctx context.Context, listenAddr string, keyStr string) error

NewServer creates a new server.

func Request

func Request(addr string, key []byte, msgType byte, data []byte) (byte, []byte, error)

Request sends a request to given addr with given key, msg type and data.

func RequestCheck

func RequestCheck(addr string, key []byte, cid string) (bool, error)

RequestCheck requests check.

func RequestClean

func RequestClean(addr string, key []byte, cid string) (string, error)

RequestClean requests a clean.

func RequestDisconnect

func RequestDisconnect(addr string, key []byte) (string, error)

RequestDisconnect requests a disconnection.

func RequestGetID

func RequestGetID(addr string, key []byte) (string, error)

RequestGetID gets peer id.

func RequestLookup

func RequestLookup(addr string, key []byte, sendFile SendFile) error

RequestLookup requests a lookup.

func RequestPublish

func RequestPublish(addr string, key []byte, content []byte) (string, error)

RequestPublish requests publish a random content.

func RequestSetID

func RequestSetID(addr string, key []byte, ids []string) ([]string, error)

RequestSetID sets peer ids.

func WriteError

func WriteError(w http.ResponseWriter, header int, msg string)

WriteError writes an error.

Types

type SendFile

type SendFile struct {
	Cid  string
	Size int
}

Jump to

Keyboard shortcuts

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