update
This commit is contained in:
8
.github/workflows/build.yml
vendored
8
.github/workflows/build.yml
vendored
@@ -45,7 +45,7 @@ jobs:
|
||||
- { name: 'hiddify-core-android', os: 'ubuntu-latest', target: 'android' }
|
||||
- { name: 'hiddify-core-linux-amd64', os: 'ubuntu-20.04', target: 'linux-amd64' }
|
||||
- { name: "hiddify-core-windows-amd64", os: 'ubuntu-latest', target: 'windows-amd64', aarch: 'x64' }
|
||||
- { name: "hiddify-core-macos-universal", os: 'macos-12', target: 'macos-universal' }
|
||||
- { name: "hiddify-core-macos", os: 'macos-12', target: 'macos' }
|
||||
- { name: "hiddify-core-ios", os: "macos-12", target: "ios" }
|
||||
# linux custom
|
||||
- {name: hiddify-cli-linux-amd64, goos: linux, goarch: amd64, goamd64: v1, target: 'linux-custom', os: 'ubuntu-20.04'}
|
||||
@@ -117,9 +117,9 @@ jobs:
|
||||
run: |
|
||||
tree
|
||||
rm -f /*.h */*.h
|
||||
rm ./hiddify-libcore*sources* ||echo "no source"
|
||||
rm ./hiddify-libcore-macos-a*.dylib || echo "no macos arm and amd"
|
||||
files=$(ls | grep -E '^(libcore\.(dll|so|dylib|aar)|webui|Libcore.xcframework|lib|HiddifyCli(\.exe)?)$')
|
||||
|
||||
rm ./hiddify-core-* || echo "no other files to zip"
|
||||
files=$(ls | grep -E '^(hiddify-core\.(dll|so|dylib|aar)|webui|HiddifyCore.xcframework|HiddifyCli(\.exe)?)$')
|
||||
echo tar -czvf ${{ matrix.job.name }}.tar.gz $files
|
||||
tar -czvf ${{ matrix.job.name }}.tar.gz $files
|
||||
|
||||
|
||||
10
Info.plist
10
Info.plist
@@ -6,11 +6,11 @@
|
||||
<array>
|
||||
<dict>
|
||||
<key>BinaryPath</key>
|
||||
<string>Libcore.framework/Libcore</string>
|
||||
<string>HiddifyCore.framework/HiddifyCore</string>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64_x86_64-simulator</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>Libcore.framework</string>
|
||||
<string>HiddifyCore.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
@@ -23,11 +23,11 @@
|
||||
</dict>
|
||||
<dict>
|
||||
<key>BinaryPath</key>
|
||||
<string>Libcore.framework/Libcore</string>
|
||||
<string>HiddifyCore.framework/HiddifyCore</string>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>Libcore.framework</string>
|
||||
<string>HiddifyCore.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
@@ -41,7 +41,7 @@
|
||||
<key>XCFrameworkFormatVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>ios.libcore.hiddify</string>
|
||||
<string>ios.hiddifycore.hiddify</string>
|
||||
<key>CFBundleShortVersionString</key><string>3.1.8</string>
|
||||
<key>CFBundleVersion</key><string>3.1.8</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
|
||||
22
Makefile
22
Makefile
@@ -1,5 +1,5 @@
|
||||
.ONESHELL:
|
||||
PRODUCT_NAME=libcore
|
||||
PRODUCT_NAME=hiddify-core
|
||||
BASENAME=$(PRODUCT_NAME)
|
||||
BINDIR=bin
|
||||
LIBNAME=$(PRODUCT_NAME)
|
||||
@@ -37,7 +37,7 @@ lib_install:
|
||||
npm install
|
||||
|
||||
headers:
|
||||
go build -buildmode=c-archive -o $(BINDIR)/$(LIBNAME).h ./custom
|
||||
go build -buildmode=c-archive -o $(BINDIR)/$(LIBNAME).h ./platform/desktop
|
||||
|
||||
android: lib_install
|
||||
gomobile bind -v -androidapi=21 -javapkg=com.hiddify.core -libname=hiddify-core -tags=$(TAGS) -trimpath -target=android -o $(BINDIR)/$(LIBNAME).aar github.com/sagernet/sing-box/experimental/libbox ./platform/mobile
|
||||
@@ -48,8 +48,8 @@ ios-full: lib_install
|
||||
cp Libcore.podspec $(BINDIR)/$(LIBNAME).xcframework/
|
||||
|
||||
ios: lib_install
|
||||
gomobile bind -v -target ios -libname=box -tags=$(TAGS),$(IOS_ADD_TAGS) -trimpath -ldflags="-w -s" -o $(BINDIR)/Libcore.xcframework github.com/sagernet/sing-box/experimental/libbox ./mobile
|
||||
cp Info.plist $(BINDIR)/Libcore.xcframework/
|
||||
gomobile bind -v -target ios -libname=hiddify-core -tags=$(TAGS),$(IOS_ADD_TAGS) -trimpath -ldflags="-w -s" -o $(BINDIR)/HiddifyCore.xcframework github.com/sagernet/sing-box/experimental/libbox ./platform/mobile
|
||||
cp Info.plist $(BINDIR)/HiddifyCore.xcframework/
|
||||
|
||||
|
||||
webui:
|
||||
@@ -65,8 +65,8 @@ windows-amd64:
|
||||
go install -mod=readonly github.com/akavel/rsrc@latest ||echo "rsrc error in installation"
|
||||
go run ./cli tunnel exit
|
||||
cp $(BINDIR)/$(LIBNAME).dll ./$(LIBNAME).dll
|
||||
$$(go env GOPATH)/bin/rsrc -ico ./assets/hiddify-cli.ico -o ./cli/bydll/cli.syso ||echo "rsrc error in syso"
|
||||
env GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc CGO_LDFLAGS="$(LIBNAME).dll" $(GOBUILDSRV) -o $(BINDIR)/$(CLINAME).exe ./cli/bydll
|
||||
$$(go env GOPATH)/bin/rsrc -ico ./assets/hiddify-cli.ico -o ./cmd/bydll/cli.syso ||echo "rsrc error in syso"
|
||||
env GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc CGO_LDFLAGS="$(LIBNAME).dll" $(GOBUILDSRV) -o $(BINDIR)/$(CLINAME).exe ./cmd/bydll
|
||||
rm ./$(LIBNAME).dll
|
||||
make webui
|
||||
|
||||
@@ -76,7 +76,7 @@ linux-amd64:
|
||||
env GOOS=linux GOARCH=amd64 $(GOBUILDLIB) -o $(BINDIR)/lib/$(LIBNAME).so ./custom
|
||||
mkdir lib
|
||||
cp $(BINDIR)/lib/$(LIBNAME).so ./lib/$(LIBNAME).so
|
||||
env GOOS=linux GOARCH=amd64 CGO_LDFLAGS="./lib/$(LIBNAME).so" $(GOBUILDSRV) -o $(BINDIR)/$(CLINAME) ./cli/bydll
|
||||
env GOOS=linux GOARCH=amd64 CGO_LDFLAGS="./lib/$(LIBNAME).so" $(GOBUILDSRV) -o $(BINDIR)/$(CLINAME) ./cmd/bydll
|
||||
rm -rf ./lib
|
||||
chmod +x $(BINDIR)/$(CLINAME)
|
||||
make webui
|
||||
@@ -84,8 +84,8 @@ linux-amd64:
|
||||
|
||||
linux-custom:
|
||||
mkdir -p $(BINDIR)/
|
||||
#env GOARCH=mips $(GOBUILDSRV) -o $(BINDIR)/$(CLINAME) ./cli/
|
||||
go build -ldflags "-s -w" -trimpath -tags $(TAGS) -o $(BINDIR)/$(CLINAME) ./cli/main
|
||||
#env GOARCH=mips $(GOBUILDSRV) -o $(BINDIR)/$(CLINAME) ./cmd/
|
||||
go build -ldflags "-s -w" -trimpath -tags $(TAGS) -o $(BINDIR)/$(CLINAME) ./cmd/main
|
||||
chmod +x $(BINDIR)/$(CLINAME)
|
||||
make webui
|
||||
|
||||
@@ -94,10 +94,10 @@ macos-amd64:
|
||||
macos-arm64:
|
||||
env GOOS=darwin GOARCH=arm64 CGO_CFLAGS="-mmacosx-version-min=10.11" CGO_LDFLAGS="-mmacosx-version-min=10.11" CGO_ENABLED=1 go build -trimpath -tags $(TAGS),$(IOS_ADD_TAGS) -buildmode=c-shared -o $(BINDIR)/$(LIBNAME)-arm64.dylib ./platform/desktop
|
||||
|
||||
macos-universal: macos-amd64 macos-arm64
|
||||
macos: macos-amd64 macos-arm64
|
||||
lipo -create $(BINDIR)/$(LIBNAME)-amd64.dylib $(BINDIR)/$(LIBNAME)-arm64.dylib -output $(BINDIR)/$(LIBNAME).dylib
|
||||
cp $(BINDIR)/$(LIBNAME).dylib ./$(LIBNAME).dylib
|
||||
env GOOS=darwin GOARCH=amd64 CGO_CFLAGS="-mmacosx-version-min=10.11" CGO_LDFLAGS="-mmacosx-version-min=10.11" CGO_LDFLAGS="bin/$(LIBNAME).dylib" CGO_ENABLED=1 $(GOBUILDSRV) -o $(BINDIR)/$(CLINAME) ./cli/bydll
|
||||
env GOOS=darwin GOARCH=amd64 CGO_CFLAGS="-mmacosx-version-min=10.11" CGO_LDFLAGS="-mmacosx-version-min=10.11" CGO_LDFLAGS="bin/$(LIBNAME).dylib" CGO_ENABLED=1 $(GOBUILDSRV) -o $(BINDIR)/$(CLINAME) ./cmd/bydll
|
||||
rm ./$(LIBNAME).dylib
|
||||
chmod +x $(BINDIR)/$(CLINAME)
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ package main
|
||||
// Import the function from the DLL
|
||||
char* parseCli(int argc, char** argv);
|
||||
*/
|
||||
import "../../cli/bydll/C"
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
@@ -278,7 +278,7 @@ func setClashAPI(options *option.Options, opt *HiddifyOptions) {
|
||||
|
||||
CacheFile: &option.CacheFileOptions{
|
||||
Enabled: true,
|
||||
Path: "clash.db",
|
||||
Path: "data/clash.db",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ func SaveCurrentConfig(path string, options option.Options) error {
|
||||
return err
|
||||
}
|
||||
p, err := filepath.Abs(path)
|
||||
os.MkdirAll(filepath.Dir(p), 0o755)
|
||||
fmt.Printf("Saving config to %v %+v\n", p, err)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -133,7 +133,7 @@ func DefaultHiddifyOptions() *HiddifyOptions {
|
||||
},
|
||||
LogLevel: "warn",
|
||||
// LogFile: "/dev/null",
|
||||
LogFile: "box.log",
|
||||
LogFile: "data/box.log",
|
||||
Region: "other",
|
||||
EnableClashApi: true,
|
||||
ClashApiPort: 16756,
|
||||
|
||||
@@ -38,7 +38,7 @@ func StartService(in *StartRequest, platformInterface libbox.PlatformInterface)
|
||||
return errorWrapper(MessageType_EXTENSION, err)
|
||||
}
|
||||
Log(LogLevel_DEBUG, LogType_CORE, "Saving config")
|
||||
currentBuildConfigPath := filepath.Join(sWorkingPath, "current-config.json")
|
||||
currentBuildConfigPath := filepath.Join(sWorkingPath, "data/current-config.json")
|
||||
config.SaveCurrentConfig(currentBuildConfigPath, *options)
|
||||
|
||||
Log(LogLevel_DEBUG, LogType_CORE, fmt.Sprintf("Starting Service json %++v, platformInterface %v", options, platformInterface))
|
||||
|
||||
@@ -41,7 +41,7 @@ func DefaultHiddifyOptions() *HiddifyOptions {
|
||||
},
|
||||
LogLevel: "warn",
|
||||
// LogFile: "/dev/null",
|
||||
LogFile: "box.log",
|
||||
LogFile: "data/box.log",
|
||||
Region: "other",
|
||||
EnableClashApi: true,
|
||||
ClashApiPort: 16756,
|
||||
|
||||
Reference in New Issue
Block a user