dispatcher

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AfterHandlerSelectedHook added in v1.0.7

type AfterHandlerSelectedHook interface {
	AfterHandlerSelection(ctx context.Context, info *session.Info, rw any,
		handler i.Outbound) (context.Context, any, error)
}

type BeforeHandlerSelectionHook added in v1.0.7

type BeforeHandlerSelectionHook interface {
	BeforeHandlerSelection(ctx context.Context, info *session.Info,
		rw any) (context.Context, any, error)
}

type Dispatcher

type Dispatcher struct {
	BeforeHandlerSelectionHooks []BeforeHandlerSelectionHook
	Router                      i.Router
	OnHandlerSelectedHooks      []AfterHandlerSelectedHook
	SessionStartHooks           []SessionStartHook
	SessionEndHooks             []SessionEndHook
	TimeoutSetting              i.TimeoutSetting
	OnFallbacks                 []OnFallback
	FallbackTimeout             time.Duration

	SessionStats        bool
	RewriteIpv6ToDomain bool

	Flows       atomic.Int32
	PacketConns atomic.Int32

	HandlerErrorObservers []i.HandlerErrorObserver
	// contains filtered or unexported fields
}

func (*Dispatcher) AddAfterHandlerSelectionHook added in v1.0.7

func (d *Dispatcher) AddAfterHandlerSelectionHook(hook AfterHandlerSelectedHook)

func (*Dispatcher) AddBeforeHandlerSelectionHook added in v1.0.7

func (d *Dispatcher) AddBeforeHandlerSelectionHook(hook BeforeHandlerSelectionHook)

func (*Dispatcher) AddHandlerErrorObserver

func (p *Dispatcher) AddHandlerErrorObserver(observer i.HandlerErrorObserver)

func (*Dispatcher) AddOnFallback added in v1.1.0

func (d *Dispatcher) AddOnFallback(fallback OnFallback)

func (*Dispatcher) AddSessionEndHook added in v1.0.7

func (d *Dispatcher) AddSessionEndHook(hook SessionEndHook)

func (*Dispatcher) AddSessionStartHook added in v1.2.1

func (d *Dispatcher) AddSessionStartHook(hook SessionStartHook)

func (*Dispatcher) HandleFlow

func (d *Dispatcher) HandleFlow(ctx context.Context, dst net.Destination,
	rw buf.ReaderWriter) error

func (*Dispatcher) HandlePacketConn

func (d *Dispatcher) HandlePacketConn(ctx context.Context, dst net.Destination, pc udp.PacketReaderWriter) error

func (*Dispatcher) Relay added in v1.1.0

func (d *Dispatcher) Relay(ctx context.Context, info *session.Info,
	left, right any, outbound i.Outbound) error

func (*Dispatcher) RemoveHandlerErrorObserver

func (p *Dispatcher) RemoveHandlerErrorObserver(observer i.HandlerErrorObserver)

type Fallback added in v1.0.7

type Fallback interface {
	Fallback(ctx context.Context, info *session.Info,
		rw buf.ReaderWriter, handler i.Outbound, err error) error
}

type GetCounters added in v1.1.0

type GetCounters interface {
	GetCounters(ctx context.Context, info *session.Info, handler i.Outbound) (session.UpCounters, session.DownCounters)
}

type NullSessionErrorLogger added in v1.0.7

type NullSessionErrorLogger struct{}

func (*NullSessionErrorLogger) LogSessionError added in v1.0.7

func (n *NullSessionErrorLogger) LogSessionError(info *session.Info, err error)

type OnFallback added in v1.1.0

type OnFallback interface {
	OnFallback(info *session.Info, previousTag, tag string)
}

type OnHandlerErrorFunc

type OnHandlerErrorFunc func(tag string, err error)

type SessionEndHook added in v1.0.7

type SessionEndHook interface {
	// should return quickly
	FlowSessionEnd(ctx context.Context, info *session.Info, err error)
	PacketConnSessionEnd(ctx context.Context, info *session.Info, err error)
}

type SessionErrorLogger added in v1.0.7

type SessionErrorLogger interface {
	LogSessionError(info *session.Info, err error)
}

type SessionStartHook added in v1.2.1

type SessionStartHook interface {
	SessionStart(ctx context.Context, info *session.Info)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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