Documentation ¶
Index ¶
- Variables
- func BackoffRetry(ctx context.Context, callback func() error, exp float32, ...) error
- func ByteCountIEC(b uint64) string
- func CalculateBackOff(retries int, exp float32, base, min, max time.Duration) time.Duration
- func ExtractConnRemoteURL(Conn net.Conn) *url.URL
- func GenerateDirectAccessAddresses(protocol string, addresses []string, port string, queryMap url.Values) ([]url.URL, error)
- func NewHookedListener(raw net.Listener, hook ListenerHook) net.Listener
- func ResolveIPForInterface(devName string) ([]string, error)
- type DefaultLogger
- type HookedListener
- type InflightObject
- type InmemoryListener
- type ListenerHook
- type Logger
- type LoggerTracker
- type NopLogger
- type NopTracer
- type Timer
- type TraceWrapper
- type Tracer
- type TracerFunc
- type URLAddr
Constants ¶
This section is empty.
Variables ¶
var ( XConnVersion = "2" YukinetVersion = "Unknown Version" BuildDate = "Unknown Date" DiscoveryDirectProtocol = "xudp" )
Functions ¶
func BackoffRetry ¶ added in v0.2.17
func CalculateBackOff ¶ added in v0.2.17
func GenerateDirectAccessAddresses ¶
Types ¶
type DefaultLogger ¶
type DefaultLogger struct{}
func (*DefaultLogger) Errorf ¶
func (*DefaultLogger) Errorf(format string, args ...interface{})
func (*DefaultLogger) Printf ¶
func (*DefaultLogger) Printf(format string, args ...interface{})
type HookedListener ¶
HookedListener is a listener with a customized hook function.
func (*HookedListener) Accept ¶
func (l *HookedListener) Accept() (net.Conn, error)
func (*HookedListener) Addr ¶
func (l *HookedListener) Addr() net.Addr
type InflightObject ¶ added in v0.2.30
type InflightObject[T any] struct { // contains filtered or unexported fields }
func NewInflightObject ¶ added in v0.2.30
func NewInflightObject[T any](t T) *InflightObject[T]
func (*InflightObject[T]) Acquire ¶ added in v0.2.30
func (o *InflightObject[T]) Acquire() (*T, func())
func (*InflightObject[T]) CloseAndWait ¶ added in v0.2.30
func (o *InflightObject[T]) CloseAndWait(gcFunc func(t *T))
type InmemoryListener ¶
type InmemoryListener struct {
// contains filtered or unexported fields
}
InmemoryListener implements a listener for testing purpose.
func NewInMemoryListener ¶
func NewInMemoryListener() *InmemoryListener
NewInMemoryListener creates an inmemory listener.
func (*InmemoryListener) Accept ¶
func (l *InmemoryListener) Accept() (net.Conn, error)
Accept returns a connection just like net.Listener.
func (*InmemoryListener) Addr ¶
func (l *InmemoryListener) Addr() net.Addr
Addr returns the address of the listener.
func (*InmemoryListener) Close ¶
func (l *InmemoryListener) Close() error
Close closes the listener. Will immeidately return nil if the listener is already closed.
func (*InmemoryListener) Dial ¶
func (l *InmemoryListener) Dial() (net.Conn, error)
Dial creates a connection to the InMemoryListener directly.
func (*InmemoryListener) IsClosed ¶
func (l *InmemoryListener) IsClosed() bool
IsClosed returns if the listener is closed.
type ListenerHook ¶
ListenerHook specifies a callback that is invoked after inner listener returns a result from Accept(). If `skip` is true, returned connection will be closed (if not error) and will re-invoke the Accept for the next result.
type Logger ¶
Logger is a generic logging interface.
type LoggerTracker ¶
type LoggerTracker struct{ Logger }
func (*LoggerTracker) Close ¶
func (l *LoggerTracker) Close() error
type NopTracer ¶
type NopTracer struct{}
type Timer ¶
Timer roughly copies the interface of the Linux kernel's struct timer_list.
type TraceWrapper ¶ added in v0.2.15
func (*TraceWrapper) Close ¶ added in v0.2.15
func (t *TraceWrapper) Close() error
func (*TraceWrapper) Errorf ¶ added in v0.2.15
func (t *TraceWrapper) Errorf(format string, args ...interface{})
func (*TraceWrapper) Printf ¶ added in v0.2.15
func (t *TraceWrapper) Printf(format string, args ...interface{})
type Tracer ¶
Tracer is a generic trace interface, it will close the trace if Close() is called.