platform: Add shell support for iOS
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
//go:build linux || android || (darwin && !ios)
|
//go:build linux || android || darwin || ios
|
||||||
|
|
||||||
package libbox
|
package libbox
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build !linux && !android && (!darwin || ios)
|
//go:build !linux && !android && !darwin && !ios
|
||||||
|
|
||||||
package libbox
|
package libbox
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ func (iosShellBackend) Close() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func lookupSFTPServer(_ adapter.PlatformInterface) (string, error) {
|
func lookupSFTPServer(platformInterface adapter.PlatformInterface) (string, error) {
|
||||||
return "", E.New("sftp is not supported on iOS and tvOS")
|
if platformInterface == nil {
|
||||||
|
return "", E.New("sftp is not supported on iOS and tvOS")
|
||||||
|
}
|
||||||
|
return platformInterface.LookupSFTPServer()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build unix && !ios
|
//go:build unix
|
||||||
|
|
||||||
package tailssh
|
package tailssh
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
//go:build unix && !ios
|
//go:build unix
|
||||||
|
|
||||||
package tailssh
|
package tailssh
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"runtime"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
C "github.com/sagernet/sing-box/constant"
|
||||||
E "github.com/sagernet/sing/common/exceptions"
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
|
|
||||||
"github.com/creack/pty"
|
"github.com/creack/pty"
|
||||||
@@ -75,9 +75,9 @@ func setCredential(attr *syscall.SysProcAttr, uid, gid int, groups []int) {
|
|||||||
if uid == os.Getuid() && gid == os.Getgid() {
|
if uid == os.Getuid() && gid == os.Getgid() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// macOS rejects setgroups with more than 16 groups (EINVAL), which fails the
|
// macOS and iOS reject setgroups with more than 16 groups (EINVAL), which
|
||||||
// exec; cap to the first 16.
|
// fails the exec; cap to the first 16.
|
||||||
if runtime.GOOS == "darwin" && len(groups) > 16 {
|
if C.IsDarwin && len(groups) > 16 {
|
||||||
groups = groups[:16]
|
groups = groups[:16]
|
||||||
}
|
}
|
||||||
cred := &syscall.Credential{
|
cred := &syscall.Credential{
|
||||||
|
|||||||
Reference in New Issue
Block a user