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 Cache
- type DefaultLogger
- type HookedListener
- type InflightChannel
- type InflightObject
- type InmemoryListener
- type Key
- 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 ( YukinetVersion = "Unknown Version" BuildDate = "Unknown Date" DiscoveryDirectProtocol = "xudp" )
Functions ¶
func BackoffRetry ¶
func CalculateBackOff ¶
func GenerateDirectAccessAddresses ¶
Types ¶
type Cache ¶
type Cache struct { // MaxEntries is the maximum number of cache entries before // an item is evicted. Zero means no limit. MaxEntries int // contains filtered or unexported fields }
Cache is an LRU cache. It is not safe for concurrent access.
func LRU ¶
LRU creates a new Cache. If maxEntries is zero, the cache has no limit and it's assumed that eviction is done by the caller.
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 InflightChannel ¶ added in v0.2.42
type InflightChannel[T any] struct { // contains filtered or unexported fields }
func NewInflightChannel ¶ added in v0.2.42
func NewInflightChannel[T any](buf int, processor func(c chan *T)) *InflightChannel[T]
func (*InflightChannel[T]) Close ¶ added in v0.2.42
func (o *InflightChannel[T]) Close() error
func (*InflightChannel[T]) Send ¶ added in v0.2.42
func (o *InflightChannel[T]) Send(ctx context.Context, v *T) bool
Send returns true if it is enqueued.
type InflightObject ¶
type InflightObject[T any] struct { // contains filtered or unexported fields }
func NewInflightObject ¶
func NewInflightObject[T any](t T) *InflightObject[T]
func (*InflightObject[T]) Acquire ¶
func (o *InflightObject[T]) Acquire() *T
func (*InflightObject[T]) CloseAndWait ¶
func (o *InflightObject[T]) CloseAndWait(gcFunc func(t *T))
func (*InflightObject[T]) Release ¶ added in v0.3.5
func (o *InflightObject[T]) Release()
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 Key ¶
type Key interface{}
A Key may be any value that is comparable. See http://golang.org/ref/spec#Comparison_operators
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 ¶
func (*TraceWrapper) Close ¶
func (t *TraceWrapper) Close() error
func (*TraceWrapper) Errorf ¶
func (t *TraceWrapper) Errorf(format string, args ...interface{})
func (*TraceWrapper) Printf ¶
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.