refactor: Modular inbounds/outbounds

This commit is contained in:
世界
2024-11-02 00:39:02 +08:00
parent 3f143d6fc9
commit 6248abb6d4
151 changed files with 3115 additions and 2925 deletions

View File

@@ -5,6 +5,7 @@ import (
"net/netip"
"github.com/sagernet/sing-box/common/process"
"github.com/sagernet/sing-box/log"
"github.com/sagernet/sing-box/option"
M "github.com/sagernet/sing/common/metadata"
)
@@ -25,6 +26,11 @@ type UDPInjectableInbound interface {
PacketConnectionHandlerEx
}
type InboundRegistry interface {
option.InboundOptionsRegistry
CreateInbound(ctx context.Context, router Router, logger log.ContextLogger, tag string, outboundType string, options any) (Inbound, error)
}
type InboundContext struct {
Inbound string
InboundType string
@@ -44,6 +50,7 @@ type InboundContext struct {
// cache
// Deprecated: implement in rule action
InboundDetour string
LastInbound string
OriginDestination M.Socksaddr