Create service_interface.go

Signed-off-by: david_feng <385297@qq.com>
This commit is contained in:
david_feng 2025-05-11 17:48:37 +08:00 committed by GitHub
parent c2b7d5bd12
commit ead13161e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,23 @@
package libbox
import (
"context"
box "github.com/sagernet/sing-box"
"github.com/sagernet/sing-box/common/urltest"
"github.com/sagernet/sing/service/pause"
)
func NewBoxService(ctx context.Context, cancel context.CancelFunc, instance *box.Box, pauseManager pause.Manager, urlTestHistoryStorage *urltest.HistoryStorage) BoxService {
return BoxService{
ctx: ctx,
cancel: cancel,
instance: instance,
pauseManager: pauseManager,
urlTestHistoryStorage: urlTestHistoryStorage,
}
}
func (b *BoxService) GetInstance() *box.Box {
return b.instance
}