mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-25 10:01:30 +00:00
Handle includeAllNetworks
This commit is contained in:
parent
cf2181dd3a
commit
a2098c18e1
|
@ -82,6 +82,10 @@ func (s *platformInterfaceStub) UnderNetworkExtension() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *platformInterfaceStub) IncludeAllNetworks() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (s *platformInterfaceStub) ClearDNSCache() {
|
func (s *platformInterfaceStub) ClearDNSCache() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ type PlatformInterface interface {
|
||||||
UsePlatformInterfaceGetter() bool
|
UsePlatformInterfaceGetter() bool
|
||||||
GetInterfaces() (NetworkInterfaceIterator, error)
|
GetInterfaces() (NetworkInterfaceIterator, error)
|
||||||
UnderNetworkExtension() bool
|
UnderNetworkExtension() bool
|
||||||
|
IncludeAllNetworks() bool
|
||||||
ReadWIFIState() *WIFIState
|
ReadWIFIState() *WIFIState
|
||||||
ClearDNSCache()
|
ClearDNSCache()
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ type Interface interface {
|
||||||
UsePlatformInterfaceGetter() bool
|
UsePlatformInterfaceGetter() bool
|
||||||
Interfaces() ([]control.Interface, error)
|
Interfaces() ([]control.Interface, error)
|
||||||
UnderNetworkExtension() bool
|
UnderNetworkExtension() bool
|
||||||
|
IncludeAllNetworks() bool
|
||||||
ClearDNSCache()
|
ClearDNSCache()
|
||||||
ReadWIFIState() adapter.WIFIState
|
ReadWIFIState() adapter.WIFIState
|
||||||
process.Searcher
|
process.Searcher
|
||||||
|
|
|
@ -213,6 +213,10 @@ func (w *platformInterfaceWrapper) UnderNetworkExtension() bool {
|
||||||
return w.iif.UnderNetworkExtension()
|
return w.iif.UnderNetworkExtension()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (w *platformInterfaceWrapper) IncludeAllNetworks() bool {
|
||||||
|
return w.iif.IncludeAllNetworks()
|
||||||
|
}
|
||||||
|
|
||||||
func (w *platformInterfaceWrapper) ClearDNSCache() {
|
func (w *platformInterfaceWrapper) ClearDNSCache() {
|
||||||
w.iif.ClearDNSCache()
|
w.iif.ClearDNSCache()
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,6 +166,14 @@ func (t *Tun) Start() error {
|
||||||
}
|
}
|
||||||
t.logger.Trace("creating stack")
|
t.logger.Trace("creating stack")
|
||||||
t.tunIf = tunInterface
|
t.tunIf = tunInterface
|
||||||
|
var (
|
||||||
|
forwarderBindInterface bool
|
||||||
|
includeAllNetworks bool
|
||||||
|
)
|
||||||
|
if t.platformInterface != nil {
|
||||||
|
forwarderBindInterface = true
|
||||||
|
includeAllNetworks = t.platformInterface.IncludeAllNetworks()
|
||||||
|
}
|
||||||
t.tunStack, err = tun.NewStack(t.stack, tun.StackOptions{
|
t.tunStack, err = tun.NewStack(t.stack, tun.StackOptions{
|
||||||
Context: t.ctx,
|
Context: t.ctx,
|
||||||
Tun: tunInterface,
|
Tun: tunInterface,
|
||||||
|
@ -174,8 +182,9 @@ func (t *Tun) Start() error {
|
||||||
UDPTimeout: t.udpTimeout,
|
UDPTimeout: t.udpTimeout,
|
||||||
Handler: t,
|
Handler: t,
|
||||||
Logger: t.logger,
|
Logger: t.logger,
|
||||||
ForwarderBindInterface: t.platformInterface != nil,
|
ForwarderBindInterface: forwarderBindInterface,
|
||||||
InterfaceFinder: t.router.InterfaceFinder(),
|
InterfaceFinder: t.router.InterfaceFinder(),
|
||||||
|
IncludeAllNetworks: includeAllNetworks,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue