This commit is contained in:
arm64v8a
2023-02-03 17:51:04 +09:00
parent c3d45075fc
commit 7a3be29769
4 changed files with 38 additions and 4 deletions

View File

@@ -17,7 +17,8 @@ import (
)
var instance *libcore.V2RayInstance
var getNekorayTunIndex = func() int { return 0 }
var getNekorayTunIndex = func() int { return 0 } // Windows only
var underlyingNetDialer *net.Dialer // Windows only
func setupCore() {
// TODO del
@@ -27,6 +28,9 @@ func setupCore() {
// localdns setup
resolver_def := &net.Resolver{PreferGo: false}
resolver_go := &net.Resolver{PreferGo: true}
if underlyingNetDialer != nil {
resolver_go.Dial = underlyingNetDialer.DialContext
}
localdns.SetLookupFunc(func(network string, host string) (ips []net.IP, err error) {
// fix old sekai
defer func() {

View File

@@ -23,7 +23,7 @@ func init() {
bindInterfaceIndex := getBindInterfaceIndex(address)
if bindInterfaceIndex != 0 {
if err := bindInterface(fd, bindInterfaceIndex, true, true); err != nil {
log.Println("bind inbound interface", err)
log.Println("bind inbound interface", network, address, err)
return err
}
}
@@ -41,12 +41,33 @@ func init() {
v6 = false
}
if err := bindInterface(fd, bindInterfaceIndex, v4, v6); err != nil {
log.Println("bind outbound interface", err)
log.Println("bind outbound interface", network, address, err)
return err
}
}
return nil
})
underlyingNetDialer = &net.Dialer{
Control: func(network, address string, c syscall.RawConn) error {
c.Control(func(fd uintptr) {
bindInterfaceIndex := getBindInterfaceIndex(address)
if bindInterfaceIndex != 0 {
var v4, v6 bool
if strings.HasSuffix(network, "6") {
v4 = false
v6 = true
} else {
v4 = true
v6 = false
}
if err := bindInterface(fd, bindInterfaceIndex, v4, v6); err != nil {
log.Println("underlyingNetDialer: bind interface", network, address, err)
}
}
})
return nil
},
}
//
updateRoutes()
iphlpapi.RegisterNotifyRouteChange2(func(callerContext uintptr, row uintptr, notificationType uint32) uintptr {

View File

@@ -34,7 +34,7 @@ func main() {
} else {
// 1. nekoray stop it self and run "updater.exe"
Copy("./updater.exe", "./updater.old")
exec.Command("./updater.old").Start()
exec.Command("./updater.old", os.Args[1:]...).Start()
}
} else {
// 1. update files

View File

@@ -9,7 +9,16 @@ mkdir -p $DEST
#### copy binary ####
cp $BUILD/nekoray $DEST
#### Download: prebuilt runtime ####
curl -Lso usr.zip https://github.com/MatsuriDayo/nekoray_qt_runtime/releases/download/20220503/20230202-5.12.8-ubuntu20.04-linux64.zip
unzip usr.zip
mv usr $DEST
#### copy so ####
# 5.11 looks buggy on new systems...
exit
USR_LIB=/usr/lib/x86_64-linux-gnu
mkdir usr
pushd usr