diff --git a/.gitignore b/.gitignore index 4d69c5fc..d229b98d 100644 --- a/.gitignore +++ b/.gitignore @@ -20,10 +20,8 @@ gradle-app.setting *.iml /.idea/* !/.idea/codeStyles -/core/src/foss/go/.idea/* -!/core/src/foss/go/.idea/codeStyles -/core/src/premium/go/.idea/* -!/core/src/premium/go/.idea/codeStyles +/core/src/main/golang/.idea/* +!/core/src/main/golang/.idea/codeStyles # KeyStore *.keystore diff --git a/.gitmodules b/.gitmodules index 923431b0..02cbb04e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "clash-foss"] - path = core/src/foss/go/clash + path = core/src/main/golang/core/foss + url = https://github.com/Kr328/clash.git +[submodule "clash-premium"] + path = core/src/main/golang/core/premium url = https://github.com/Kr328/clash.git diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 0dfdf937..ab9f0dcf 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -18,13 +18,15 @@ val geoipOutput = buildDir.resolve("intermediates/golang_blob") golang { sourceSets { create("foss") { - srcDir.set(file("src/foss/go")) + tags.set(listOf("foss")) } create("premium") { - srcDir.set(file("src/premium/go")) + tags.set(listOf("premium")) + moduleFile.set("go.premium.mod") } all { fileName.set("libclash.so") + srcDir.set(file("src/main/golang")) } } } diff --git a/core/src/foss/go/.idea/codeStyles/Project.xml b/core/src/main/golang/.idea/codeStyles/Project.xml similarity index 100% rename from core/src/foss/go/.idea/codeStyles/Project.xml rename to core/src/main/golang/.idea/codeStyles/Project.xml diff --git a/core/src/foss/go/.idea/codeStyles/codeStyleConfig.xml b/core/src/main/golang/.idea/codeStyles/codeStyleConfig.xml similarity index 100% rename from core/src/foss/go/.idea/codeStyles/codeStyleConfig.xml rename to core/src/main/golang/.idea/codeStyles/codeStyleConfig.xml diff --git a/core/src/foss/go/app.go b/core/src/main/golang/app.go similarity index 100% rename from core/src/foss/go/app.go rename to core/src/main/golang/app.go diff --git a/core/src/foss/go/app/app.go b/core/src/main/golang/app/app.go similarity index 100% rename from core/src/foss/go/app/app.go rename to core/src/main/golang/app/app.go diff --git a/core/src/foss/go/app/content.go b/core/src/main/golang/app/content.go similarity index 100% rename from core/src/foss/go/app/content.go rename to core/src/main/golang/app/content.go diff --git a/core/src/foss/go/app/dns.go b/core/src/main/golang/app/dns.go similarity index 100% rename from core/src/foss/go/app/dns.go rename to core/src/main/golang/app/dns.go diff --git a/core/src/foss/go/app/tun.go b/core/src/main/golang/app/tun.go similarity index 100% rename from core/src/foss/go/app/tun.go rename to core/src/main/golang/app/tun.go diff --git a/core/src/foss/go/app/ui.go b/core/src/main/golang/app/ui.go similarity index 100% rename from core/src/foss/go/app/ui.go rename to core/src/main/golang/app/ui.go diff --git a/core/src/foss/go/bridge.c b/core/src/main/golang/bridge.c similarity index 100% rename from core/src/foss/go/bridge.c rename to core/src/main/golang/bridge.c diff --git a/core/src/foss/go/bridge.h b/core/src/main/golang/bridge.h similarity index 100% rename from core/src/foss/go/bridge.h rename to core/src/main/golang/bridge.h diff --git a/core/src/foss/go/common/path.go b/core/src/main/golang/common/path.go similarity index 100% rename from core/src/foss/go/common/path.go rename to core/src/main/golang/common/path.go diff --git a/core/src/foss/go/config.go b/core/src/main/golang/config.go similarity index 100% rename from core/src/foss/go/config.go rename to core/src/main/golang/config.go diff --git a/core/src/foss/go/config/defaults.go b/core/src/main/golang/config/defaults.go similarity index 100% rename from core/src/foss/go/config/defaults.go rename to core/src/main/golang/config/defaults.go diff --git a/core/src/foss/go/config/fetch.go b/core/src/main/golang/config/fetch.go similarity index 100% rename from core/src/foss/go/config/fetch.go rename to core/src/main/golang/config/fetch.go diff --git a/core/src/foss/go/config/load.go b/core/src/main/golang/config/load.go similarity index 100% rename from core/src/foss/go/config/load.go rename to core/src/main/golang/config/load.go diff --git a/core/src/foss/go/config/override.go b/core/src/main/golang/config/override.go similarity index 100% rename from core/src/foss/go/config/override.go rename to core/src/main/golang/config/override.go diff --git a/core/src/foss/go/config/process.go b/core/src/main/golang/config/process.go similarity index 100% rename from core/src/foss/go/config/process.go rename to core/src/main/golang/config/process.go diff --git a/core/src/foss/go/config/provider_open.go b/core/src/main/golang/config/provider_open.go similarity index 100% rename from core/src/foss/go/config/provider_open.go rename to core/src/main/golang/config/provider_open.go diff --git a/core/src/foss/go/config/provider_premium.go b/core/src/main/golang/config/provider_premium.go similarity index 100% rename from core/src/foss/go/config/provider_premium.go rename to core/src/main/golang/config/provider_premium.go diff --git a/core/src/foss/go/clash b/core/src/main/golang/core/foss similarity index 100% rename from core/src/foss/go/clash rename to core/src/main/golang/core/foss diff --git a/core/src/main/golang/core/premium b/core/src/main/golang/core/premium new file mode 160000 index 00000000..fab0b092 --- /dev/null +++ b/core/src/main/golang/core/premium @@ -0,0 +1 @@ +Subproject commit fab0b09292f0d3caf46db5150c969243e35f2ee9 diff --git a/core/src/foss/go/debug.go b/core/src/main/golang/debug.go similarity index 100% rename from core/src/foss/go/debug.go rename to core/src/main/golang/debug.go diff --git a/core/src/foss/go/core/init.go b/core/src/main/golang/delegate/init.go similarity index 98% rename from core/src/foss/go/core/init.go rename to core/src/main/golang/delegate/init.go index ccc38d1e..902bb540 100644 --- a/core/src/foss/go/core/init.go +++ b/core/src/main/golang/delegate/init.go @@ -1,4 +1,4 @@ -package core +package delegate import ( "errors" diff --git a/core/src/foss/go/go.mod b/core/src/main/golang/go.mod similarity index 89% rename from core/src/foss/go/go.mod rename to core/src/main/golang/go.mod index ff8b3476..426b8ad4 100644 --- a/core/src/foss/go/go.mod +++ b/core/src/main/golang/go.mod @@ -13,6 +13,6 @@ require ( gopkg.in/yaml.v2 v2.4.0 ) -replace github.com/Dreamacro/clash => ./clash +replace github.com/Dreamacro/clash => ./core/foss replace cfa/blob => ../../../build/intermediates/golang_blob diff --git a/core/src/foss/go/go.sum b/core/src/main/golang/go.sum similarity index 100% rename from core/src/foss/go/go.sum rename to core/src/main/golang/go.sum diff --git a/core/src/foss/go/log.go b/core/src/main/golang/log.go similarity index 100% rename from core/src/foss/go/log.go rename to core/src/main/golang/log.go diff --git a/core/src/foss/go/main.go b/core/src/main/golang/main.go similarity index 93% rename from core/src/foss/go/main.go rename to core/src/main/golang/main.go index 1cea0721..f04888a8 100644 --- a/core/src/foss/go/main.go +++ b/core/src/main/golang/main.go @@ -11,7 +11,7 @@ import ( "runtime" "cfa/config" - "cfa/core" + "cfa/delegate" "cfa/tunnel" "github.com/Dreamacro/clash/log" @@ -27,7 +27,7 @@ func coreInit(home, versionName C.c_string, sdkVersion C.int) { v := C.GoString(versionName) s := int(sdkVersion) - core.Init(h, v, s) + delegate.Init(h, v, s) reset() } diff --git a/core/src/foss/go/platform/limit.go b/core/src/main/golang/platform/limit.go similarity index 100% rename from core/src/foss/go/platform/limit.go rename to core/src/main/golang/platform/limit.go diff --git a/core/src/foss/go/platform/procfs.go b/core/src/main/golang/platform/procfs.go similarity index 100% rename from core/src/foss/go/platform/procfs.go rename to core/src/main/golang/platform/procfs.go diff --git a/core/src/foss/go/proxy.go b/core/src/main/golang/proxy.go similarity index 100% rename from core/src/foss/go/proxy.go rename to core/src/main/golang/proxy.go diff --git a/core/src/foss/go/proxy/http.go b/core/src/main/golang/proxy/http.go similarity index 100% rename from core/src/foss/go/proxy/http.go rename to core/src/main/golang/proxy/http.go diff --git a/core/src/foss/go/trace.c b/core/src/main/golang/trace.c similarity index 100% rename from core/src/foss/go/trace.c rename to core/src/main/golang/trace.c diff --git a/core/src/foss/go/trace.h b/core/src/main/golang/trace.h similarity index 100% rename from core/src/foss/go/trace.h rename to core/src/main/golang/trace.h diff --git a/core/src/foss/go/tun.go b/core/src/main/golang/tun.go similarity index 100% rename from core/src/foss/go/tun.go rename to core/src/main/golang/tun.go diff --git a/core/src/foss/go/tun/dns.go b/core/src/main/golang/tun/dns.go similarity index 100% rename from core/src/foss/go/tun/dns.go rename to core/src/main/golang/tun/dns.go diff --git a/core/src/foss/go/tun/link.go b/core/src/main/golang/tun/link.go similarity index 100% rename from core/src/foss/go/tun/link.go rename to core/src/main/golang/tun/link.go diff --git a/core/src/foss/go/tun/tcp.go b/core/src/main/golang/tun/tcp.go similarity index 100% rename from core/src/foss/go/tun/tcp.go rename to core/src/main/golang/tun/tcp.go diff --git a/core/src/foss/go/tun/tun.go b/core/src/main/golang/tun/tun.go similarity index 100% rename from core/src/foss/go/tun/tun.go rename to core/src/main/golang/tun/tun.go diff --git a/core/src/foss/go/tun/udp.go b/core/src/main/golang/tun/udp.go similarity index 100% rename from core/src/foss/go/tun/udp.go rename to core/src/main/golang/tun/udp.go diff --git a/core/src/foss/go/tunnel.go b/core/src/main/golang/tunnel.go similarity index 100% rename from core/src/foss/go/tunnel.go rename to core/src/main/golang/tunnel.go diff --git a/core/src/foss/go/tunnel/conn.go b/core/src/main/golang/tunnel/conn.go similarity index 100% rename from core/src/foss/go/tunnel/conn.go rename to core/src/main/golang/tunnel/conn.go diff --git a/core/src/foss/go/tunnel/connectivity.go b/core/src/main/golang/tunnel/connectivity.go similarity index 100% rename from core/src/foss/go/tunnel/connectivity.go rename to core/src/main/golang/tunnel/connectivity.go diff --git a/core/src/foss/go/tunnel/geoip.go b/core/src/main/golang/tunnel/geoip.go similarity index 100% rename from core/src/foss/go/tunnel/geoip.go rename to core/src/main/golang/tunnel/geoip.go diff --git a/core/src/foss/go/tunnel/providers.go b/core/src/main/golang/tunnel/providers.go similarity index 100% rename from core/src/foss/go/tunnel/providers.go rename to core/src/main/golang/tunnel/providers.go diff --git a/core/src/foss/go/tunnel/providers_premium.go b/core/src/main/golang/tunnel/providers_premium.go similarity index 100% rename from core/src/foss/go/tunnel/providers_premium.go rename to core/src/main/golang/tunnel/providers_premium.go diff --git a/core/src/foss/go/tunnel/proxies.go b/core/src/main/golang/tunnel/proxies.go similarity index 100% rename from core/src/foss/go/tunnel/proxies.go rename to core/src/main/golang/tunnel/proxies.go diff --git a/core/src/foss/go/tunnel/state.go b/core/src/main/golang/tunnel/state.go similarity index 100% rename from core/src/foss/go/tunnel/state.go rename to core/src/main/golang/tunnel/state.go diff --git a/core/src/foss/go/tunnel/statistic.go b/core/src/main/golang/tunnel/statistic.go similarity index 100% rename from core/src/foss/go/tunnel/statistic.go rename to core/src/main/golang/tunnel/statistic.go diff --git a/core/src/foss/go/tunnel/suspend.go b/core/src/main/golang/tunnel/suspend.go similarity index 100% rename from core/src/foss/go/tunnel/suspend.go rename to core/src/main/golang/tunnel/suspend.go diff --git a/core/src/foss/go/utils.go b/core/src/main/golang/utils.go similarity index 100% rename from core/src/foss/go/utils.go rename to core/src/main/golang/utils.go diff --git a/settings.gradle.kts b/settings.gradle.kts index 307ffdec..b2cccde5 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -17,7 +17,7 @@ dependencyResolutionManagement { val agp = "7.0.2" val ksp = "1.5.30-1.0.0-beta09" val kotlin = "1.5.30" - val golang = "1.0.1" + val golang = "1.0.2" val coroutine = "1.5.0" val coreKtx = "1.5.0" val activity = "1.2.3"