Documentation
¶
Index ¶
- Variables
- func NewFallback(ctx context.Context, router adapter.Router, logger log.ContextLogger, ...) (adapter.Outbound, error)
- func NewMutableAutoSelect(ctx context.Context, _ A.Router, logger log.ContextLogger, tag string, ...) (A.Outbound, error)
- func NewMutableSelector(ctx context.Context, router A.Router, logger log.ContextLogger, tag string, ...) (A.Outbound, error)
- func NewMutableURLTest(ctx context.Context, _ A.Router, logger log.ContextLogger, tag string, ...) (A.Outbound, error)
- func RegisterFallback(registry *outbound.Registry)
- func RegisterMutableAutoSelect(registry *outbound.Registry)
- func RegisterMutableSelector(registry *outbound.Registry)
- func RegisterMutableURLTest(registry *outbound.Registry)
- type Fallback
- type MutableAutoSelect
- func (s *MutableAutoSelect) Add(tags ...string) (n int, err error)
- func (s *MutableAutoSelect) All() []string
- func (s *MutableAutoSelect) CheckOutbounds()
- func (s *MutableAutoSelect) Close() error
- func (s *MutableAutoSelect) DialContext(ctx context.Context, network string, destination M.Socksaddr) (net.Conn, error)
- func (s *MutableAutoSelect) ExhaustionSignal() <-chan struct{}
- func (s *MutableAutoSelect) InterfaceUpdated()
- func (s *MutableAutoSelect) ListenPacket(ctx context.Context, destination M.Socksaddr) (net.PacketConn, error)
- func (s *MutableAutoSelect) NewConnectionEx(ctx context.Context, conn net.Conn, metadata A.InboundContext, ...)
- func (s *MutableAutoSelect) NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, metadata A.InboundContext, ...)
- func (s *MutableAutoSelect) Now() string
- func (s *MutableAutoSelect) PostStart() error
- func (s *MutableAutoSelect) Remove(tags ...string) (n int, err error)
- func (s *MutableAutoSelect) SetURLOverrides(overrides map[string]string)
- func (s *MutableAutoSelect) Start() error
- func (s *MutableAutoSelect) URLTest(ctx context.Context) (map[string]uint16, error)
- type MutableSelector
- func (s *MutableSelector) Add(tags ...string) (n int, err error)
- func (s *MutableSelector) All() []string
- func (s *MutableSelector) DialContext(ctx context.Context, network string, destination metadata.Socksaddr) (net.Conn, error)
- func (s *MutableSelector) ListenPacket(ctx context.Context, destination metadata.Socksaddr) (net.PacketConn, error)
- func (s *MutableSelector) Network() []string
- func (s *MutableSelector) NewConnectionEx(ctx context.Context, conn net.Conn, metadata A.InboundContext, ...)
- func (s *MutableSelector) NewPacketConnectionEx(ctx context.Context, conn network.PacketConn, metadata A.InboundContext, ...)
- func (s *MutableSelector) Now() string
- func (s *MutableSelector) Remove(tags ...string) (n int, err error)
- func (s *MutableSelector) SelectOutbound(tag string) bool
- func (s *MutableSelector) Start() error
- type MutableURLTest
- func (s *MutableURLTest) Add(tags ...string) (n int, err error)
- func (s *MutableURLTest) All() []string
- func (s *MutableURLTest) CheckOutbounds()
- func (s *MutableURLTest) Close() error
- func (s *MutableURLTest) DialContext(ctx context.Context, network string, destination M.Socksaddr) (net.Conn, error)
- func (s *MutableURLTest) InterfaceUpdated()
- func (s *MutableURLTest) ListenPacket(ctx context.Context, destination M.Socksaddr) (net.PacketConn, error)
- func (s *MutableURLTest) NewConnectionEx(ctx context.Context, conn net.Conn, metadata A.InboundContext, ...)
- func (s *MutableURLTest) NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, metadata A.InboundContext, ...)
- func (s *MutableURLTest) Now() string
- func (s *MutableURLTest) PostStart() error
- func (s *MutableURLTest) Remove(tags ...string) (n int, err error)
- func (s *MutableURLTest) SetURLOverrides(overrides map[string]string)
- func (s *MutableURLTest) Start() error
- func (s *MutableURLTest) URLTest(ctx context.Context) (map[string]uint16, error)
Constants ¶
This section is empty.
Variables ¶
var ErrAllOutboundsFailed = errors.New("all outbounds failed")
ErrAllOutboundsFailed is returned by MutableURLTest.DialContext and MutableURLTest.ListenPacket after every attempted outbound has failed.
Functions ¶
func NewFallback ¶
func NewFallback(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.FallbackOutboundOptions) (adapter.Outbound, error)
NewFallback creates a new Fallback outbound adapter.
func NewMutableAutoSelect ¶
func NewMutableSelector ¶
func NewMutableURLTest ¶
func RegisterFallback ¶
func RegisterMutableSelector ¶
func RegisterMutableURLTest ¶
Types ¶
type Fallback ¶
Fallback is an outbound adapter that attempts to use a primary outbound, and falls back to a secondary outbound if the primary fails.
func (*Fallback) DialContext ¶
func (d *Fallback) DialContext(ctx context.Context, network string, destination metadata.Socksaddr) (net.Conn, error)
DialContext attempts to dial using the primary outbound. If it fails, it falls back to the fallback outbound.
func (*Fallback) ListenPacket ¶
func (d *Fallback) ListenPacket(ctx context.Context, destination metadata.Socksaddr) (net.PacketConn, error)
ListenPacket attempts to create a packet connection using the primary outbound. If it fails, it falls back to the fallback outbound.
type MutableAutoSelect ¶
MutableAutoSelect is the client-side server-selection group.
func (*MutableAutoSelect) All ¶
func (s *MutableAutoSelect) All() []string
func (*MutableAutoSelect) CheckOutbounds ¶
func (s *MutableAutoSelect) CheckOutbounds()
func (*MutableAutoSelect) Close ¶
func (s *MutableAutoSelect) Close() error
func (*MutableAutoSelect) DialContext ¶
func (*MutableAutoSelect) ExhaustionSignal ¶
func (s *MutableAutoSelect) ExhaustionSignal() <-chan struct{}
ExhaustionSignal returns a receive-only channel that emits when every candidate fails within a ladder's budget. Buffers one pending signal; an unread signal is replaced by the next ladder's emission. Closed on group Close so range-loop consumers terminate cleanly.
func (*MutableAutoSelect) InterfaceUpdated ¶
func (s *MutableAutoSelect) InterfaceUpdated()
func (*MutableAutoSelect) ListenPacket ¶
func (s *MutableAutoSelect) ListenPacket(ctx context.Context, destination M.Socksaddr) (net.PacketConn, error)
func (*MutableAutoSelect) NewConnectionEx ¶
func (s *MutableAutoSelect) NewConnectionEx(ctx context.Context, conn net.Conn, metadata A.InboundContext, onClose N.CloseHandlerFunc)
func (*MutableAutoSelect) NewPacketConnectionEx ¶
func (s *MutableAutoSelect) NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, metadata A.InboundContext, onClose N.CloseHandlerFunc)
func (*MutableAutoSelect) Now ¶
func (s *MutableAutoSelect) Now() string
Now reports the most recent dial-time selection, TCP preferred, UDP fallback. Single representative tag for telemetry; not a per-network route — TCP and UDP select independently at dial time.
func (*MutableAutoSelect) PostStart ¶
func (s *MutableAutoSelect) PostStart() error
PostStart is idempotent: a second invocation is a no-op rather than a duplicate background loop.
func (*MutableAutoSelect) Remove ¶
func (s *MutableAutoSelect) Remove(tags ...string) (n int, err error)
func (*MutableAutoSelect) SetURLOverrides ¶
func (s *MutableAutoSelect) SetURLOverrides(overrides map[string]string)
SetURLOverrides replaces per-member callback URL overrides. Changed or removed overrides keep history and mark probe results stale.
func (*MutableAutoSelect) Start ¶
func (s *MutableAutoSelect) Start() error
Start resolves every configured tag to an outbound atomically: a missing tag aborts without partially populating s.members.
type MutableSelector ¶
func (*MutableSelector) Add ¶
func (s *MutableSelector) Add(tags ...string) (n int, err error)
Add adds the given outbound tags to the group and returns the number of outbounds added. If an outbound tag already exists, it will be ignored.
func (*MutableSelector) All ¶
func (s *MutableSelector) All() []string
func (*MutableSelector) DialContext ¶
func (*MutableSelector) ListenPacket ¶
func (s *MutableSelector) ListenPacket(ctx context.Context, destination metadata.Socksaddr) (net.PacketConn, error)
func (*MutableSelector) Network ¶
func (s *MutableSelector) Network() []string
func (*MutableSelector) NewConnectionEx ¶
func (s *MutableSelector) NewConnectionEx(ctx context.Context, conn net.Conn, metadata A.InboundContext, onClose network.CloseHandlerFunc)
func (*MutableSelector) NewPacketConnectionEx ¶
func (s *MutableSelector) NewPacketConnectionEx(ctx context.Context, conn network.PacketConn, metadata A.InboundContext, onClose network.CloseHandlerFunc)
func (*MutableSelector) Now ¶
func (s *MutableSelector) Now() string
func (*MutableSelector) Remove ¶
func (s *MutableSelector) Remove(tags ...string) (n int, err error)
Remove removes the given outbound tags from the group and returns the number of outbounds removed. A random outbound will be selected if the currently selected outbound is removed.
func (*MutableSelector) SelectOutbound ¶
func (s *MutableSelector) SelectOutbound(tag string) bool
func (*MutableSelector) Start ¶
func (s *MutableSelector) Start() error
type MutableURLTest ¶
func (*MutableURLTest) Add ¶
func (s *MutableURLTest) Add(tags ...string) (n int, err error)
Add adds the given outbound tags to the group and returns the number of outbounds added. If an outbound tag already exists, it will be ignored.
func (*MutableURLTest) All ¶
func (s *MutableURLTest) All() []string
func (*MutableURLTest) CheckOutbounds ¶
func (s *MutableURLTest) CheckOutbounds()
func (*MutableURLTest) Close ¶
func (s *MutableURLTest) Close() error
func (*MutableURLTest) DialContext ¶
func (*MutableURLTest) InterfaceUpdated ¶
func (s *MutableURLTest) InterfaceUpdated()
func (*MutableURLTest) ListenPacket ¶
func (s *MutableURLTest) ListenPacket(ctx context.Context, destination M.Socksaddr) (net.PacketConn, error)
func (*MutableURLTest) NewConnectionEx ¶
func (s *MutableURLTest) NewConnectionEx(ctx context.Context, conn net.Conn, metadata A.InboundContext, onClose N.CloseHandlerFunc)
func (*MutableURLTest) NewPacketConnectionEx ¶
func (s *MutableURLTest) NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, metadata A.InboundContext, onClose N.CloseHandlerFunc)
func (*MutableURLTest) Now ¶
func (s *MutableURLTest) Now() string
func (*MutableURLTest) PostStart ¶
func (s *MutableURLTest) PostStart() error
func (*MutableURLTest) Remove ¶
func (s *MutableURLTest) Remove(tags ...string) (n int, err error)
Remove removes the given outbound tags from the group and returns the number of outbounds removed.
func (*MutableURLTest) SetURLOverrides ¶
func (s *MutableURLTest) SetURLOverrides(overrides map[string]string)
SetURLOverrides replaces the per-outbound URL override map used during URL testing.
func (*MutableURLTest) Start ¶
func (s *MutableURLTest) Start() error