mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-10-15 02:23:59 +00:00
platform: Add http proxy support for Windows
This commit is contained in:
@@ -250,7 +250,7 @@ func (t *Endpoint) Start(stage adapter.StartStage) error {
|
||||
}
|
||||
|
||||
func (t *Endpoint) start() error {
|
||||
if t.platformInterface != nil {
|
||||
if t.platformInterface != nil && t.platformInterface.UsePlatformNetworkInterfaces() {
|
||||
err := t.network.UpdateInterfaces()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -326,7 +326,7 @@ func (t *Endpoint) start() error {
|
||||
controlFunc = control.Append(controlFunc, bindFunc)
|
||||
}
|
||||
netns.SetControlFunc(controlFunc)
|
||||
} else if runtime.GOOS == "android" && t.platformInterface != nil {
|
||||
} else if runtime.GOOS == "android" && t.platformInterface != nil && t.platformInterface.UsePlatformAutoDetectInterfaceControl() {
|
||||
netns.SetControlFunc(func(network, address string, c syscall.RawConn) error {
|
||||
return control.Raw(c, func(fd uintptr) error {
|
||||
return t.platformInterface.AutoDetectInterfaceControl(int(fd))
|
||||
@@ -462,7 +462,7 @@ func (t *Endpoint) watchState() {
|
||||
}
|
||||
reportedAuthURL = authURL
|
||||
t.logger.Info("Waiting for authentication: ", authURL)
|
||||
if t.platformInterface != nil {
|
||||
if t.platformInterface != nil && t.platformInterface.UsePlatformNotification() {
|
||||
err := t.platformInterface.SendNotification(&adapter.Notification{
|
||||
Identifier: "tailscale-authentication",
|
||||
TypeName: "Tailscale Authentication Notifications",
|
||||
|
||||
+11
-7
@@ -367,7 +367,7 @@ func (t *Inbound) Start(stage adapter.StartStage) error {
|
||||
t.tunOptions.NetNs = manager.ResolvePath(t.tunOptions.NetNs)
|
||||
}
|
||||
}
|
||||
if t.platformInterface == nil {
|
||||
if t.platformInterface == nil || C.IsWindows {
|
||||
for _, routeRuleSet := range t.routeRuleSet {
|
||||
ipSets := routeRuleSet.ExtractIPSet()
|
||||
if len(ipSets) == 0 {
|
||||
@@ -430,12 +430,16 @@ func (t *Inbound) Start(stage adapter.StartStage) error {
|
||||
}
|
||||
t.logger.Trace("creating stack")
|
||||
t.tunIf = tunInterface
|
||||
var (
|
||||
forwarderBindInterface bool
|
||||
includeAllNetworks bool
|
||||
)
|
||||
if t.platformInterface != nil {
|
||||
forwarderBindInterface = true
|
||||
err = t.platformInterface.ProcessPlatformOptions(t.platformOptions)
|
||||
if err != nil {
|
||||
closeError := t.tunIf.Close()
|
||||
t.tunIf = nil
|
||||
return E.Errors(E.Cause(err, "process platform options"), closeError)
|
||||
}
|
||||
}
|
||||
var includeAllNetworks bool
|
||||
if t.platformInterface != nil && t.platformInterface.UnderNetworkExtension() {
|
||||
includeAllNetworks = t.platformInterface.NetworkExtensionIncludeAllNetworks()
|
||||
}
|
||||
tunStack, err := tun.NewStack(t.stack, tun.StackOptions{
|
||||
@@ -446,7 +450,7 @@ func (t *Inbound) Start(stage adapter.StartStage) error {
|
||||
ICMPTimeout: C.ICMPTimeout,
|
||||
Handler: t,
|
||||
Logger: t.logger,
|
||||
ForwarderBindInterface: forwarderBindInterface,
|
||||
ForwarderBindInterface: C.IsDarwin,
|
||||
InterfaceFinder: t.networkManager.InterfaceFinder(),
|
||||
IncludeAllNetworks: includeAllNetworks,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user