platform: Refactoring libbox to use gRPC-based protocol
This commit is contained in:
@@ -9,7 +9,6 @@ import (
|
||||
"github.com/sagernet/sing-box/common/process"
|
||||
"github.com/sagernet/sing-box/common/taskmonitor"
|
||||
C "github.com/sagernet/sing-box/constant"
|
||||
"github.com/sagernet/sing-box/experimental/libbox/platform"
|
||||
"github.com/sagernet/sing-box/log"
|
||||
"github.com/sagernet/sing-box/option"
|
||||
R "github.com/sagernet/sing-box/route/rule"
|
||||
@@ -37,7 +36,7 @@ type Router struct {
|
||||
processSearcher process.Searcher
|
||||
pauseManager pause.Manager
|
||||
trackers []adapter.ConnectionTracker
|
||||
platformInterface platform.Interface
|
||||
platformInterface adapter.PlatformInterface
|
||||
started bool
|
||||
}
|
||||
|
||||
@@ -55,7 +54,7 @@ func NewRouter(ctx context.Context, logFactory log.Factory, options option.Route
|
||||
ruleSetMap: make(map[string]adapter.RuleSet),
|
||||
needFindProcess: hasRule(options.Rules, isProcessRule) || hasDNSRule(dnsOptions.Rules, isProcessDNSRule) || options.FindProcess,
|
||||
pauseManager: service.FromContext[pause.Manager](ctx),
|
||||
platformInterface: service.FromContext[platform.Interface](ctx),
|
||||
platformInterface: service.FromContext[adapter.PlatformInterface](ctx),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,8 +119,8 @@ func (r *Router) Start(stage adapter.StartStage) error {
|
||||
}
|
||||
}
|
||||
if needFindProcess {
|
||||
if r.platformInterface != nil {
|
||||
r.processSearcher = r.platformInterface
|
||||
if r.platformInterface != nil && r.platformInterface.UsePlatformConnectionOwnerFinder() {
|
||||
r.processSearcher = newPlatformSearcher(r.platformInterface)
|
||||
} else {
|
||||
monitor.Start("initialize process searcher")
|
||||
searcher, err := process.NewSearcher(process.Config{
|
||||
|
||||
Reference in New Issue
Block a user