mirror of
https://github.com/SagerNet/sing-box.git
synced 2026-04-11 17:47:20 +10:00
platform: Refactoring libbox to use gRPC-based protocol
This commit is contained in:
@@ -28,7 +28,6 @@ import (
|
||||
"github.com/sagernet/sing-box/adapter/endpoint"
|
||||
"github.com/sagernet/sing-box/common/dialer"
|
||||
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"
|
||||
"github.com/sagernet/sing-box/route/rule"
|
||||
@@ -80,7 +79,7 @@ type Endpoint struct {
|
||||
logger logger.ContextLogger
|
||||
dnsRouter adapter.DNSRouter
|
||||
network adapter.NetworkManager
|
||||
platformInterface platform.Interface
|
||||
platformInterface adapter.PlatformInterface
|
||||
server *tsnet.Server
|
||||
stack *stack.Stack
|
||||
icmpForwarder *tun.ICMPForwarder
|
||||
@@ -190,7 +189,7 @@ func NewEndpoint(ctx context.Context, router adapter.Router, logger log.ContextL
|
||||
logger: logger,
|
||||
dnsRouter: dnsRouter,
|
||||
network: service.FromContext[adapter.NetworkManager](ctx),
|
||||
platformInterface: service.FromContext[platform.Interface](ctx),
|
||||
platformInterface: service.FromContext[adapter.PlatformInterface](ctx),
|
||||
server: server,
|
||||
acceptRoutes: options.AcceptRoutes,
|
||||
exitNode: options.ExitNode,
|
||||
@@ -290,7 +289,7 @@ func (t *Endpoint) watchState() {
|
||||
if authURL != "" {
|
||||
t.logger.Info("Waiting for authentication: ", authURL)
|
||||
if t.platformInterface != nil {
|
||||
err := t.platformInterface.SendNotification(&platform.Notification{
|
||||
err := t.platformInterface.SendNotification(&adapter.Notification{
|
||||
Identifier: "tailscale-authentication",
|
||||
TypeName: "Tailscale Authentication Notifications",
|
||||
TypeID: 10,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package tailscale
|
||||
|
||||
import (
|
||||
"github.com/sagernet/sing-box/experimental/libbox/platform"
|
||||
"github.com/sagernet/sing-box/adapter"
|
||||
"github.com/sagernet/tailscale/net/netns"
|
||||
)
|
||||
|
||||
func setAndroidProtectFunc(platformInterface platform.Interface) {
|
||||
func setAndroidProtectFunc(platformInterface adapter.PlatformInterface) {
|
||||
if platformInterface != nil {
|
||||
netns.SetAndroidProtectFunc(func(fd int) error {
|
||||
return platformInterface.AutoDetectInterfaceControl(fd)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
package tailscale
|
||||
|
||||
import "github.com/sagernet/sing-box/experimental/libbox/platform"
|
||||
import "github.com/sagernet/sing-box/adapter"
|
||||
|
||||
func setAndroidProtectFunc(platformInterface platform.Interface) {
|
||||
func setAndroidProtectFunc(platformInterface adapter.PlatformInterface) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user