fix: Report fork component references to reference manager

This commit is contained in:
Shtorm
2026-10-19 14:37:32 +03:00
parent 2283c95513
commit 6b5ee55ba2
14 changed files with 157 additions and 0 deletions
+11
View File
@@ -69,6 +69,17 @@ func (h *Inbound) Start(stage adapter.StartStage, scope *adapter.Scope) error {
return nil
}
func (h *Inbound) References() []string {
var references []string
for _, inbound := range h.inbounds {
referrer, isReferrer := inbound.(adapter.Referrer)
if isReferrer {
references = append(references, referrer.References()...)
}
}
return references
}
func (h *Inbound) connHandler(ctx context.Context, conn net.Conn, metadata adapter.InboundContext, onClose N.CloseHandlerFunc) error {
if metadata.Destination != Destination {
h.router.RouteConnectionEx(ctx, conn, metadata, onClose)
+31
View File
@@ -79,6 +79,37 @@ func (f *Failover) Start(stage adapter.StartStage, scope *adapter.Scope) error {
return nil
}
func (f *Failover) References() []string {
var references []string
for _, outbound := range f.outbounds {
referrer, isReferrer := outbound.(adapter.Referrer)
if isReferrer {
references = append(references, referrer.References()...)
} else {
references = append(references, outbound.Dependencies()...)
}
}
return references
}
func (f *Failover) SetKeepIdleConnections(keep bool) {
for _, outbound := range f.outbounds {
keeper, isKeeper := outbound.(adapter.IdleConnectionKeeper)
if isKeeper {
keeper.SetKeepIdleConnections(keep)
}
}
}
func (f *Failover) CloseIdleConnections() {
for _, outbound := range f.outbounds {
keeper, isKeeper := outbound.(adapter.IdleConnectionKeeper)
if isKeeper {
keeper.CloseIdleConnections()
}
}
}
func (f *Failover) DialContext(ctx context.Context, network string, destination M.Socksaddr) (net.Conn, error) {
if N.NetworkName(network) == N.NetworkUDP {
return f.uotClient.DialContext(ctx, network, destination)