Documentation ¶
Index ¶
- Constants
- 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 Relay(RuntimeContext context.Context, peerA io.ReadWriteCloser, ...) error
- func ResolveIPForInterface(devName string) ([]string, error)
- type DefaultLogger
- type HookedListener
- type InmemoryListener
- type ListenerHook
- type Logger
- type LoggerTracker
- type NopLogger
- type NopTracer
- type Timer
- type TraceWrapper
- type Tracer
- type TracerFunc
- type URLAddr
Constants ¶
const DiscoveryDirectProtocol = "xtcp"
Variables ¶
var ( XConnVersion = "2" YukinetVersion = "Unknown" BuildDate = "" )
Functions ¶
func BackoffRetry ¶ added in v0.2.17
func CalculateBackOff ¶ added in v0.2.17
func GenerateDirectAccessAddresses ¶
func Relay ¶
func Relay(RuntimeContext context.Context, peerA io.ReadWriteCloser, peerB io.ReadWriteCloser) error
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 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.