mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-06-12 06:18:16 +03:00
Update sing-box core, refactor MASQUE, update XHTTP
This commit is contained in:
@@ -147,7 +147,7 @@ func (c *CommandClient) dialWithRetry(target string, contextDialer func(context.
|
||||
var client daemon.StartedServiceClient
|
||||
var lastError error
|
||||
|
||||
for attempt := 0; attempt < commandClientDialAttempts; attempt++ {
|
||||
for attempt := range commandClientDialAttempts {
|
||||
if connection == nil {
|
||||
options := []grpc.DialOption{
|
||||
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
||||
|
||||
@@ -114,7 +114,7 @@ func (s *CommandServer) Start() error {
|
||||
if sCommandServerListenPort == 0 {
|
||||
sockPath := filepath.Join(sBasePath, "command.sock")
|
||||
os.Remove(sockPath)
|
||||
for i := 0; i < 30; i++ {
|
||||
for range 30 {
|
||||
listener, err = net.ListenUnix("unix", &net.UnixAddr{
|
||||
Name: sockPath,
|
||||
Net: "unix",
|
||||
|
||||
@@ -418,13 +418,3 @@ func systemProxyStatusFromGRPC(status *daemon.SystemProxyStatus) *SystemProxySta
|
||||
Enabled: status.Enabled,
|
||||
}
|
||||
}
|
||||
|
||||
func systemProxyStatusToGRPC(status *SystemProxyStatus) *daemon.SystemProxyStatus {
|
||||
if status == nil {
|
||||
return nil
|
||||
}
|
||||
return &daemon.SystemProxyStatus{
|
||||
Available: status.Available,
|
||||
Enabled: status.Enabled,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@ import (
|
||||
"runtime/debug"
|
||||
)
|
||||
|
||||
var crashOutputFile *os.File
|
||||
|
||||
func RedirectStderr(path string) error {
|
||||
if stats, err := os.Stat(path); err == nil && stats.Size() > 0 {
|
||||
_ = os.Rename(path, path+".old")
|
||||
@@ -32,6 +30,5 @@ func RedirectStderr(path string) error {
|
||||
os.Remove(outputFile.Name())
|
||||
return err
|
||||
}
|
||||
crashOutputFile = outputFile
|
||||
return nil
|
||||
return outputFile.Close()
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ var (
|
||||
type platformDefaultInterfaceMonitor struct {
|
||||
*platformInterfaceWrapper
|
||||
logger logger.Logger
|
||||
element *list.Element[tun.NetworkUpdateCallback]
|
||||
callbacks list.List[tun.DefaultInterfaceUpdateCallback]
|
||||
myInterface string
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package libbox
|
||||
|
||||
import (
|
||||
C "github.com/sagernet/sing-box/constant"
|
||||
"github.com/sagernet/sing-box/option"
|
||||
)
|
||||
import C "github.com/sagernet/sing-box/constant"
|
||||
|
||||
type PlatformInterface interface {
|
||||
LocalDNSTransport() LocalDNSTransport
|
||||
@@ -98,37 +95,3 @@ type OnDemandRuleIterator interface {
|
||||
Next() OnDemandRule
|
||||
HasNext() bool
|
||||
}
|
||||
|
||||
type onDemandRule struct {
|
||||
option.OnDemandRule
|
||||
}
|
||||
|
||||
func (r *onDemandRule) Target() int32 {
|
||||
if r.OnDemandRule.Action == nil {
|
||||
return -1
|
||||
}
|
||||
return int32(*r.OnDemandRule.Action)
|
||||
}
|
||||
|
||||
func (r *onDemandRule) DNSSearchDomainMatch() StringIterator {
|
||||
return newIterator(r.OnDemandRule.DNSSearchDomainMatch)
|
||||
}
|
||||
|
||||
func (r *onDemandRule) DNSServerAddressMatch() StringIterator {
|
||||
return newIterator(r.OnDemandRule.DNSServerAddressMatch)
|
||||
}
|
||||
|
||||
func (r *onDemandRule) InterfaceTypeMatch() int32 {
|
||||
if r.OnDemandRule.InterfaceTypeMatch == nil {
|
||||
return -1
|
||||
}
|
||||
return int32(*r.OnDemandRule.InterfaceTypeMatch)
|
||||
}
|
||||
|
||||
func (r *onDemandRule) SSIDMatch() StringIterator {
|
||||
return newIterator(r.OnDemandRule.SSIDMatch)
|
||||
}
|
||||
|
||||
func (r *onDemandRule) ProbeURL() string {
|
||||
return r.OnDemandRule.ProbeURL
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ const utunControlName = "com.apple.net.utun_control"
|
||||
func GetTunnelFileDescriptor() int32 {
|
||||
ctlInfo := &unix.CtlInfo{}
|
||||
copy(ctlInfo.Name[:], utunControlName)
|
||||
for fd := 0; fd < 1024; fd++ {
|
||||
for fd := range 1024 {
|
||||
addr, err := unix.Getpeername(fd)
|
||||
if err != nil {
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user