util

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DHTOrdered

func DHTOrdered(a, b, c types.PublicKey) bool

DHTOrdered returns true if the order of A, B and C is correct, where A < B < C without wrapping.

func DHTWrappedOrdered

func DHTWrappedOrdered(a, b, c types.PublicKey) bool

DHTWrappedOrdered returns true if the ordering of A, B and C is correct, where we may wrap around from C to A. This gives us the property of the successor always being a+1 and the predecessor being a+sizeofkeyspace.

func ForwardOrdering

func ForwardOrdering(target types.PublicKey, input []types.PublicKey) func(i, j int) bool

func LessThan

func LessThan(first, second types.PublicKey) bool

func ReverseOrdering

func ReverseOrdering(target types.PublicKey, input []types.PublicKey) func(i, j int) bool

Types

type Overlay

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

type SlowConn added in v0.4.0

type SlowConn struct {
	net.Conn
	ReadDelay   time.Duration
	ReadJitter  time.Duration
	WriteDelay  time.Duration
	WriteJitter time.Duration
}

func (*SlowConn) Read added in v0.4.0

func (p *SlowConn) Read(b []byte) (n int, err error)

func (*SlowConn) Write added in v0.4.0

func (p *SlowConn) Write(b []byte) (n int, err error)

type WebSocketConn

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

func WrapWebSocketConn

func WrapWebSocketConn(c *websocket.Conn) *WebSocketConn

func (*WebSocketConn) Close

func (c *WebSocketConn) Close() error

func (*WebSocketConn) LocalAddr

func (c *WebSocketConn) LocalAddr() net.Addr

func (*WebSocketConn) Read

func (c *WebSocketConn) Read(p []byte) (int, error)

func (*WebSocketConn) RemoteAddr

func (c *WebSocketConn) RemoteAddr() net.Addr

func (*WebSocketConn) SetDeadline

func (c *WebSocketConn) SetDeadline(t time.Time) error

func (*WebSocketConn) SetReadDeadline

func (c *WebSocketConn) SetReadDeadline(t time.Time) error

func (*WebSocketConn) SetWriteDeadline

func (c *WebSocketConn) SetWriteDeadline(t time.Time) error

func (*WebSocketConn) Write

func (c *WebSocketConn) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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