sing-box/experimental/libbox/setup.go
世界 b2092fafb7
Fix ios build
Cannot use errno as method and variable due to conflict with objc
2023-06-19 14:11:40 +08:00

38 lines
567 B
Go

package libbox
import (
"os"
C "github.com/sagernet/sing-box/constant"
"github.com/dustin/go-humanize"
)
var (
sBasePath string
sTempPath string
sUserID int
sGroupID int
)
func Setup(basePath string, tempPath string, userID int, groupID int) {
sBasePath = basePath
sTempPath = tempPath
sUserID = userID
sGroupID = groupID
if sUserID == -1 {
sUserID = os.Getuid()
}
if sGroupID == -1 {
sGroupID = os.Getgid()
}
}
func Version() string {
return C.Version
}
func FormatBytes(length int64) string {
return humanize.IBytes(uint64(length))
}