Documentation ¶
Index ¶
- func ContextWithRouter(ctx context.Context, router Router) context.Context
- func PreStart(starter any) error
- func UpstreamMetadata(metadata InboundContext) M.Metadata
- func WithContext(ctx context.Context, inboundContext *InboundContext) context.Context
- type ClashCacheFile
- type ClashServer
- type ConnectionHandler
- type ConnectionHandlerFunc
- type DNSRule
- type FakeIPMetadata
- type FakeIPStorage
- type FakeIPStore
- type FakeIPTransport
- type Inbound
- type InboundContext
- type InjectableInbound
- type InterfaceUpdateListener
- type OOBPacketHandler
- type Outbound
- type OutboundCheckGroup
- type OutboundGroup
- type PacketConnectionHandler
- type PacketConnectionHandlerFunc
- type PacketHandler
- type PreStarter
- type Provider
- type Router
- type Rule
- type Service
- type TimeService
- type Tracker
- type UpstreamHandlerAdapter
- type V2RayClientTransport
- type V2RayServer
- type V2RayServerTransport
- type V2RayServerTransportHandler
- type V2RayStatsService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UpstreamMetadata ¶
func UpstreamMetadata(metadata InboundContext) M.Metadata
func WithContext ¶
func WithContext(ctx context.Context, inboundContext *InboundContext) context.Context
Types ¶
type ClashCacheFile ¶
type ClashServer ¶
type ClashServer interface { Service PreStarter Mode() string StoreSelected() bool StoreFakeIP() bool CacheFile() ClashCacheFile HistoryStorage() *urltest.HistoryStorage 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 ConnectionHandler ¶
type ConnectionHandlerFunc ¶
type FakeIPMetadata ¶
type FakeIPMetadata struct { Inet4Range netip.Prefix Inet6Range netip.Prefix Inet4Current netip.Addr Inet6Current netip.Addr }
func (*FakeIPMetadata) MarshalBinary ¶
func (m *FakeIPMetadata) MarshalBinary() (data []byte, err error)
func (*FakeIPMetadata) UnmarshalBinary ¶
func (m *FakeIPMetadata) UnmarshalBinary(data []byte) error
type FakeIPStorage ¶
type FakeIPStore ¶
type FakeIPTransport ¶
type FakeIPTransport interface {
dns.Transport
Store() FakeIPStore
}
type InboundContext ¶
type InboundContext struct { Inbound string InboundType string IPVersion uint8 Network string Source M.Socksaddr Destination M.Socksaddr Domain string Protocol string User string Outbound string InboundDetour string LastInbound string OriginDestination M.Socksaddr InboundOptions option.InboundOptions DestinationAddresses []netip.Addr SourceGeoIPCode string GeoIPCode string ProcessInfo *process.Info FakeIP bool QueryType uint16 }
func AppendContext ¶
func AppendContext(ctx context.Context) (context.Context, *InboundContext)
func ContextFrom ¶
func ContextFrom(ctx context.Context) *InboundContext
type InjectableInbound ¶
type InjectableInbound interface { Inbound Network() []string NewConnection(ctx context.Context, conn net.Conn, metadata InboundContext) error NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata InboundContext) error }
type InterfaceUpdateListener ¶
type InterfaceUpdateListener interface {
InterfaceUpdated() error
}
type OOBPacketHandler ¶
type OOBPacketHandler interface {
NewPacket(ctx context.Context, conn N.PacketConn, buffer *buf.Buffer, oob []byte, metadata InboundContext) error
}
type Outbound ¶
type OutboundCheckGroup ¶
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 PreStarter ¶
type PreStarter interface {
PreStart() error
}
type Router ¶
type Router interface { Service Outbounds() []Outbound Outbound(tag string) (Outbound, bool) DefaultOutbound(network string) Outbound Providers() []Provider Provider(tag string) (Provider, bool) FakeIPStore() FakeIPStore 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 *mdns.Msg) (*mdns.Msg, error) Lookup(ctx context.Context, domain string, strategy dns.DomainStrategy) ([]netip.Addr, error) LookupDefault(ctx context.Context, domain string) ([]netip.Addr, error) InterfaceFinder() control.InterfaceFinder UpdateInterfaces() error DefaultInterface() string AutoDetectInterface() bool AutoDetectInterfaceFunc() control.Func DefaultMark() int NetworkMonitor() tun.NetworkUpdateMonitor InterfaceMonitor() tun.DefaultInterfaceMonitor PackageManager() tun.PackageManager Rules() []Rule TimeService ClashServer() ClashServer SetClashServer(server ClashServer) V2RayServer() V2RayServer SetV2RayServer(server V2RayServer) ResetNetwork() error }
func RouterFromContext ¶
type TimeService ¶
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
type V2RayClientTransport ¶
type V2RayServer ¶
type V2RayServer interface { Service StatsService() V2RayStatsService }
type V2RayServerTransport ¶
Click to show internal directories.
Click to hide internal directories.