Documentation
¶
Index ¶
- func OutboundTag(detour Outbound) string
- func UpstreamMetadata(metadata InboundContext) M.Metadata
- func WithContext(ctx context.Context, inboundContext *InboundContext) context.Context
- type ClashServer
- type ConnectionHandler
- type ConnectionHandlerFunc
- type DNSRule
- type Inbound
- type InboundContext
- type OOBPacketHandler
- type Outbound
- type OutboundGroup
- type PacketConnectionHandler
- type PacketConnectionHandlerFunc
- type PacketHandler
- type Router
- type Rule
- type Service
- type Starter
- type Tracker
- type TrafficController
- type UpstreamHandlerAdapter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OutboundTag ¶
func UpstreamMetadata ¶
func UpstreamMetadata(metadata InboundContext) M.Metadata
func WithContext ¶
func WithContext(ctx context.Context, inboundContext *InboundContext) context.Context
Types ¶
type ClashServer ¶
type ClashServer interface { Service TrafficController }
type ConnectionHandler ¶
type ConnectionHandlerFunc ¶
type InboundContext ¶
type InboundContext struct { Inbound string InboundType string Network string Source M.Socksaddr Destination M.Socksaddr Domain string Protocol string User string Outbound string DomainStrategy dns.DomainStrategy SniffEnabled bool SniffOverrideDestination bool DestinationAddresses []netip.Addr SourceGeoIPCode string GeoIPCode string ProcessInfo *process.Info }
func AppendContext ¶
func AppendContext(ctx context.Context) (context.Context, *InboundContext)
func ContextFrom ¶
func ContextFrom(ctx context.Context) *InboundContext
type OOBPacketHandler ¶
type OOBPacketHandler interface {
NewPacket(ctx context.Context, conn N.PacketConn, buffer *buf.Buffer, oob []byte, metadata InboundContext) error
}
type OutboundGroup ¶
type PacketConnectionHandler ¶
type PacketConnectionHandler interface {
NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata InboundContext) error
}
type PacketConnectionHandlerFunc ¶
type PacketConnectionHandlerFunc = func(ctx context.Context, conn N.PacketConn, metadata InboundContext) error
type PacketHandler ¶
type PacketHandler interface {
NewPacket(ctx context.Context, conn N.PacketConn, buffer *buf.Buffer, metadata InboundContext) error
}
type Router ¶
type Router interface { Service Outbounds() []Outbound Outbound(tag string) (Outbound, bool) DefaultOutbound(network string) Outbound RouteConnection(ctx context.Context, conn net.Conn, metadata InboundContext) error RoutePacketConnection(ctx context.Context, conn N.PacketConn, metadata InboundContext) error GeoIPReader() *geoip.Reader LoadGeosite(code string) (Rule, error) Exchange(ctx context.Context, message *dnsmessage.Message) (*dnsmessage.Message, error) Lookup(ctx context.Context, domain string, strategy dns.DomainStrategy) ([]netip.Addr, error) LookupDefault(ctx context.Context, domain string) ([]netip.Addr, error) InterfaceBindManager() control.BindManager DefaultInterface() string AutoDetectInterface() bool DefaultMark() int NetworkMonitor() tun.NetworkUpdateMonitor InterfaceMonitor() tun.DefaultInterfaceMonitor Rules() []Rule SetTrafficController(controller TrafficController) }
type TrafficController ¶
type TrafficController interface { RoutedConnection(ctx context.Context, conn net.Conn, metadata InboundContext, matchedRule Rule) (net.Conn, Tracker) RoutedPacketConnection(ctx context.Context, conn N.PacketConn, metadata InboundContext, matchedRule Rule) (N.PacketConn, Tracker) }
type UpstreamHandlerAdapter ¶
type UpstreamHandlerAdapter interface { N.TCPConnectionHandler N.UDPConnectionHandler E.Handler }
func NewUpstreamContextHandler ¶
func NewUpstreamContextHandler( connectionHandler ConnectionHandlerFunc, packetHandler PacketConnectionHandlerFunc, errorHandler E.Handler, ) UpstreamHandlerAdapter
func NewUpstreamHandler ¶
func NewUpstreamHandler( metadata InboundContext, connectionHandler ConnectionHandlerFunc, packetHandler PacketConnectionHandlerFunc, errorHandler E.Handler, ) UpstreamHandlerAdapter
Click to show internal directories.
Click to hide internal directories.