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 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() { func setupCore() {
// TODO del // TODO del
@@ -27,6 +28,9 @@ func setupCore() {
// localdns setup // localdns setup
resolver_def := &net.Resolver{PreferGo: false} resolver_def := &net.Resolver{PreferGo: false}
resolver_go := &net.Resolver{PreferGo: true} 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) { localdns.SetLookupFunc(func(network string, host string) (ips []net.IP, err error) {
// fix old sekai // fix old sekai
defer func() { defer func() {

View File

@@ -23,7 +23,7 @@ func init() {
bindInterfaceIndex := getBindInterfaceIndex(address) bindInterfaceIndex := getBindInterfaceIndex(address)
if bindInterfaceIndex != 0 { if bindInterfaceIndex != 0 {
if err := bindInterface(fd, bindInterfaceIndex, true, true); err != nil { 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 return err
} }
} }
@@ -41,12 +41,33 @@ func init() {
v6 = false v6 = false
} }
if err := bindInterface(fd, bindInterfaceIndex, v4, v6); err != nil { 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 err
} }
} }
return nil 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() updateRoutes()
iphlpapi.RegisterNotifyRouteChange2(func(callerContext uintptr, row uintptr, notificationType uint32) uintptr { iphlpapi.RegisterNotifyRouteChange2(func(callerContext uintptr, row uintptr, notificationType uint32) uintptr {

View File

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

View File

@@ -9,7 +9,16 @@ mkdir -p $DEST
#### copy binary #### #### copy binary ####
cp $BUILD/nekoray $DEST 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 #### #### copy so ####
# 5.11 looks buggy on new systems...
exit
USR_LIB=/usr/lib/x86_64-linux-gnu USR_LIB=/usr/lib/x86_64-linux-gnu
mkdir usr mkdir usr
pushd usr pushd usr