Compare commits

...

489 commits

Author SHA1 Message Date
clash-meta-maintainer[bot]
754f2801ee
Update Dependencies (#407)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-12-19 20:59:41 +08:00
汐殇
4b96ce2556
Update Proxy.kt 2024-12-19 20:59:10 +08:00
clash-meta-maintainer[bot]
15f283c1c7
Update Dependencies (#405)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-12-09 18:14:45 +08:00
clash-meta-maintainer[bot]
6c39a894ba
Update Dependencies (#401)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-12-06 11:54:36 +08:00
clash-meta-maintainer[bot]
af2a309c7a
Update Dependencies (#385)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-12-03 07:56:39 +08:00
clash-meta-maintainer[bot]
94489d1dca
Update Dependencies (#384)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-11-06 20:59:01 +08:00
GitHub Action
88f92dd98f Bump version to 2.11.2 (211002) 2024-11-03 09:34:45 +00:00
clash-meta-maintainer[bot]
deeebdb271
Update Dependencies (#371)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-11-03 17:25:29 +08:00
Trịnh Văn Lợi
f75ee05b52
Add Vietnamese (#367) 2024-10-14 20:52:22 +08:00
clash-meta-maintainer[bot]
c39838e631
Update Dependencies (#363)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-10-13 19:54:53 +08:00
wwqgtxx
b7e4ff551a fix dnsList handle 2024-10-06 00:56:02 +08:00
clash-meta-maintainer[bot]
7b828ee0d9
Update Dependencies (#362)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-10-06 00:33:37 +08:00
wwqgtxx
266c9da66d better Version and BuildTime handle 2024-10-06 00:32:33 +08:00
clash-meta-maintainer[bot]
f0f82fb9f9
Update Dependencies (#361)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-10-05 14:22:57 +08:00
clash-meta-maintainer[bot]
54cfb54b8b
Update Dependencies (#360)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-10-05 14:02:39 +08:00
clash-meta-maintainer[bot]
1430b29340
Update Dependencies (#359)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-10-05 13:42:06 +08:00
wwqgtxx
d79fbf2519 set GIT_VERSION to core 2024-10-05 13:02:40 +08:00
wwqgtxx
aea7edd2f8 add init log 2024-10-05 10:09:56 +08:00
clash-meta-maintainer[bot]
8f8c7724ba
Update Dependencies (#357)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-10-04 16:18:14 +08:00
clash-meta-maintainer[bot]
2ac1ade188
Update Dependencies (#355)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-10-01 13:23:04 +08:00
GitHub Action
6122aeffb5 Bump version to 2.11.1 (211001) 2024-09-30 05:44:31 +00:00
wwqgtxx
97f52bbcb6 adopt external-controller-cors 2024-09-30 13:12:58 +08:00
clash-meta-maintainer[bot]
e39bfe8832
Update Dependencies (#354)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-09-30 13:11:32 +08:00
wwqgtxx
36bc78070a fix patchProviders works abnormally when path is empty 2024-09-28 00:20:17 +08:00
wwqgtxx
e164e219bd code cleanup 2024-09-27 21:57:22 +08:00
clash-meta-maintainer[bot]
309726dddd
Update Dependencies (#346)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-09-27 21:53:09 +08:00
clash-meta-maintainer[bot]
786ac02a1d
Update Dependencies (#342)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-09-23 11:43:05 +08:00
wwqgtxx
e966e52b77 replace launch_name for alpha 2024-09-12 14:48:37 +08:00
GitHub Action
0e1f3f5823 Bump version to 2.11.0 (211000) 2024-09-12 06:18:29 +00:00
clash-meta-maintainer[bot]
649201f52d
Update Dependencies (#332)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-09-12 14:16:50 +08:00
wwqgtxx
bbe9dc42d2 move UpdatableProvider define in here 2024-09-12 11:18:28 +08:00
wwqgtxx
3ce66040b3 don't call provider.Suspend 2024-09-12 11:10:19 +08:00
Larvan2
43337eacd2 remove redundant 'Meta' 2024-09-12 02:55:28 +00:00
wwqgtxx
a197f8fce1 patch more unsupported config 2024-09-12 10:50:27 +08:00
wwqgtxx
8f1c235af5 call FreeOSMemory in forceGc 2024-09-12 09:57:21 +08:00
wwqgtxx
c6810bc441 support set fake-ip-filter-mode 2024-09-12 09:20:17 +08:00
ForestL
fb1c6a2cc3
add asn import (#333) 2024-09-11 22:21:39 +08:00
wwqgtxx
3cc77c7c95 support set tun stack 2024-09-11 19:46:12 +08:00
karin0
bb2c5283f8 only apply ExternalController in Override settings (#330) 2024-09-11 17:17:59 +08:00
wwqgtxx
a04c1883fa switch from dhcp://system to system:// 2024-09-11 16:30:31 +08:00
clash-meta-maintainer[bot]
e834d67922
Update Dependencies (#329) 2024-09-11 16:27:26 +08:00
wwqgtxx
cfe71bbe60 remove unneeded code 2024-09-11 15:57:56 +08:00
wwqgtxx
262a6b563c remove geoip embed and sideload
we had geoip.metadb and geosite.dat in asserts
2024-09-11 14:54:22 +08:00
clash-meta-maintainer[bot]
a1d838a98a
Update Dependencies (#328)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-09-11 13:38:57 +08:00
wwqgtxx
b1459134e8 setup grade in update-dependencies.yaml too 2024-09-11 11:01:57 +08:00
wwqgtxx
9edf35c4bc add ipv6 support for tun 2024-09-11 09:37:57 +08:00
Zongle Wang
b661d94278 Migrate to gradle/actions/setup-gradle@v4 (#293)
https://github.com/gradle/actions/releases/tag/v4.0.0
https://github.com/gradle/actions/blob/main/setup-gradle/README.md
2024-09-10 23:13:58 +08:00
clash-meta-maintainer[bot]
c82acb38d5
Update Dependencies (#326) 2024-09-10 21:50:21 +08:00
clash-meta-maintainer[bot]
7e24d7fea3
Update Dependencies (#315) 2024-09-10 17:23:09 +08:00
wwqgtxx
158e47b372 using sing-tun instead of tun2socket 2024-09-10 16:38:59 +08:00
GitHub Action
4df39342a2 Bump version to 2.10.4 (210004) 2024-09-02 08:47:41 +00:00
汐殇
0dc219193b
Merge pull request #312 from MetaCubeX/update-dependencies
Update Dependencies
2024-09-02 16:41:25 +08:00
clash-meta-maintainer[bot]
8c587fd22a Update Dependencies 2024-09-02 08:26:41 +00:00
wwqgtxx
c9fa690601 remove depend of gopkg.in/yaml.v2 2024-09-01 00:22:56 +08:00
wwqgtxx
e548b933e2 using hub.ApplyConfig to start the external controller 2024-08-31 22:48:53 +08:00
clash-meta-maintainer[bot]
90f3a09805 Update Dependencies (#311)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-08-31 22:47:18 +08:00
汐殇
d62430af1b
Merge pull request #299 from karin0/external-controller
feat: support external controller and its override settings
2024-08-31 18:01:07 +08:00
karin0
bacc75393b
feat: support external controller and its override settings 2024-08-31 17:47:17 +08:00
汐殇
fec7df02e4
Merge pull request #304 from aviraxp/patch-1
Avoid starting foreground service repeatedly
2024-08-31 01:35:26 +08:00
汐殇
0a1406eb86
Merge pull request #291 from MetaCubeX/update-dependencies
Update Dependencies
2024-08-31 01:22:57 +08:00
Wang Han
26c2ecef6d Avoid starting foreground service repeatedly 2024-08-31 00:15:22 +08:00
clash-meta-maintainer[bot]
15ef59a856 Update Dependencies 2024-08-30 12:13:34 +00:00
wwqgtxx
a9b10acac2 cleanup code 2024-08-27 11:02:45 +08:00
GitHub Action
08f87e27ed Bump version to 2.10.3 (210003) 2024-08-15 05:53:16 +00:00
Larvan2
2e0d02ac1d ci: bump go version 2024-08-15 05:39:12 +00:00
clash-meta-maintainer[bot]
904353a1f3
Update Dependencies (#278)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-08-15 13:28:54 +08:00
Shun Zi
143c84d47b
fix: (native conn.go) closeMatch logic should really close all matching conns; closes PacketConn also (#248) 2024-07-30 13:26:57 +08:00
GitHub Action
65bfd8a132 Bump version to 2.10.2 (210002) 2024-07-28 05:38:37 +00:00
汐殇
e7e870ac0f
Merge pull request #269 from MetaCubeX/update-dependencies
Update Dependencies
2024-07-28 13:22:28 +08:00
clash-meta-maintainer[bot]
f64c4b5bc9 Update Dependencies 2024-07-28 03:03:41 +00:00
clash-meta-maintainer[bot]
8d88011c08
Update Dependencies (#247)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-07-01 23:02:01 +08:00
汐殇
bc8c24af3b
fix: outbound type 2024-06-15 18:31:26 +08:00
clash-meta-maintainer[bot]
fa627f0da8
Update Dependencies (#234) 2024-06-08 18:28:25 +08:00
wwqgtxx
e701551655 add update-go-mod-replace 2024-05-24 11:40:55 +08:00
clash-meta-maintainer[bot]
7242f2719c
Update Dependencies (#228)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-05-21 12:32:43 +08:00
clash-meta-maintainer[bot]
0126d3b09d
Update Dependencies (#222) 2024-05-10 14:10:19 +08:00
Larvan2
e5bbbe28c5 fix: reject drop 2024-05-03 03:01:20 +00:00
Esing
5e397c2aed
Fix typos in README.md (#185) 2024-04-30 15:25:32 +08:00
clash-meta-maintainer[bot]
5e8d6df9f0
Update Dependencies (#218)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-04-30 15:21:59 +08:00
clash-meta-maintainer[bot]
ef88732a9a
Update Dependencies (#214)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-04-26 11:22:24 +08:00
clash-meta-maintainer[bot]
2419d14505
Update Dependencies (#212)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-04-23 12:40:26 +08:00
H1JK
937d9c5d3b ci: Update dependencies & Go version 2024-04-20 13:21:55 +08:00
Larvan2
1f6dbe4278 ci: trigger action when PR merged 2024-04-20 11:01:04 +08:00
Το μοχθηρό ^_^
e2b1b10d33 Update BaseActivity.kt (#198) 2024-04-20 10:58:31 +08:00
clash-meta-maintainer[bot]
f0d388d571
Update Dependencies (#204) 2024-04-19 23:08:05 +08:00
wwqgtxx
667d6b6109
Update build.gradle.kts 2024-04-19 12:04:19 +08:00
clash-meta-maintainer[bot]
58d16cb3de
Update Dependencies (#196)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-04-05 15:12:19 +08:00
clash-meta-maintainer[bot]
78ffee360c
Update Dependencies (#193)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-03-31 15:53:34 +08:00
Larvan2
53bc1da503
Merge pull request #190 from xixiha5230/patch-1
Use CMake string(TIMESTAMP) for portable compile timestamp
2024-03-31 15:52:23 +08:00
Larvan2
436f8600d2
Merge pull request #194 from shunf4/fix/bad_tz_override
fix: correctly convert timezone offset from Java TimeZone.getRawOffset() to arg for golang time.FixedZone
2024-03-28 15:03:02 +08:00
shunf4
669e644d81 fix: correctly convert timezone offset from Java TimeZone.getRawOffset() to arg for golang time.FixedZone 2024-03-17 18:26:51 +08:00
clash-meta-maintainer[bot]
346096aab7
Update Dependencies (#192)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-02-25 14:35:34 +08:00
clash-meta-maintainer[bot]
9506f50850
Update Dependencies (#187)
Co-authored-by: clash-meta-maintainer[bot] <148681994+clash-meta-maintainer[bot]@users.noreply.github.com>
2024-02-24 19:50:59 +08:00
xixiha5230
d7328953ba
Use CMake string(TIMESTAMP) for portable compile timestamp
The previous usage of the date command is not portable across different platforms. date is not guaranteed to be available and the format varies.

Replace it with CMake's built-in string(TIMESTAMP) command which generates a string with the given timestamp format independent of the platform. This commit changes it to use "%y%m%d" format for a YYMMDD timestamp commonly used for compilation.
2024-02-24 17:57:12 +08:00
Το μοχθηρό ^_^
2a2686fa11
Fix high-risk vulnerabilities(CIRCL's Kyber: timing side-channel (kyberslash2) ) (#186)
* chore(deps): bump github.com/cloudflare/circl in /core/src/foss/golang

Bumps [github.com/cloudflare/circl](https://github.com/cloudflare/circl) from 1.3.6 to 1.3.7.
- [Release notes](https://github.com/cloudflare/circl/releases)
- [Commits](https://github.com/cloudflare/circl/compare/v1.3.6...v1.3.7)
2024-02-20 13:42:32 +08:00
clash-meta-maintainer[bot]
1377d42dc2
Update Dependencies (#184) 2024-02-18 16:16:28 +08:00
Το μοχθηρό ^_^
c7c13b3a89
update dependency (#180) 2024-02-14 18:56:48 +08:00
clash-meta-maintainer[bot]
cd3aad232b
Update Dependencies (#183) 2024-02-14 18:15:59 +08:00
GitHub Action
c18fe9ab77 Bump version to 2.10.1 (210001) 2024-02-08 07:47:39 +00:00
clash-meta-maintainer[bot]
2832c9ee4c
Update Dependencies (#182)
Co-authored-by: clash-meta-maintainer[bot] <clash-meta-maintainer[bot]@users.noreply.github.com>
2024-02-08 11:15:35 +08:00
clash-meta-maintainer[bot]
fa360d83f8
Update Dependencies (#181) 2024-02-05 23:46:28 +08:00
clash-meta-maintainer[bot]
916d6a7777
Update Dependencies (#179)
Co-authored-by: clash-meta-maintainer[bot] <clash-meta-maintainer[bot]@users.noreply.github.com>
2024-01-24 17:59:48 +08:00
Larvan2
dccab90843 fix: delay 2024-01-21 23:38:01 +08:00
clash-meta-maintainer[bot]
c64e1a005e
Update Dependencies (#177)
Co-authored-by: clash-meta-maintainer[bot] <clash-meta-maintainer[bot]@users.noreply.github.com>
2024-01-21 17:16:33 +08:00
GitHub Action
4dd7aec7ec Bump version to 2.10.0 (210000) 2024-01-18 09:54:42 +00:00
Το μοχθηρό ^_^
8fa4e33bda Update dependency (#174)
* Add renovate.json

* fix(deps): update dependency org.jetbrains.kotlinx:kotlinx-coroutines-android to v1.7.3

* chore(deps): update dependency gradle to v7.6.3

* chore(deps): update devofure/advance-android-version-actions action to v1.5

* chore(deps): update mikepenz/release-changelog-builder-action action to v3.7.3

* chore(deps): update actions/upload-artifact action to v4

* chore(deps): update mikepenz/release-changelog-builder-action action to v4

* chore(deps): update actions/setup-go action to v5

* chore(deps): update actions/setup-java action to v4

* chore(deps): update actions/cache action to v4

* chore(deps): update actions/checkout action to v4

* chore(deps): update tibdex/github-app-token action to v2

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-18 09:54:42 +00:00
cmfaapp[bot]
1b5ce606e4 Update Dependencies (#1)
Co-authored-by: aylz10 <aylz10@users.noreply.github.com>
2024-01-18 09:54:32 +00:00
aylz10
60974e8672 修复 proxies.go 2024-01-17 05:59:44 +00:00
aylz10
2205a90de9 核心依赖变更mihomo 2024-01-17 05:59:44 +00:00
aylz10
c7666a3e01 更换核心地址 2024-01-17 05:59:44 +00:00
Steve Johnson
a08a0c1dd1 action: fix release tag 2023-11-03 10:29:19 +08:00
Steve Johnson
dc80d751cb action: better pre-release logic 2023-11-03 01:54:56 +08:00
Steve Johnson
80037c2d23 action: better release action 2023-11-03 01:53:59 +08:00
Steve Johnson
cbbcc2a6fe
Merge pull request #168 from MetaCubeX/update-dependencies
Update Dependencies
2023-11-02 20:15:35 +08:00
Steve Johnson
f8a6a6afe2 chore: update version 2023-11-02 19:17:58 +08:00
Steve Johnson
a58af39fae feat: add some override options about sniffing 2023-11-02 18:57:55 +08:00
Steve Johnson
e47dca02cf fix: remove duplicated DNS settings in meta-feature 2023-11-02 17:08:00 +08:00
clash-meta-maintainer[bot]
7d9886773a Update Dependencies 2023-11-02 08:05:45 +00:00
Steve Johnson
6caa238298 fix: fix frequent RemoteManager crash 2023-11-02 12:01:36 +08:00
Steve Johnson
546378b9c4 chore: code cleanup 2023-11-02 10:21:25 +08:00
Steve Johnson
ad471f3837 fix: adapt to format-broken logs (#165) 2023-11-02 01:52:39 +08:00
Steve Johnson
00b2c816a4
Merge pull request #166 from MetaCubeX/update-dependencies
Update Dependencies
2023-11-01 21:28:58 +08:00
riolurs
e1930528b9 fix: find process mode override 2023-11-01 21:16:23 +08:00
stevejohnson7
27c98e31f4 Update Dependencies 2023-11-01 13:12:32 +00:00
Steve Johnson
021939264f feat: add intent filters for tasker automation (#119) 2023-11-01 12:00:37 +08:00
Steve Johnson
ccfcb71565
Merge pull request #162 from MetaCubeX/update-dependencies
Update Dependencies
2023-10-31 23:11:54 +08:00
Steve Johnson
74c36ac735 chore: translate 2023-10-31 23:08:28 +08:00
Steve Johnson
b6f4f7ac62 feat: show toast after profile updated 2023-10-31 23:04:26 +08:00
Steve Johnson
bd82ba7773 fix: avoid deprecated apis 2023-10-31 17:59:21 +08:00
clash-meta-maintainer[bot]
acc573f1a8 Update Dependencies 2023-10-31 07:01:30 +00:00
Steve Johnson
9773ea73d4 feat: add rotate anim to profile update btn 2023-10-30 18:57:51 +08:00
Steve Johnson
b091a87a37 fix: fix startup crash 2023-10-29 23:51:00 +08:00
Steve Johnson
ecf03507e6 Squashed commit of the following:
commit 574fba87ab733332efa17733a6602a1649e62379
Author: Steve Johnson <stevejohnson1438@proton.me>
Date:   Sun Oct 29 21:31:23 2023 +0800

    support importing local geofile

commit ec410293f3abe29835645233349d026d3a55acc0
Author: Steve Johnson <stevejohnson1438@proton.me>
Date:   Sun Oct 29 17:18:52 2023 +0800

    release assets at runtime

commit 2dfb95bab98ba661a28efe255e2965c35c6580c4
Author: Steve Johnson <stevejohnson1438@proton.me>
Date:   Sun Oct 29 16:43:41 2023 +0800

    remove embedded country.mmdb

commit fb245ed4a3c257284685f3b1bee5d9f7333833ce
Author: Steve Johnson <stevejohnson1438@proton.me>
Date:   Sun Oct 29 16:35:14 2023 +0800

    simplity gradle

commit 2fb75c87a13dea7e5c8f8f4126cc53d2d6926b99
Author: Steve Johnson <stevejohnson1438@proton.me>
Date:   Sun Oct 29 16:06:17 2023 +0800

    add geofiles download
2023-10-29 21:38:36 +08:00
Steve Johnson
4051033d7d
Merge pull request #161 from MetaCubeX/update-dependencies
Update Dependencies
2023-10-28 00:52:00 +08:00
stevejohnson7
64fcf59a5f Update Dependencies 2023-10-27 16:38:23 +00:00
Steve Johnson
2aae2257b3
Merge pull request #158 from MetaCubeX/update-dependencies
Update Dependencies
2023-10-27 00:57:06 +08:00
Steve Johnson
e0559f8f70 action: revert signing process as PR cannot access secrets 2023-10-27 00:56:33 +08:00
stevejohnson7
a931a882b1 Update Dependencies 2023-10-26 14:40:49 +00:00
Steve Johnson
d0e0a04981 action: fix name 2023-10-26 21:33:53 +08:00
Steve Johnson
ec78180820 action: upload aritfacts when PR 2023-10-26 21:20:21 +08:00
xishang0128
c78945aa3a chore: add http proxy block list 2023-10-24 16:32:31 +08:00
Steve Johnson
a7f3663d01
Merge pull request #155 from MetaCubeX/update-dependencies
Update Dependencies
2023-10-24 11:00:23 +08:00
stevejohnson7
f89fad5410 Update Dependencies 2023-10-24 02:47:17 +00:00
Steve Johnson
1b8799b1a3 docs: add maintainance documentation 2023-10-23 18:22:35 +08:00
Steve Johnson
a097278076
Merge pull request #152 from MetaCubeX/update-dependencies
Update Dependencies
2023-10-23 16:00:28 +08:00
Steve Johnson
1b44bf26b9 chore: fix actions 2023-10-23 15:59:43 +08:00
Steve Johnson
fbf1aee8a7 chore: add auto labels for issue-template 2023-10-23 15:57:31 +08:00
stevejohnson7
e04d532c2a Update Dependencies 2023-10-23 03:15:26 +00:00
Steve Johnson
15e0d87c6d
Merge pull request #148 from Doddddd/patch-1
Update build-release workflows
2023-10-23 10:22:32 +08:00
Steve Johnson
191c8bc2dc chore: change upstream to android-real 2023-10-23 10:05:41 +08:00
clash-meta-maintainer[bot]
79366ba9c1
Update Dependencies (#151)
Co-authored-by: wwqgtxx <wwqgtxx@users.noreply.github.com>
2023-10-22 22:53:51 +08:00
Steve Johnson
9a895feb6c chore: update actions to auto trigger check in PR 2023-10-22 21:48:35 +08:00
wwqgtxx
115abf8ea7
Update build-release.yaml 2023-10-22 21:31:17 +08:00
wwqgtxx
184a19dbb4 fix fetch context cancel 2023-10-22 21:27:21 +08:00
Steve Johnson
f2de7bb124 fix: pull all history to fillful git describe 2023-10-22 21:15:41 +08:00
wwqgtxx
2d1011694c
only go mod tidy in update-dependencies.yaml 2023-10-22 21:06:05 +08:00
wwqgtxx
c3da619dcf fix build 2023-10-22 21:00:43 +08:00
Steve Johnson
14f7fefd8a fix: fix bad actions 2023-10-22 20:47:09 +08:00
wwqgtxx
927727dee1 dependent clean 2023-10-22 20:31:24 +08:00
wwqgtxx
d4c078bab0 using clashHttp in config/fetch.go 2023-10-22 20:09:33 +08:00
Steve Johnson
e5563b392e Merge branch 'fix-actions' 2023-10-22 19:59:49 +08:00
Steve Johnson
2131a85699 fix: fix broken actions 2023-10-22 19:59:30 +08:00
Doddddd
d6c3ca83e6
Merge branch 'main' into patch-1 2023-10-22 19:05:34 +08:00
wwqgtxx
7811edb88c
Update build-release.yaml 2023-10-22 18:19:57 +08:00
Doddddd
e30a3b415e fix 2023-10-22 09:18:34 +00:00
Doddddd
81e6e2578f
Update workflows 2023-10-22 16:56:10 +08:00
wwqgtxx
57504a7e8e don't using deprecated tunnel.TCPIn() 2023-10-22 16:49:49 +08:00
Steve Johnson
14a961f521
Update Meta Core to v1.16.0 and add actions to help maintain the project (#147)
* add: Create dependabot.yml

* chore: Create update-dependencies.yml

* chore: Update update-dependencies.yml

* fix: switch meta core upstream

* chore: Update update-dependencies.yml

* chore: Update update-dependencies.yml

* chore: Update update-dependencies.yml

* chore: Update build-unsigned.yaml

* chore: Delete .github/dependabot.yml

* chore: Run build-unsigned for each PR

* chore: Better PR info and add repo dispatch listener

* chore: Better actions name

* chore: rename ci file and try to fix failure

* chore: add manual auto project version  bump

* chore: Fix wrong command usage

* chore: fix path

* chore: Fix

* chore: Fix bump project version

* chore: can this pass compile?

* chore: update core to newest alpha

* Update update-dependencies.yaml

* chore: try to change core upstream

* chore: remove all go get update to pass compile

* Revert "chore: remove all go get update to pass compile"

This reverts commit aad0ec3b83.

* Revert "chore: can this pass compile?"

This reverts commit 635289639b.

* chore: force update submodule

* chore: change upstream to alpha

* chore: remove rubbish

* chore: change upstream and update core

* chore: add version fixed packages

* chore: small fix

* chore: update go dependencies

* chore: revert some depends to old versions to fix compile

* fix: fix compile error caused by core's deprecation

* chore: fix actions and update core

* chore: update clash core

* fix: fix block calling

* chore: update app version

* chore: small fix to actions

* feat: add Hysteria2 for UI

* chore: revert version update for actions test

* chore: try recover main go mod upgrade

* chore: fix tag logic in release actions

* Bump version to 2.8.10 (208010)

* chore: remove test code in actions

---------

Co-authored-by: GitHub Action <action@github.com>
2023-10-22 15:57:35 +08:00
stitch.rs
a21dc96f01
Merge pull request #136 from wzfdgh/main
upd url
2023-10-22 12:00:42 +08:00
wzfdgh
2250714569
upd url 2023-09-08 19:51:02 +08:00
riolu.rs
cab2840b66 Merge remote-tracking branch 'origin/main' 2023-09-01 09:01:53 +08:00
cgcel
bb14957982 add: monochrome icon for Material You theme 2023-09-01 09:00:41 +08:00
Andrei Shevchuk
fa530a47d6
Add Russian translation (#118)
* Add Russian translation
2023-08-31 19:59:04 -05:00
riolu.rs
9dc7e5f229 chore: bump version 2023-09-01 08:53:11 +08:00
riolu.rs
fd433244c7 chore: bump version 2023-07-15 17:10:43 +08:00
riolu.rs
6d5dd87551 chore: bump version 2023-06-23 11:54:51 +08:00
cubemaze
d6a33bc81b chore: bump version 2023-06-13 17:28:10 +08:00
cubemaze
a4d7747078 chore: bump version 2023-06-03 22:56:27 +08:00
cubemaze
008e99417e chore: bump version 2023-05-22 13:38:39 +08:00
cubemaze
26a47020fe chore: bump version 2023-05-15 23:03:40 +08:00
cubemaze
b328766b80 chore: bump version 2023-05-15 22:58:03 +08:00
cubemaze
30ce16d086 chore: update core 2023-05-15 22:56:47 +08:00
cubemaze
73ebba3329 chore: update core 2023-05-12 13:07:31 +08:00
cubemaze
1462d70ed2 chore: update core 2023-05-11 21:11:59 +08:00
cubemaze
38ccdfe869 chore: update core 2023-05-11 15:06:15 +08:00
cubemaze
07e7f0c139 fix: subscription 2023-05-11 15:00:59 +08:00
cubemaze
ec489ab491 chore: bump version 2023-05-11 13:25:48 +08:00
cubemaze
ed02d0d13d chore: bump version 2023-05-11 01:57:56 +08:00
cubemaze
31999bf09c chore: workflow 2023-05-11 01:50:55 +08:00
cubemaze
e93267cf62 chore: update 2023-05-10 20:52:50 +08:00
metacubex
da805707e4 chore: bump version 2023-05-02 03:51:42 +08:00
metacubex
9038de1e62 chore: bump version 2023-04-28 17:30:41 +08:00
metacubex
2229b04f27 chore: bump version 2023-04-26 14:15:38 +08:00
metacubex
68a575367a chore: update core 2023-04-26 14:15:07 +08:00
metacubex
4a71c6ad11 chore: update core 2023-04-26 11:31:31 +08:00
metacubex
7b144a84e5 chore: bump version 2023-03-20 17:15:04 +08:00
metacubex
86e94da6a6 fix: the error caused by too large value of subscription information 2023-02-27 18:36:12 +08:00
metacubex
1d86190f8f chore: bump version 2023-02-20 22:29:16 +08:00
metacubex
5fd4713a1e chore: bump version 2023-02-10 15:08:11 +08:00
metacubex
b173a0809c chore: changelog builder 2023-02-09 16:30:15 +08:00
cubemaze
ac95f41c81
Update build-pre-release.yaml 2023-02-05 10:29:26 +08:00
cubemaze
b83ba170f4
Update build-unsigned.yaml 2023-02-05 10:28:58 +08:00
cubemaze
c9731ae37a
Merge pull request #43 from H1JK/main
chore: bump version & Go 1.20
2023-02-05 00:56:38 +08:00
H1JK
f112fa1b74 chore: bump version & Go 1.20 2023-02-05 00:11:21 +08:00
metacubex
9aa1e56d89 chore: bump version 2023-01-28 12:22:49 +08:00
metacubex
06dfa140d8 chore: bump version 2023-01-24 16:15:39 +08:00
metacubex
01474ca37e chore: bump version 2023-01-17 23:12:26 +08:00
metacubex
79f335cc5b chore: bump version 2023-01-17 22:45:43 +08:00
metacubex
723bfb5653 chore: bump version
* Support VLESS XUDP
* Modify the value of MaxDatagramSize to improve the upload speed of TUIC
2023-01-12 01:04:24 +08:00
metacubex
ee5d50dfe0 chore: bump version 2023-01-10 23:58:19 +08:00
metacubex
38d7ed94a6 chore: bump version 2023-01-01 21:29:52 +08:00
metacubex
0083fe0db8 chore: update core 2022-12-29 20:50:52 +08:00
metacubex
9587632c49 chore: adjust grid style 2022-12-29 20:49:18 +08:00
metacubex
4467ef3351 chore: bump version 2022-12-23 14:52:13 +08:00
metacubex
95f2bd3002 chore: update core 2022-12-23 14:50:24 +08:00
metacubex
a0021a0f73 chore: update core 2022-12-21 16:18:48 +08:00
metacubex
2fd3bb4a36 chore: update core 2022-12-18 17:04:18 +08:00
metacubex
de6311c698 fix: profile crash 2022-12-18 17:01:48 +08:00
metacubex
f675392143 chore: update core 2022-12-15 13:26:17 +08:00
metacubex
8794a53fc8 chore: update core 2022-12-11 16:22:06 +08:00
metacubex
51e5142866 chore: bump version 2022-12-11 13:48:54 +08:00
metacubex
b93d95cb1a chore: update core 2022-12-11 13:42:34 +08:00
metacubex
1eb561c784 chore: support double multiple grid 2022-12-11 13:38:36 +08:00
metacubex
e8b9603bdd fix: This is ignored when the URL scheme is "http" 2022-12-10 17:59:29 +08:00
metacubex
2ab1571e3a fix: type error for subscription 2022-12-10 13:42:28 +08:00
metacubex
c6084c67a5 chore: bump version 2022-12-10 11:40:17 +08:00
metacubex
b6ec92e642 chore: adjust profile layout 2022-12-10 11:39:34 +08:00
metacubex
05e4237e71 chore: clean code 2022-12-10 11:36:49 +08:00
metacubex
e06c901bf5 feat: show subscription 2022-12-10 10:17:58 +08:00
metacubex
d2f5503330 chore: root Project name 2022-12-10 00:27:55 +08:00
metacubex
38d79e57ca chore: update core 2022-12-09 23:30:36 +08:00
metacubex
f6735f5863 chore: bump version 2022-12-09 15:11:44 +08:00
metacubex
cf80984e52 fix: proxy providers not filtered in proxy groups 2022-12-09 15:11:44 +08:00
metacubex
3d69aeaca1 fix: geoip geosite mmdb url 2022-12-08 23:43:17 +08:00
metacubex
ee0b2f9361 fix: decrease mtu 2022-12-08 21:20:21 +08:00
metacubex
fff0cc277d feat: geoip geosite mmdb setting 2022-12-08 18:32:30 +08:00
metacubex
d9c8a39948 feat: tuic support 2022-12-08 17:20:56 +08:00
metacubex
2803a540e3 chore: update workflows 2022-12-08 16:44:08 +08:00
metacubex
9d98b90cae chore: bump version 2022-12-08 16:32:15 +08:00
metacubex
e607a75882 chore: bump version 2022-12-08 16:30:41 +08:00
cubemaze
ae9ef717a3
Merge pull request #25 from G5Hg3EmMa9ss97/main
Translation: Add ja-rJP and ko-rKR strings
2022-11-20 15:11:43 +08:00
unknown
e40ca8f007 Translation: Add ja-rJP and ko-rKR strings 2022-11-20 15:07:07 +08:00
metacubex
353a551870 chore: bump version 2022-11-16 18:56:05 +08:00
metacubex
d083aea38e chore: bump version 2022-11-11 01:42:01 +08:00
metacubex
fd0faa3a97 chore: bump version 2022-11-03 17:55:13 +08:00
metacubex
f442dd7082 chore: change icon 2022-11-03 17:41:02 +08:00
metacubex
244d788146 Merge remote-tracking branch 'origin/main' 2022-11-02 15:18:04 +08:00
metacubex
306a3abd6c chore:update 2022-11-02 15:17:29 +08:00
metacubex
e1933944a3 Merge remote-tracking branch 'origin/main' 2022-11-02 15:15:14 +08:00
metacubex
921e420add chore:update 2022-11-02 15:14:45 +08:00
metacubex
09e55cf2d2 chore:update 2022-11-02 15:14:39 +08:00
metacubex
6f3d2a213c chore:update 2022-11-02 14:58:21 +08:00
Howard Cheung
5bc2162df0
Chore: bump version 2022-09-04 20:29:37 +08:00
Howard Cheung
8d69bad65b
Merge pull request #9 from h0cheung/fix-group-upstream
[2/2] fix: proxy providers not filtered in proxy groups
2022-09-04 20:23:43 +08:00
Howard Cheung
cfc35e1028 fix: proxy providers not filtered in proxy groups 2022-09-04 14:55:18 +08:00
MetaCubeX
6d30c58054
Merge pull request #3 from Poussinou/patch-2
Update README.md
2022-07-20 23:25:56 +08:00
djoeni
5255a0de81 Feature: add prefer h3 dns 2022-07-16 05:59:21 +07:00
djoeni
6626e1649b Chore: update clash meta core 2022-07-16 05:57:40 +07:00
Poussinou
af37c0625d
Update README.md 2022-07-13 15:41:48 +02:00
MetaCubeX
44ab789450
Merge pull request #2 from linsui/typo
fastlane: fix a typo
2022-07-06 20:42:54 +08:00
linsui
f5a93057ad fastlane: fix a typo 2022-07-06 19:39:07 +08:00
MetaCubeX
97d8907a76
Merge pull request #1 from linsui/fastlane
fastlane for F-Droid
2022-07-06 19:19:46 +08:00
linsui
fd410ab38e fastlane for F-Droid 2022-07-06 18:57:11 +08:00
djoeni
44199eb5ba Chore: bump version 2022-07-03 23:41:59 +07:00
djoeni
415fcadb8e Chore: Update Dependencies 2022-07-03 23:38:34 +07:00
Kr328
f856c3f85f Improve: increase tun mtu 2022-07-03 23:23:01 +07:00
Kr328
03bc3c0876 Chore: update dependencies & remove appcenter tracker 2022-07-03 23:22:04 +07:00
apevogoci
d753ca7225 Improve: Try tcp6&udp6 files first when search UID for connection (#1514) 2022-07-03 23:18:39 +07:00
djoeni
a0cdb8acbe
Chore: Change package name 2022-06-28 16:23:53 +07:00
djoeni
8695ef75de Chore: Update Dependencies 2022-06-28 14:09:39 +07:00
djoeni
53f3fad499 Chore: Change proxy grid layout to 3 2022-06-22 19:03:59 +07:00
djoeni
fcbeec95e4 Chore: Fix geox url setting 2022-06-22 18:37:13 +07:00
djoeni
7048c10f1d default dns setting from config 2022-06-20 00:30:08 +07:00
djoeni
a4091cc776 optimize 2022-06-18 20:04:51 +07:00
djoeni
6fa31f96b9 update submodule 2022-06-18 20:02:03 +07:00
djoeni
bef2d5ae77
fix checkout 2022-06-18 12:21:23 +07:00
djoeni
d10b80f39d change name 2022-06-18 11:49:23 +07:00
djoeni
11c9d7fd2d Merge remote-tracking branch 'origin/main' 2022-06-18 09:49:49 +07:00
djoeni
968e25bc6b fix test build 2022-06-18 09:49:00 +07:00
djoeni
8b2ef8aaac
Add files via upload 2022-06-18 07:22:07 +07:00
djoeni
46519a6cf8 test build 2022-06-18 07:16:17 +07:00
djoeni
db9406655f Update dependencies 2022-06-17 06:27:27 +07:00
djoeni
814097ab19 fix url 2022-06-16 15:02:06 +07:00
djoeni
34f1e6f984 add setting meta features 2022-06-16 14:32:16 +07:00
djoeni
41127e9312 optimize for meta 2022-06-16 14:30:12 +07:00
djoeni
1de0c80e40 Change Icon 2022-06-16 14:27:24 +07:00
djoeni
e84d3ce7cc Switch Upstream 2022-06-16 14:24:43 +07:00
世界
a5942862ff
Switch upstream 2022-06-09 16:33:19 +08:00
kr328
a405372f6a Fix: operate clipboard on main thread 2022-05-16 20:00:48 +08:00
kr328
b472580ca6 Improve: add label to tun service 2022-05-16 19:53:32 +08:00
kr328
5a587167ae Improve: add workgroup to default fake-ip-filter 2022-05-16 19:47:55 +08:00
kr328
5149caf2b6 Improve: add ifly ime api to http proxy black list 2022-05-16 19:45:13 +08:00
kr328
ffa559a571 Chore: bump version 2022-05-13 13:50:39 +08:00
kr328
5c3ab5470a Chore: update dependencies 2022-05-12 20:15:21 +08:00
kr328
e6859ff56d Fix: use package if only single app in sharedUid group 2022-05-12 20:15:00 +08:00
kr328
f16b0048f3 Chore: update dependencies 2022-04-25 23:13:05 +08:00
kr328
17b3a0d0ed Chore: update clash core 2022-04-25 23:12:54 +08:00
kr328
1e9f38f2bb Chore: bump version 2022-04-25 12:25:50 +08:00
Kr328
ef8f9e5738
Chore: create FUNDING.yml 2022-04-25 12:12:59 +08:00
kr328
bf59ead3b2 Feature: close all connections on reset 2022-04-20 00:39:46 +08:00
kr328
5dbd94e42c Chore: update issue template 2022-04-15 14:31:10 +08:00
kr328
b92fc860eb Chore: bump version 2022-04-14 14:13:56 +08:00
kr328
20bdf171ee Feature: add zero-copy support 2022-04-14 14:13:38 +08:00
kr328
5a6ca2ce12 Chore: bump version 2022-04-11 20:59:27 +08:00
kr328
636941da70 Fix: add *.jd.com to system proxy blacklist 2022-04-11 20:49:00 +08:00
kr328
5bc3975591 Fix: fix traffic format 2022-04-11 20:49:00 +08:00
kr328
5e54e4561c Chore: minor default dns config changes 2022-04-11 20:49:00 +08:00
kr328
a7b560b576 Fix: LoadDefault should not apply dns patch 2022-04-11 20:49:00 +08:00
kr328
5f9d4c1572 Chore: minor default dns changes 2022-04-11 20:49:00 +08:00
kr328
a83ecb8b22 Chore: update clash core 2022-04-11 20:49:00 +08:00
Goooler
1cc88cc04f
Chore: cache go on CI (#1440) 2022-03-22 20:36:31 +08:00
Goooler
92bce6c2c6
Chore: optimize CI (#1414)
* Bump checkout action to v3

* Bump setup-java action to v3 & Java 17

* Bump setup-go action to v3

* Use gradle-build-action

* Go 1.18

* Insert a new line
2022-03-22 18:41:06 +08:00
kr328
ab96790c73 Chore: update dependencies 2022-03-22 13:48:02 +08:00
kr328
d5618321e9 Chore: update clash core 2022-03-22 13:47:11 +08:00
Kr328
4b8fc6ae9a Chore: update dependencies 2022-02-21 19:48:35 +08:00
人工知能
152e24748b
Chore: update zh-rTW translate (#1386)
* Update strings.xml

* Update strings.xml

* Update strings.xml

* Update strings.xml

* Update strings.xml
2022-02-21 19:40:06 +08:00
Kr328
2efdf21130 Chore: update clash core 2022-02-21 19:24:48 +08:00
Kr328
e99c2b64b0 Fix: add mark for issues template 2022-02-21 11:22:16 +08:00
Kr328
3915d9549e Chore: ignore .github on build 2022-02-21 11:21:00 +08:00
Kr328
23077537f9 Fix: fix issue template 2022-02-21 11:19:43 +08:00
Kr328
de0cbd6b29 Chore: refactor issue template 2022-02-21 11:15:41 +08:00
Kr328
d0efa0690a Chore: fix bug report form 2022-02-21 01:50:30 +08:00
Kr328
5b6d04d558 Chore: replace bug report with issues forms 2022-02-21 01:46:07 +08:00
Kr328
791794f59d Chore: bump version 2022-01-15 00:15:02 +08:00
Kr328
6a6465ae5b Chore: update dependencies 2022-01-15 00:13:05 +08:00
Kr328
056a78c7c4 Improve: update default fake filter list 2022-01-15 00:07:52 +08:00
YeyeBBC
11b0025faf
Slightly adjust QuickSettings Tile icon and App icon, making the cat more visually centred rather than geometrically centred. (#1341) 2022-01-15 00:02:25 +08:00
Kr328
3009b29e0c Chore: update dependencies 2022-01-14 23:59:14 +08:00
Kr328
5d52d970a3 Chore: clean code 2022-01-14 23:59:00 +08:00
Kr328
aef0b84275 Fix: disable tproxy & redir by default 2022-01-14 23:58:46 +08:00
Kr328
12c704d89c Chore: reformat build.gradle.kts 2022-01-14 23:40:41 +08:00
Kr328
38e070a565 Chore: update clash core 2022-01-14 23:39:33 +08:00
Kr328
c7d33c684b Chore: clean build gradle 2022-01-14 23:20:01 +08:00
Kr328
b2661d31fd Chore: update dependencies 2022-01-14 23:10:16 +08:00
kr328
53aa718674 Improve: patch all dns to core 2021-11-21 19:56:06 +08:00
okhowang
c173114368
Fix: crash with app icon (#1260) 2021-11-21 17:41:21 +08:00
kr328
7006cb516c Chore: update clash core 2021-11-21 17:17:33 +08:00
kr328
7809c30052 Refactor: refactor network observer 2021-11-21 16:55:55 +08:00
kr328
7e46d75159 Chore: update default fake-ip-filter 2021-11-21 13:54:31 +08:00
kr328
87f96b9ec7 Chore: bump version 2021-11-21 13:38:09 +08:00
kr328
3920f338f6 Chore: filter out premium build if unavailable 2021-11-21 13:38:01 +08:00
kr328
2565231867 Chore: remove unused ErrInvalidType 2021-11-21 13:31:34 +08:00
kr328
b7af3f7341 Fix: fix update profile dial 2021-11-21 13:31:25 +08:00
kr328
d93a7af534 Fix: fix network observe 2021-11-21 13:01:56 +08:00
kr328
1dcc8307ee Chore: remove unused patch proxy group 2021-11-21 13:01:44 +08:00
kr328
9936a9469d Fix: fix tun local addr 2021-11-21 13:01:27 +08:00
kr328
0e245b8936 Fix: downgrade kotlin version 2021-11-16 21:04:18 +08:00
kr328
226c11dda3 Chore: bump version 2021-11-16 20:29:46 +08:00
kr328
8330054a81 Chore: update dependencies 2021-11-16 20:29:36 +08:00
kr328
c7cb1dab38 Improve: disable network observer on screen off 2021-11-16 20:23:54 +08:00
kr328
a3686c16d4 Chore: update dependencies 2021-11-16 20:03:54 +08:00
kr328
b2a6a6a1ac Chore: update tun2socket 2021-11-16 19:59:34 +08:00
kr328
e3e9a8ccc3 Fix: fix tunnel dialer 2021-11-16 19:59:22 +08:00
kr328
7058c7a4cd Chore: update dependencies 2021-11-16 19:58:50 +08:00
kr328
2591de1c1d Chore: bump version 2021-11-14 21:09:02 +08:00
kr328
d20f19c08f Fix: fix network observer 2021-11-14 20:56:57 +08:00
kr328
a5ba4b4d23 Chore: update clash core 2021-11-14 20:55:35 +08:00
kr328
094815a098 Improve: remove loopback block & add allow bypass 2021-11-14 20:42:52 +08:00
kr328
5224fa656c Chore: clean compat code 2021-11-14 20:33:37 +08:00
kr328
73550164a8 Refactor: refactor network observer 2021-11-14 20:33:25 +08:00
kr328
48a9ab313e Chore: mark foss is default 2021-11-14 19:45:33 +08:00
kr328
25936c8361 Fix: fix dns fake-ip patch 2021-11-14 19:40:02 +08:00
kr328
3397cdd95f Chore: update dependencies 2021-11-14 19:17:06 +08:00
kr328
69f8ff2688 Chore: update clash core 2021-11-14 15:45:31 +08:00
kr328
41ab062103 Refactor: migrate to tun2socket 2021-11-14 14:50:11 +08:00
Kr328
c78431a0fb Chore: bump version 2021-10-15 11:07:10 +08:00
Kr328
3b33216961 Chore: update dependencies 2021-10-15 11:07:00 +08:00
Kr328
6373636d57 Chore: update clash core 2021-10-15 10:42:00 +08:00
Kr328
04a1f9987e Chore: update tun2socket 2021-10-15 10:41:54 +08:00
Kr328
90d286cd5a Chore: update gitignore 2021-09-26 10:04:35 +08:00
Kr328
1826d108a5 Chore: bump version 2021-09-24 11:24:05 +08:00
Goooler
a5619bb0ee
Chore: add cache action in CI (#1201) 2021-09-24 11:15:07 +08:00
Goooler
5c1fadaba2
Chore: update dependencies (#1198) 2021-09-24 11:13:10 +08:00
Kr328
7928f4321a Chore: update clash core 2021-09-24 11:11:47 +08:00
Kr328
3b62367003 Chore: bump version 2021-09-17 11:21:21 +08:00
Kr328
c8994d8488 Chore: add version to output apks name 2021-09-17 11:19:03 +08:00
kr328
4033994111 Chore: bump version 2021-09-14 01:50:06 +08:00
kr328
2050fb56d0 Chore: update clash core 2021-09-14 01:49:45 +08:00
kr328
eeea9d0fce Fix: add zhihu to http proxy black list 2021-09-14 01:07:55 +08:00
kr328
4b1f7a76c7 Chore: update dependencies 2021-09-13 22:44:01 +08:00
kr328
db2a7feb34 Chore: remove dependencies update detect plugin 2021-09-13 22:41:19 +08:00
Goooler
8b91b2eeb1
Chore: add .gitattributes (#1191)
* Add .editorconfig

* Add .gitattributes

* Remove indent_style

* Remove .editorconfig
2021-09-13 18:34:34 +08:00
Goooler
899803739b
Chore: remove unused dependencies & improve gradle properties & code style (#1189)
* Inline version strings

* Optimize gradle

* Remove kotlin-stdlib-jdk7

* Add jvmargs in gradle.properties

* Revert "Inline version strings"

This reverts commit ad2ab2bb

* Revert asserts
2021-09-13 17:49:23 +08:00
Goooler
1ea3a5b682 Chore: bump setup-java action & Remove setup-android action (#1188)
* Bump setup-java action to v2

* Remove setup-android action

* Remove ignore rules under github folder
2021-09-13 17:45:46 +08:00
kr328
f21cf86cc4 Chore: allow run workflow only main branch 2021-09-12 18:31:16 +08:00
kr328
bb1052bbc7 Chore: update README.md 2021-09-12 18:25:09 +08:00
kr328
7dad08346c Chore: update dependencies 2021-09-12 18:02:30 +08:00
kr328
b7c56e58ae Chore: add hideapi to app module to avoid r8 class missing 2021-09-12 17:50:48 +08:00
kr328
a6f6da5bc5 Chore: remove unused check 2021-09-12 17:39:04 +08:00
kr328
f271ba3d97 Feature: add dns.geoip-code support 2021-09-12 17:38:52 +08:00
kr328
66d02c7e2d Chore: bump version 2021-09-12 13:19:55 +08:00
kr328
0406573317 Refactor: refactor properties 2021-09-12 13:19:40 +08:00
kr328
4a8b6b2704 Refactor: refactor design structure 2021-09-12 13:01:08 +08:00
kr328
603cec113c Chore: update clash patch 2021-09-12 12:40:15 +08:00
kr328
a579c7bb86 Fix: should not delay before patch system dns 2021-09-12 12:24:09 +08:00
kr328
654c488ed8 Fix: fix time zone 2021-09-12 11:46:20 +08:00
kr328
ecfb339680 Chore: fix code style 2021-09-12 11:26:27 +08:00
kr328
ecbe222a50 Chore: update dependencies 2021-09-12 11:14:45 +08:00
kr328
aacf62c259 Chore: update dependencies 2021-09-12 11:04:26 +08:00
kr328
3973fb2706 Fix: fix premium build 2021-09-12 01:33:52 +08:00
kr328
07ff81f4db Fix: should add main golang source as input 2021-09-12 00:43:32 +08:00
kr328
c0e1e45b72 Refactor: refactor clash core building 2021-09-12 00:39:59 +08:00
Kr328
b07f70ab0b Improve: should not reload profile on network changed 2021-09-11 23:37:54 +08:00
Kr328
e1a35f8b2d Chore: bump go version to 1.17 2021-09-11 19:49:26 +08:00
kr328
e364af393a Refactor: refactor golang flavor 2021-09-11 18:29:05 +08:00
Kr328
11c4e19e0c
Refactor: refactor project structure & update clash core (#1174)
* Refactor: refactor project structure

* Chore: remove apply

* Chore: update clash core

* Fix: fix versionName & versionCode patch

* Chore: update golang plugin

* Fix: fix workflow build
2021-09-11 14:53:09 +08:00
Kr328
fa23be76ed Chore: update tun2socket 2021-06-20 13:22:48 +08:00
kr328
8e50d35eba Fix: fix GLOBAL url testing 2021-06-19 19:37:19 +08:00
kr328
1112534be6 Chore: bump version 2021-06-19 14:00:26 +08:00
kr328
784f249d54 Chore: migrate to new clash core 2021-06-19 13:59:58 +08:00
kr328
d6ad21b402 Chore: update clash core 2021-06-19 13:59:10 +08:00
kr328
bd03cac80d Chore: remove system proxy timeout 2021-06-19 13:39:29 +08:00
yi_Xu
da3ee71dfd
Docs: update readme (#1044)
* docs: update README.md

- Fix the path and name of the release.
- Format the style with markdownlint.

* docs: fix apk name

* ci: add paths-ignore for workflow
2021-06-17 22:10:03 +08:00
kr328
62fb089e27 Fix: system proxy should handle connection in parallel 2021-06-13 18:21:51 +08:00
kr328
51dab21f6f Chore: bump version 2021-06-13 14:19:00 +08:00
kr328
9e89b3a201 Chore: update clash core 2021-06-13 14:19:00 +08:00
kr328
1c1e2b9f3d Chore: update dependencies 2021-06-13 14:19:00 +08:00
kr328
e2e0238dcd Chore: update tun2socket 2021-06-13 14:19:00 +08:00
Tragic Life
9745e11da4
Chore: update zh-TW translate (#1063) 2021-06-13 12:38:33 +08:00
kr328
8ae7ccbfc9 Chore: add coroutine-android proguard rules 2021-06-13 12:32:34 +08:00
kr328
5a2229596a Chore: use coroutine-android instead of core 2021-06-13 12:32:10 +08:00
kr328
a463d94480 Chore: bump version 2021-06-13 04:22:53 +08:00
kr328
750abc8c71 Improve: enable system proxy by default 2021-06-13 04:22:15 +08:00
kr328
8375fbd8b3 Fix: add http timeout & disable keep-alive 2021-06-13 02:45:20 +08:00
kr328
394e406a36 Chore: update tun2socket 2021-06-13 02:35:35 +08:00
kr328
2645af0d4c Chore: update tun2socket 2021-05-29 19:56:21 +08:00
Kr328
48222c22c8 Fix: should close connection if match blocking list 2021-05-29 00:35:04 +08:00
kr328
d6a71267c6 Chore: bump version 2021-05-28 23:05:09 +08:00
Kr328
0f4a46188c Chore: remove verbose logs 2021-05-28 11:36:29 +08:00
Kr328
5917b90837 Feature: add block loopback connections 2021-05-28 11:32:21 +08:00
Kr328
a222e90d1f Chore: update kaidl 2021-05-28 10:52:41 +08:00
Kr328
3f60d713f8 Chore: update dependencies 2021-05-28 10:52:35 +08:00
Kr328
9cb8433f3b Chore: update tun2socket 2021-05-28 10:43:00 +08:00
Goooler
428ca53532
Chore: use "implementation" & remove "exclude" for buildSrc dependencies (#1034) 2021-05-28 10:37:23 +08:00
kr328
6c4d7e537b Chore: bump version 2021-05-26 19:48:11 +08:00
kr328
58ab89736a Chore: change tun interface address/route 2021-05-26 16:03:43 +08:00
Kr328
5e34221a09 Fix: refactor tun implement 2021-05-26 15:33:59 +08:00
Kr328
ac35f2a5f4 Chore: update tun2socket 2021-05-26 03:17:30 +08:00
kr328
73992dca54 Chore: update tun2socket 2021-05-25 22:50:35 +08:00
kr328
53dc20109d Improve: migrate to latest dependencies 2021-05-25 22:49:03 +08:00
kr328
e7fef0a767 Chore: bump version 2021-05-25 22:30:38 +08:00
kr328
c73beabf7e Fix: launch mode of MainActivity should be singleTop 2021-05-25 20:30:07 +08:00
kr328
c7409d7ac6 Chore: cleanup code 2021-05-25 20:28:57 +08:00
kr328
5e238ab5d3 Chore: update tun2socket 2021-05-25 20:28:51 +08:00
kr328
a8f502ef4f Improve: merge ClashManager and ProfileService 2021-05-25 20:28:40 +08:00
kr328
c48ce82640 Fix: fix generated ksp search path 2021-05-25 19:40:44 +08:00
kr328
5594485bec Improve: enable -O3 for libbridge.so 2021-05-25 19:23:19 +08:00
kr328
f967bd299a Improve: enable CMAKE_POSITION_INDEPENDENT_CODE 2021-05-25 19:14:57 +08:00
kr328
a75c8f5dfc Chore: update tun2socket 2021-05-25 19:10:47 +08:00
kr328
271d56c01c Chore: update tun2socket 2021-05-25 14:11:17 +08:00
Kr328
12220789a3 Improve: clean tun2socket build on tasks["clean"] 2021-05-25 02:25:30 +08:00
kr328
ca85a688cc Chore: bump version 2021-05-24 19:45:09 +08:00
kr328
0e3ed548c9 Chore: update tun2socket 2021-05-24 19:44:41 +08:00
Kr328
27dc5395e0 Improve: migrate to latest dependencies 2021-05-24 16:15:06 +08:00
Kr328
4f05ba1ac6 Feature: Add workflow for push/PR checking (#1030)
* Chore: downgrade ndk version

* Fix: fix local.properties load

* Feature: add workflow for push/PR checking
2021-05-24 16:15:06 +08:00
kr328
1a36218c80 Feature: add nameserver-policy override 2021-05-24 16:15:06 +08:00
Goooler
3125b90efe Chore: update dependencies 2021-05-24 16:14:59 +08:00
Kr328
2a7425700a Chore: update tun2socket 2021-05-24 03:15:58 +08:00
kr328
f8a3308b46 Chore: bump version 2021-05-23 22:42:20 +08:00
kr328
93aed001af Chore: update clash core 2021-05-23 22:20:21 +08:00
kr328
44461b67ee Chore: update tun2socket 2021-05-23 18:45:15 +08:00
kr328
8a55dc1945 Fix: remove tun address from bypass_private_route 2021-05-22 19:59:12 +08:00
kr328
3af16bcf34 Chore: update tun2socket 2021-05-22 19:55:51 +08:00
kr328
9adf0f00ae Chore: update README.md 2021-05-22 19:54:34 +08:00
kr328
a2f3330455 Fix: force use cmake installed in system 2021-05-22 19:53:28 +08:00
kr328
7cfefbca19 Improve: use 'redir-host' instead of 'fake-ip' 2021-05-22 01:38:15 +08:00
kr328
e8eddb3917 Chore: remove unused logger 2021-05-22 01:30:53 +08:00
kr328
634c25894c Fix: should close all endpoint on exit 2021-05-22 01:29:25 +08:00
kr328
42f5331a0c Fix: should close TCP/UDP endpoint on exit 2021-05-22 01:26:02 +08:00
kr328
e2383df06b Improve: improve clash core build 2021-05-22 01:22:09 +08:00
Kr328
7381b787f3 Improve: use lwip stack instead of kernel 2021-05-21 21:02:22 +08:00
Kr328
eff310ac40 Chore: should ignore appcenter.key in foss build 2021-05-20 10:59:54 +08:00
kr328
c245fc6dfa Fix: use hardcoded components package name 2021-05-16 22:56:57 +08:00
kr328
b8f0c32ad5 Chore: remove migration error tracking 2021-05-16 20:00:47 +08:00
kr328
4d580eda0e Fix: .gitignore ignore foss/release 2021-05-16 18:52:22 +08:00
kr328
2db91740a4 Chore: bump version 2021-05-16 18:38:11 +08:00
kr328
cc304de7a7 Improve: add sources code urls for flavor 'foss' 2021-05-16 18:36:28 +08:00
kr328
d48b15afee Improve: "inline" kaidl 2021-05-16 18:26:01 +08:00
kr328
0338058495 Improve: add package suffix for flavor 'foss' 2021-05-16 18:18:28 +08:00
kr328
0b69bf735e Improve: remove tracking for flavor 'foss' 2021-05-16 18:15:36 +08:00
kr328
45ab647c67 Chore: rename flavor 'open' to 'foss' 2021-05-16 17:55:47 +08:00
kr328
b470dcc252 Fix: fix signing config 2021-05-16 17:47:49 +08:00
kr328
2f69985fe1 Chore: update gradle wrapper & append sha256sum 2021-05-15 19:15:43 +08:00
kr328
44424c5c9e Improve: disable proxy group lazy url-test 2021-05-15 10:58:07 +08:00
kr328
e4c27ac233 Improve: auto re-generate go.sum on build 2021-05-15 10:20:58 +08:00
kr328
08db7c56fa Chore: update core 2021-05-15 10:13:35 +08:00
Kr328
75745d89d7
Chore: update CONTRIBUTING.md 2021-05-15 02:01:38 +08:00
kr328
5dbc11a450 Chore: add open-source build outputs to .gitignore 2021-05-15 01:08:46 +08:00
kr328
590183ebc0 Chore: add build outputs to .gitignore 2021-05-15 01:07:09 +08:00
264 changed files with 6491 additions and 3894 deletions

4
.gitattributes vendored Normal file
View file

@ -0,0 +1,4 @@
* text=auto eol=lf
*.bat text eol=crlf
*.jar binary

View file

@ -1,57 +0,0 @@
---
name: "[English] Bug report"
about: Create a report to help us improve
title: "[BUG] "
labels: ''
assignees: ''
---
<!-- Be sure to put a clear title after [BUG] in the text box above -->
<!-- Be sure to put a clear title after [BUG] in the text box above -->
<!-- Be sure to put a clear title after [BUG] in the text box above -->
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Device Info (please complete the following information):**
- Device: [e.g. Pixel 4]
- ROM: [e.g: AOSP]
- ROM Version:
- Android Version [e.g. 10]
**Application Info (please complete the following information):**
- Version: [e.g. 1.1.10]
- Apk File Name: [e.g. app-release-arm64-v8a.apk]
- Distribution Channel: [e.g. Google Play]
**Additional context**
Add any other context about the problem here.
**Configure**
Paste configure file which **removed server info**
```yaml
# paste here
```
**Logs**
Paste logs to help detect problem
```
<paste here>
```

View file

@ -0,0 +1,107 @@
name: "[English] Bug Report"
description: "Create a report to help us debug bugs"
title: "[BUG] "
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
NOTE: Be sure to put a clear and concise title **AFTER** `[BUG]` in the text box above.
NOTE: We do not provide any services such as proxies, DO NOT feedback any problems not caused by this application here.
<!-- template -->
- type: textarea
id: description
attributes:
label: "Describe the bug"
description: "A clear and concise description of what the bug is."
validations:
required: true
- type: textarea
id: reproduce
attributes:
label: "To Reproduce"
description: "Steps to reproduce the behavior:"
value: |
Step 1: ...
Step 2: ...
Step 3: ...
...
validations:
required: true
- type: textarea
id: device-info
attributes:
label: "Device Info"
description: |
Input your device information.
Example:
- Device: Pixel 4
- ROM: AOSP
- Android Version: 10
value: |
- Device:
- ROM:
- Android Version:
validations:
required: true
- type: textarea
id: app-info
attributes:
label: "Application Info"
description: |
Input application you are using information.
Example:
```
- Version: 2.5.4-premium
- APK filename: cfa-2.5.4-premium-arm64-v8a-release.apk
- Distribution Channel: Google Play
```
value: |
- Version:
- APK filename:
- Distribution Channel:
validations:
required: true
- type: textarea
id: configure
attributes:
render: yml
label: "Configure File"
description: |
Please paste or upload the configuration file here.
TIPS: If you only have a subscription link, please use your browser to download it.
**NOTE: Please remove proxies from the configuration file before uploading it.**
**NOTE: Please remove proxies from the configuration file before uploading it.**
**NOTE: Please remove proxies from the configuration file before uploading it.**
validations:
required: true
- type: textarea
id: logs
attributes:
render: raw
label: "Logs"
description: |
Please paste or upload the log file here.
TIPS: Please use the `Logcat` in application or `adb logcat`. `adb logcat` would be better.
validations:
required: true
- type: textarea
id: screenshot
attributes:
label: "Screenshot"
description: "If applicable, add screenshots to help explain your problem."
placeholder: "Optional"
- type: textarea
id: additional
attributes:
label: "Additional"
description: "Add any other context about the problem here."

View file

@ -1,24 +0,0 @@
---
name: "[English] Feature request"
about: Suggest an idea for this app
title: "[Feature Request] "
labels: ''
assignees: ''
---
<!-- Be sure to put a clear title after [Feature Request] in the text box above -->
<!-- Be sure to put a clear title after [Feature Request] in the text box above -->
<!-- Be sure to put a clear title after [Feature Request] in the text box above -->
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View file

@ -0,0 +1,27 @@
name: "[English] Feature Request"
description: "Create a report to help us improve"
title: "[Feature Request] "
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request!
NOTE: Be sure to put a clear and concise title **AFTER** `[Feature Request]` in the text box above.
<!-- template -->
- type: textarea
id: "description"
attributes:
label: "Feature Description"
description: |
A clear and concise description of the feature.
validations:
required: true
- type: textarea
id: "additional"
attributes:
label: "Additional"
description: |
Add any other context or screenshots about the feature request here.

View file

@ -1,55 +0,0 @@
---
name: "[简体中文] 创建错误报告"
about: 创建错误报告以帮助我们改进应用
title: "[BUG] "
labels: ''
assignees: ''
---
<!-- 请务必在上方文本框处 [BUG] 后填入清晰明了的标题 -->
<!-- 请务必在上方文本框处 [BUG] 后填入清晰明了的标题 -->
<!-- 请务必在上方文本框处 [BUG] 后填入清晰明了的标题 -->
**描述出现的错误**
请简洁的描述你遇到的错误
**如何复现该错误**
复现步骤:
1. ...
2. ...
3. ...
4. ...
**预期行为**
清晰简单的描述你预期的应用应该表现的行为
**屏幕截图**
如果适用, 上传屏幕截图以帮助描述错误
**设备信息 (请完成以下信息):**
- 机型: [例如: Pixel 4]
- 系统/ROM: [例如: MIUI 11]
- Android 版本 [例如: 10]
- ROM版本 [例如: 20.3.19]
**应用信息**
- 版本: [例如: 1.1.10]
- 安装包文件名: [例如: app-release-arm64-v8a.apk]
- 应用来源: [例如: Google Play]
**附加信息**
其他的可能与改错误相关的信息
**配置文件**
在此粘贴 **去除服务器信息的** 的 **配置文件**
```yaml
# 在此粘贴
```
**日志**
粘贴日志以帮助侦测错误
```
<在此粘贴>
```

View file

@ -0,0 +1,108 @@
name: "[简体中文] 错误报告"
description: "创建错误报告以帮助我们修正应用"
title: "[BUG] "
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
感谢您在百忙之中填写此错误报告。
注意: 请务必在上方文本框的 `[BUG]` **之后**填写清晰明了的标题。
注意:这里不提供像是代理服务器之类的服务,请不要反馈非应用自身引起的问题。
<!-- template -->
- type: textarea
id: description
attributes:
label: "描述此错误"
description: "请清晰简洁的描述你遇到的错误。"
validations:
required: true
- type: textarea
id: reproduce
attributes:
label: "如何复现该错误"
description: "复现步骤:"
value: |
步骤 1: ...
步骤 2: ...
步骤 3: ...
...
validations:
required: true
- type: textarea
id: device-info
attributes:
label: "设备信息"
description: |
输入您正在使用的设备信息。
例子:
- 机型: Pixel 4
- 系统类型: MIUI/AOSP
- Android 版本: 10
value: |
- 机型:
- 系统类型:
- Android 版本:
validations:
required: true
- type: textarea
id: app-info
attributes:
label: "应用信息"
description: |
输入您正在使用的应用信息。
例子:
```
- 版本: 2.5.4-premium
- 安装包文件名: cfa-2.5.4-premium-arm64-v8a-release.apk
- 应用来源: Google Play
```
value: |
- 版本:
- 安装包文件名:
- 应用来源:
validations:
required: true
- type: textarea
id: configure
attributes:
render: yml
label: "配置文件"
description: |
请在此粘贴和上传配置文件。
提示:如果您仅有一个订阅链接,请使用浏览器打开此链接以下载配置文件。
**注意: 请在上传配置文件前,移除其中的代理服务器信息。**
**注意: 请在上传配置文件前,移除其中的代理服务器信息。**
**注意: 请在上传配置文件前,移除其中的代理服务器信息。**
validations:
required: true
- type: textarea
id: logs
attributes:
render: raw
label: "日志"
description: |
请在此粘贴或上传日志。
提示: 请使用应用内的 `Logcat` 或 `adb logcat` 捕获日志. `adb logcat` 能更好地帮助侦测问题.
validations:
required: true
- type: textarea
id: screenshot
attributes:
label: "屏幕截图"
description: "如果适用,请在此粘贴或上传屏幕截图。"
placeholder: "可选"
- type: textarea
id: additional
attributes:
label: "附加信息"
description: "其他的可能与改错误相关的信息。"
placeholder: "可选"

View file

@ -1,21 +0,0 @@
---
name: "[简体中文] 功能请求"
about: 你希望的能够在应用中增加的功能
title: "[Feature Request] "
labels: ''
assignees: ''
---
<!-- 请务必在上方文本框处 [Feature Request] 后填入清晰明了的标题 -->
<!-- 请务必在上方文本框处 [Feature Request] 后填入清晰明了的标题 -->
<!-- 请务必在上方文本框处 [Feature Request] 后填入清晰明了的标题 -->
**功能描述**
请清晰的描述你想要的功能
**描述你希望的实现方式**
清晰的描述应用应该如何实现该功能
**附加信息**
其他的与改功能相关的附加信息

View file

@ -0,0 +1,27 @@
name: "[简体中文] 功能请求"
description: "您希望的能够在应用中增加功能"
title: "[Feature Request] "
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: |
感谢您在百忙之中填写此功能请求报告。
注意: 请务必在上方文本框的 `[Feature Request]` **之后**填写清晰明了的标题。
<!-- template -->
- type: textarea
id: "description"
attributes:
label: "功能描述"
description: |
简介明了的描述此功能。
validations:
required: true
- type: textarea
id: "additional"
attributes:
label: "附加信息"
description: |
与此功能相关的其他附加信息。

99
.github/workflows/build-debug.yaml vendored Normal file
View file

@ -0,0 +1,99 @@
name: Build Debug
on:
pull_request:
types: [opened, reopened, synchronize]
workflow_dispatch:
push:
branches:
- main
jobs:
BuildDebug:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init --recursive --remote --force
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# - name: Signing properties
# env:
# SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
# SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
# SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
# run: |
# touch signing.properties
# echo keystore.password="$SIGNING_STORE_PASSWORD" > signing.properties
# echo key.alias="$SIGNING_KEY_ALIAS" >> signing.properties
# echo key.password="$SIGNING_KEY_PASSWORD" >> signing.properties
# echo "cat signing.properties"
# cat signing.properties
- name: Build
if: success()
run: ./gradlew --no-daemon app:assembleAlphaRelease
- name: Upload Aritfact (universal)
uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: CMFA Debug Unsigned APK (universal)
path: |
app/build/outputs/apk/alpha/release/*-universal-*.apk
- name: Upload Aritfact (arm64-v8a)
uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: CMFA Debug Unsigned APK (arm64-v8a)
path: |
app/build/outputs/apk/alpha/release/*-arm64-v8a-*.apk
- name: Upload Aritfact (armeabi-v7a)
uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: CMFA Debug Unsigned APK (armeabi-v7a)
path: |
app/build/outputs/apk/alpha/release/*-armeabi-v7a-*.apk
- name: Upload Aritfact (x86_64)
uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: CMFA Debug Unsigned APK (x86_64)
path: |
app/build/outputs/apk/alpha/release/*-x86_64-*.apk
- name: Upload Aritfact (x86)
uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: CMFA Debug Unsigned APK (x86)
path: |
app/build/outputs/apk/alpha/release/*-x86-*.apk

View file

@ -0,0 +1,84 @@
name: Build Pre-Release
on:
workflow_dispatch:
pull_request:
branches: [main]
types: [closed]
jobs:
BuildPreRelease:
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init --recursive --remote --force
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Signing properties
env:
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
run: |
touch signing.properties
echo keystore.password="$SIGNING_STORE_PASSWORD" > signing.properties
echo key.alias="$SIGNING_KEY_ALIAS" >> signing.properties
echo key.password="$SIGNING_KEY_PASSWORD" >> signing.properties
echo "cat signing.properties"
cat signing.properties
- name: Pre-release Build
if: success()
run: ./gradlew --no-daemon app:assembleAlphaRelease
# Delete old Prerelease-alpha
- uses: dev-drprasad/delete-tag-and-release@v1.1
with:
tag_name: Prerelease-alpha
github_token: ${{ secrets.GITHUB_TOKEN }}
delete_release: true
- name: Tag Repo
uses: richardsimko/update-tag@v1
with:
tag_name: Prerelease-alpha
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Alpha
uses: softprops/action-gh-release@v2
if: ${{ success() }}
with:
tag_name: Prerelease-alpha
files: app/build/outputs/apk/alpha/release/*
prerelease: true
generate_release_notes: true
- name: Release Changelog Builder
uses: mikepenz/release-changelog-builder-action@v4

121
.github/workflows/build-release.yaml vendored Normal file
View file

@ -0,0 +1,121 @@
name: Build Release
on:
workflow_dispatch:
inputs:
release-tag:
description: 'Release Tag (v2.x.x)'
required: true
jobs:
BuildRelease:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout submodules
run: git submodule update --init --recursive --remote
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Convert and set version env
id: process-version
run: |
VERSION_TAG=${{ inputs.release-tag }}
VERSION_TAG=${VERSION_TAG#v} # remove the 'v' prefix
IFS='.' read -ra VERSION_PARTS <<< "$VERSION_TAG" # split into array
VERSION_CODE=$(printf "%1d%02d%03d" "${VERSION_PARTS[0]}" "${VERSION_PARTS[1]}" "${VERSION_PARTS[2]}")
echo "versonName=$VERSION_TAG" >> $GITHUB_OUTPUT # "1.2.3"
echo "versonCode=$VERSION_CODE" >> $GITHUB_OUTPUT # "102003"
# Re-write version in build.gradle.kts
- name: Re-write version
uses: Devofure/advance-android-version-actions@v1.5
with:
gradlePath: build.gradle.kts
versionCode: ${{ steps.process-version.outputs.versonCode }}
versionName: ${{ steps.process-version.outputs.versonName }}
# If any change found, commit it and push
- name: Commit and push if changes
run: |
changes=$(git diff --name-only origin/main | wc -l)
if [ $changes -gt 0 ]
then
newVersionName=${{ steps.process-version.outputs.versonName }}
newVersionCode=${{ steps.process-version.outputs.versonCode }}
git config --global user.name 'GitHub Action'
git config --global user.email 'action@github.com'
git add build.gradle.kts
git commit -am "Bump version to $newVersionName ($newVersionCode)"
git tag "v$newVersionName"
git push --follow-tags
fi
- name: Signing properties
env:
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
run: |
touch signing.properties
echo keystore.password="$SIGNING_STORE_PASSWORD" > signing.properties
echo key.alias="$SIGNING_KEY_ALIAS" >> signing.properties
echo key.password="$SIGNING_KEY_PASSWORD" >> signing.properties
echo "cat signing.properties"
cat signing.properties
- name: Release Build
if: success()
run: ./gradlew --no-daemon app:assembleMetaRelease
- name: Tag Repo
uses: richardsimko/update-tag@v1
with:
tag_name: ${{ inputs.release-tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Release
uses: softprops/action-gh-release@v1
if: ${{ success() }}
with:
tag_name: ${{ inputs.release-tag }}
files: app/build/outputs/apk/meta/release/*
generate_release_notes: true
- name: Release Changelog Builder
uses: mikepenz/release-changelog-builder-action@v4.1.1
with:
configurationJson: |
{
"ignore_labels": [
"Update"
],
}

View file

@ -0,0 +1,81 @@
name: Update Clash-Core and Go Modules
on:
repository_dispatch:
types:
- core-updated
workflow_dispatch:
jobs:
update-dependencies:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init --recursive --remote --force
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install update-go-mod-replace
run: |
go install github.com/metacubex/update-go-mod-replace@latest
- name: Update Foss Gomod
run: |
cd ${{ github.workspace }}/core/src/foss/golang/
update-go-mod-replace ${{ github.workspace }}/core/src/foss/golang/clash/go.mod $(pwd)/go.mod
go mod tidy
- name: Update Main Gomod
run: |
cd ${{ github.workspace }}/core/src/main/golang/
update-go-mod-replace ${{ github.workspace }}/core/src/foss/golang/clash/go.mod $(pwd)/go.mod
go mod tidy
- uses: tibdex/github-app-token@v2
id: generate-token
with:
app_id: ${{ secrets.MAINTAINER_APPID }}
private_key: ${{ secrets.MAINTAINER_APP_PRIVATE_KEY }}
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
with:
token: ${{ steps.generate-token.outputs.token }}
commit-message: Update Dependencies
branch: update-dependencies
delete-branch: true
title: 'Update Dependencies'
draft: false
body: |
- Update Clash-Meta Core
- Update Go Module Dependecies
labels: |
Update
- name: PR result
if: ${{ steps.cpr.outputs.pull-request-number }}
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

23
.gitignore vendored
View file

@ -1,6 +1,7 @@
.gradle
build/
/app/release/
/app/foss/release
/app/premium/release
/captures
# Ignore Gradle GUI config
@ -18,11 +19,19 @@ gradle-app.setting
# Ignore IDEA config
*.iml
/.idea/*
/core/src/main/golang/.idea/*
!/.idea/codeStyles
/core/src/main/golang/.idea/*
!/core/src/main/golang/.idea/codeStyles
/core/src/foss/golang/.idea/*
!/core/src/foss/golang/.idea/codeStyles
/core/src/premium/golang/.idea/*
!/core/src/premium/golang/.idea/codeStyles
# Ignore builtin geofiles
app/src/main/assets
# KeyStore
signing.properties
*.keystore
*.jks
@ -32,8 +41,9 @@ cmake-build-*
# local.properties
local.properties
# keystore
keystore.properties
# tracker
tracker.properties
# vscode
.vscode
@ -50,4 +60,7 @@ google-services.json
.directory
# logs
*.log
*.log
# MacOS
.DS_Store

7
.gitmodules vendored
View file

@ -1,3 +1,4 @@
[submodule "core/src/main/golang/clash"]
path = core/src/main/golang/clash
url = https://github.com/Kr328/clash.git
[submodule "clash-foss"]
path = core/src/foss/golang/clash
url = https://github.com/MetaCubeX/mihomo
branch = Alpha

View file

@ -20,15 +20,6 @@
<package name="io.ktor" alias="false" withSubpackages="true" />
</value>
</option>
<option name="PACKAGES_IMPORT_LAYOUT">
<value>
<package name="" alias="false" withSubpackages="true" />
<package name="java" alias="false" withSubpackages="true" />
<package name="javax" alias="false" withSubpackages="true" />
<package name="kotlin" alias="false" withSubpackages="true" />
<package name="" alias="true" withSubpackages="true" />
</value>
</option>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="XML">

View file

@ -10,5 +10,5 @@ Please use `Android Studio` or `Intellij IDEA` to open the project and use the p
#### License
Contributing to Clash for Android that assumes you allow code to be merged into closed-source branches. Other terms follow the [GPLv3](https://www.gnu.org/licenses/gpl-3.0.html)
Contributing to Clash for Android that assumes you allow code to be merged into closed-source branch of Clash for Android. Other terms follow the [GPLv3](https://www.gnu.org/licenses/gpl-3.0.html)

View file

@ -1,32 +1,20 @@
## Clash for Android
## Clash Meta for Android
A Graphical user interface of [clash](https://github.com/Dreamacro/clash) for Android
<a href="https://play.google.com/store/apps/details?id=com.github.kr328.clash"><img width="200px" alt="Get it on Google Play" src="https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png"/></a> or [Releases](https://github.com/Kr328/ClashForAndroid/releases)
A Graphical user interface of [Clash.Meta](https://github.com/MetaCubeX/Clash.Meta) for Android
### Feature
Fully feature of [clash](https://github.com/Dreamacro/clash) ~~(Exclude `external-controller`~~
Feature of [Clash.Meta](https://github.com/MetaCubeX/Clash.Meta)
[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"
alt="Get it on F-Droid"
height="80">](https://f-droid.org/packages/com.github.metacubex.clash.meta/)
### Requirement
* Android 5.0+ (minimum)
* Android 7.0+ (recommend)
* `armeabi-v7a` , `arm64-v8a`, `x86` or `x86_64` Architecture
### License
See also [LICENSE](./LICENSE) and [NOTICE](./NOTICE)
### Privacy Policy
See also [PRIVACY_POLICY.md](./PRIVACY_POLICY.md)
- Android 5.0+ (minimum)
- Android 7.0+ (recommend)
- `armeabi-v7a` , `arm64-v8a`, `x86` or `x86_64` Architecture
### Build
@ -36,28 +24,56 @@ See also [PRIVACY_POLICY.md](./PRIVACY_POLICY.md)
git submodule update --init --recursive
```
2. Install `JDK 1.8`, `Android SDK` and `Golang`
2. Install **OpenJDK 11**, **Android SDK**, **CMake** and **Golang**
3. Create `local.properties` in project root with
3. Create `local.properties` in project root with
```properties
sdk.dir=/path/to/android-sdk
appcenter.key=<AppCenter Key> # Optional, from "appcenter.ms"
```
4. Create `keystore.properties` in project root with
4. Create `signing.properties` in project root with
```properties
storeFile=/path/to/keystore/file
storePassword=<key store password>
keyAlias=<key alias>
keyPassword=<key password>
```
keystore.path=/path/to/keystore/file
keystore.password=<key store password>
key.alias=<key alias>
key.password=<key password>
```
5. Build
```bash
./gradlew app:assembleRelease
./gradlew app:assembleMeta-AlphaRelease
```
6. Pick `app-release-<arch>.apk` in `app/build/outputs/apks`
### Automation
APP package name is `com.github.metacubex.clash.meta`
- Toggle Clash.Meta service status
- Send intent to activity `com.github.kr328.clash.ExternalControlActivity` with action `com.github.metacubex.clash.meta.action.TOGGLE_CLASH`
- Start Clash.Meta service
- Send intent to activity `com.github.kr328.clash.ExternalControlActivity` with action `com.github.metacubex.clash.meta.action.START_CLASH`
- Stop Clash.Meta service
- Send intent to activity `com.github.kr328.clash.ExternalControlActivity` with action `com.github.metacubex.clash.meta.action.STOP_CLASH`
- Import a profile
- URL Scheme `clash://install-config?url=<encoded URI>` or `clashmeta://install-config?url=<encoded URI>`
### Contribution and Project Maintenance
#### Meta Kernel
- CMFA uses the kernel from `android-real` branch under `MetaCubeX/Clash.Meta`, which is a merge of the main `Alpha` branch and `android-open`.
- If you want to contribute to the kernel, make PRs to `Alpha` branch of the Meta kernel repository.
- If you want to contribute Android-specific patches to the kernel, make PRs to `android-open` branch of the Meta kernel repository.
#### Maintenance
- When `MetaCubeX/Clash.Meta` kernel is updated to a new version, the `Update Dependencies` actions in this repo will be triggered automatically.
- It will pull the new version of the meta kernel, update all the golang dependencies, and create a PR without manual intervention.
- If there is any compile error in PR, you need to fix it before merging. Alternatively, you may merge the PR directly.
- Manually triggering `Build Pre-Release` actions will compile and publish a `PreRelease` version.
- Manually triggering `Build Release` actions will compile, tag and publish a `Release` version.
- You must fill the blank `Release Tag` with the tag you want to release in the format of `v1.2.3`.
- `versionName` and `versionCode` in `build.gradle.kts` will be automatically bumped to the tag you filled above.

View file

@ -1,136 +1,69 @@
import java.util.*
import java.net.URL
import java.nio.file.Files
import java.nio.file.StandardCopyOption
plugins {
id("com.android.application")
kotlin("android")
kotlin("kapt")
}
android {
compileSdk = buildTargetSdkVersion
flavorDimensions(buildFlavor)
defaultConfig {
applicationId = "com.github.kr328.clash"
minSdk = buildMinSdkVersion
targetSdk = buildTargetSdkVersion
versionCode = buildVersionCode
versionName = buildVersionName
resConfigs("zh-rCN", "zh-rHK", "zh-rTW")
resValue("string", "release_name", "v$buildVersionName")
resValue("integer", "release_code", "$buildVersionCode")
}
buildTypes {
named("release") {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
productFlavors {
create("open") {
dimension = "open"
versionNameSuffix = ".open-source"
}
create("premium") {
dimension = "premium"
versionNameSuffix = ".premium"
}
}
buildFeatures {
dataBinding = true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
splits {
abi {
isEnable = true
isUniversalApk = true
}
}
buildTypes.apply {
val properties = Properties().apply {
rootProject.file("local.properties").inputStream().use {
load(it)
}
}
val key = properties.getProperty("appcenter.key", null)
forEach {
if (it.name == "debug" || key == null) {
it.buildConfigField("String", "APP_CENTER_KEY", "null")
} else {
it.buildConfigField("String", "APP_CENTER_KEY", "\"$key\"")
}
}
}
signingConfigs.apply {
val signingFile = rootProject.file("keystore.properties")
if ( signingFile.exists() ) {
val properties = Properties().apply {
signingFile.inputStream().use {
load(it)
}
}
signingConfigs {
named("release") {
storeFile = rootProject.file(Objects.requireNonNull(properties.getProperty("storeFile")))
storePassword = Objects.requireNonNull(properties.getProperty("storePassword"))
keyAlias = Objects.requireNonNull(properties.getProperty("keyAlias"))
keyPassword = Objects.requireNonNull(properties.getProperty("keyPassword"))
}
}
buildTypes {
named("release") {
this.signingConfig = signingConfigs.findByName("release")
}
}
}
}
id("com.android.application")
}
dependencies {
api(project(":core"))
api(project(":service"))
api(project(":design"))
api(project(":common"))
compileOnly(project(":hideapi"))
implementation(kotlin("stdlib-jdk7"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutineVersion")
implementation("androidx.core:core-ktx:$ktxVersion")
implementation("androidx.activity:activity:$activityVersion")
implementation("androidx.appcompat:appcompat:$appcompatVersion")
implementation("androidx.coordinatorlayout:coordinatorlayout:$coordinatorlayoutVersion")
implementation("androidx.recyclerview:recyclerview:$recyclerviewVersion")
implementation("androidx.fragment:fragment:$fragmentVersion")
implementation("com.microsoft.appcenter:appcenter-analytics:$appcenterVersion")
implementation("com.microsoft.appcenter:appcenter-crashes:$appcenterVersion")
implementation("com.google.android.material:material:$materialVersion")
implementation(project(":core"))
implementation(project(":service"))
implementation(project(":design"))
implementation(project(":common"))
implementation(libs.kotlin.coroutine)
implementation(libs.androidx.core)
implementation(libs.androidx.activity)
implementation(libs.androidx.fragment)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.coordinator)
implementation(libs.androidx.recyclerview)
implementation(libs.google.material)
}
task("cleanRelease", type = Delete::class) {
tasks.getByName("clean", type = Delete::class) {
delete(file("release"))
}
val geoFilesDownloadDir = "src/main/assets"
task("downloadGeoFiles") {
val geoFilesUrls = mapOf(
"https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.metadb" to "geoip.metadb",
"https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat" to "geosite.dat",
// "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/country.mmdb" to "country.mmdb",
"https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/GeoLite2-ASN.mmdb" to "ASN.mmdb",
)
doLast {
geoFilesUrls.forEach { (downloadUrl, outputFileName) ->
val url = URL(downloadUrl)
val outputPath = file("$geoFilesDownloadDir/$outputFileName")
outputPath.parentFile.mkdirs()
url.openStream().use { input ->
Files.copy(input, outputPath.toPath(), StandardCopyOption.REPLACE_EXISTING)
println("$outputFileName downloaded to $outputPath")
}
}
}
}
afterEvaluate {
tasks["clean"].dependsOn(tasks["cleanRelease"])
val downloadGeoFilesTask = tasks["downloadGeoFiles"]
tasks.forEach {
if (it.name.startsWith("assemble")) {
it.dependsOn(downloadGeoFilesTask)
}
}
}
tasks.getByName("clean", type = Delete::class) {
delete(file(geoFilesDownloadDir))
}

View file

@ -31,3 +31,29 @@
public static void checkParameterIsNotNull(...);
public static void checkNotNullParameter(...);
}
# Kotlin Coroutine
# Allow R8 to optimize away the FastServiceLoader.
# Together with ServiceLoader optimization in R8
# this results in direct instantiation when loading Dispatchers.Main
-assumenosideeffects class kotlinx.coroutines.internal.MainDispatcherLoader {
boolean FAST_SERVICE_LOADER_ENABLED return false;
}
-assumenosideeffects class kotlinx.coroutines.internal.FastServiceLoaderKt {
boolean ANDROID_DETECTED return true;
}
-keep class kotlinx.coroutines.android.AndroidDispatcherFactory {*;}
# Disable support for "Missing Main Dispatcher", since we always have Android main dispatcher
-assumenosideeffects class kotlinx.coroutines.internal.MainDispatchersKt {
boolean SUPPORT_MISSING return false;
}
# Statically turn off all debugging facilities and assertions
-assumenosideeffects class kotlinx.coroutines.DebugKt {
boolean getASSERTIONS_ENABLED() return false;
boolean getDEBUG() return false;
boolean getRECOVER_STACK_TRACES() return false;
}

View file

@ -41,7 +41,8 @@
android:name=".MainActivity"
android:configChanges="uiMode"
android:exported="true"
android:label="@string/launch_name">
android:label="@string/launch_name"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -54,9 +55,9 @@
</intent-filter>
</activity>
<activity
android:name=".ExternalImportActivity"
android:name=".ExternalControlActivity"
android:exported="true"
android:label="@string/import_from_file"
android:label="@string/external_control_activity"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
@ -64,9 +65,21 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="install-config"
android:scheme="clash" />
<data android:scheme="clash"/>
<data android:scheme="clashmeta"/>
<data android:host="install-config"/>
</intent-filter>
<intent-filter>
<action android:name="com.github.metacubex.clash.meta.action.START_CLASH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="com.github.metacubex.clash.meta.action.STOP_CLASH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="com.github.metacubex.clash.meta.action.TOGGLE_CLASH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
@ -135,6 +148,11 @@
android:configChanges="uiMode"
android:exported="false"
android:label="@string/override" />
<activity
android:name=".MetaFeatureSettingsActivity"
android:configChanges="uiMode"
android:exported="false"
android:label="@string/meta_features" />
<activity
android:name=".AccessControlActivity"
android:configChanges="uiMode"

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -76,11 +76,8 @@ class AccessControlActivity : BaseActivity<AccessControlDesign>() {
val data = clipboard?.primaryClip
if (data != null && data.itemCount > 0) {
val all = withContext(Dispatchers.IO) {
val packages = data.getItemAt(0).text.split("\n").toSet()
design.apps.map(AppInfo::packageName).intersect(packages)
}
val packages = data.getItemAt(0).text.split("\n").toSet()
val all = design.apps.map(AppInfo::packageName).intersect(packages)
selected.clear()
selected.addAll(all)
@ -91,14 +88,12 @@ class AccessControlActivity : BaseActivity<AccessControlDesign>() {
AccessControlDesign.Request.Export -> {
val clipboard = getSystemService<ClipboardManager>()
withContext(Dispatchers.IO) {
val data = ClipData.newPlainText(
"packages",
selected.joinToString("\n")
)
val data = ClipData.newPlainText(
"packages",
selected.joinToString("\n")
)
clipboard?.setPrimaryClip(data)
}
clipboard?.setPrimaryClip(data)
}
}
}

View file

@ -1,12 +1,9 @@
package com.github.kr328.clash
import android.os.DeadObjectException
import com.github.kr328.clash.common.compat.versionCodeCompat
import com.github.kr328.clash.common.log.Log
import com.github.kr328.clash.design.AppCrashedDesign
import com.github.kr328.clash.log.SystemLogcat
import com.microsoft.appcenter.crashes.Crashes
import com.microsoft.appcenter.crashes.ingestion.models.ErrorAttachmentLog
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.isActive
import kotlinx.coroutines.withContext
@ -27,16 +24,6 @@ class AppCrashedActivity : BaseActivity<AppCrashedDesign>() {
SystemLogcat.dumpCrash()
}
if (BuildConfig.APP_CENTER_KEY != null && !BuildConfig.DEBUG) {
if (logs.isNotBlank()) {
Crashes.trackError(
DeadObjectException(),
mapOf("type" to "app_crashed"),
listOf(ErrorAttachmentLog.attachmentWithText(logs, "logcat.txt"))
)
}
}
design.setAppLogs(logs)
while (isActive) {

View file

@ -24,34 +24,23 @@ import com.github.kr328.clash.util.ActivityResultLifecycle
import com.github.kr328.clash.util.ApplicationObserver
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import java.util.*
import java.util.concurrent.atomic.AtomicInteger
import kotlin.coroutines.resume
import kotlin.coroutines.suspendCoroutine
abstract class BaseActivity<D : Design<*>> :
AppCompatActivity(),
abstract class BaseActivity<D : Design<*>> : AppCompatActivity(),
CoroutineScope by MainScope(),
Broadcasts.Observer {
enum class Event {
ServiceRecreated,
ActivityStart,
ActivityStop,
ClashStop,
ClashStart,
ProfileLoaded,
ProfileChanged
}
protected val uiStore by lazy { UiStore(this) }
protected val events = Channel<Event>(Channel.UNLIMITED)
protected var activityStarted: Boolean = false
protected val clashRunning: Boolean
get() = Remote.broadcasts.clashRunning
protected var design: D? = null
private set(value) {
set(value) {
field = value
if (value != null) {
setContentView(value.root)
} else {
@ -72,14 +61,14 @@ abstract class BaseActivity<D : Design<*>> :
suspend fun <I, O> startActivityForResult(
contracts: ActivityResultContract<I, O>,
input: I
input: I,
): O = withContext(Dispatchers.Main) {
val requestKey = nextRequestKey.getAndIncrement().toString()
ActivityResultLifecycle().use { lifecycle, start ->
suspendCoroutine { c ->
activityResultRegistry.register(requestKey, lifecycle, contracts) {
c.resumeWith(Result.success(it))
c.resume(it)
}.apply { start() }.launch(input)
}
}
@ -89,7 +78,6 @@ abstract class BaseActivity<D : Design<*>> :
suspendCoroutine<Unit> {
window.decorView.post {
this.design = design
it.resume(Unit)
}
}
@ -97,49 +85,35 @@ abstract class BaseActivity<D : Design<*>> :
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
applyDayNight()
launch {
main()
finish()
}
}
override fun onStart() {
super.onStart()
activityStarted = true
Remote.broadcasts.addObserver(this)
events.offer(Event.ActivityStart)
events.trySend(Event.ActivityStart)
}
override fun onStop() {
super.onStop()
activityStarted = false
Remote.broadcasts.removeObserver(this)
events.offer(Event.ActivityStop)
events.trySend(Event.ActivityStop)
}
override fun onDestroy() {
design?.cancel()
cancel()
super.onDestroy()
}
override fun finish() {
if (deferRunning) {
return
}
if (deferRunning) return
deferRunning = true
launch {
@ -169,28 +143,35 @@ abstract class BaseActivity<D : Design<*>> :
override fun onSupportNavigateUp(): Boolean {
this.onBackPressed()
return true
}
override fun onProfileChanged() {
events.offer(Event.ProfileChanged)
events.trySend(Event.ProfileChanged)
}
override fun onProfileUpdateCompleted(uuid: UUID?) {
events.trySend(Event.ProfileUpdateCompleted)
}
override fun onProfileUpdateFailed(uuid: UUID?, reason: String?) {
events.trySend(Event.ProfileUpdateFailed)
}
override fun onProfileLoaded() {
events.offer(Event.ProfileLoaded)
events.trySend(Event.ProfileLoaded)
}
override fun onServiceRecreated() {
events.offer(Event.ServiceRecreated)
events.trySend(Event.ServiceRecreated)
}
override fun onStarted() {
events.offer(Event.ClashStart)
events.trySend(Event.ClashStart)
}
override fun onStopped(cause: String?) {
events.offer(Event.ClashStop)
events.trySend(Event.ClashStop)
if (cause != null && activityStarted) {
launch {
@ -201,49 +182,45 @@ abstract class BaseActivity<D : Design<*>> :
private fun queryDayNight(config: Configuration = resources.configuration): DayNight {
return when (uiStore.darkMode) {
DarkMode.Auto -> {
if (config.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES)
DayNight.Night
else
DayNight.Day
}
DarkMode.ForceLight -> {
DayNight.Day
}
DarkMode.ForceDark -> {
DayNight.Night
}
DarkMode.Auto -> if (config.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES) DayNight.Night else DayNight.Day
DarkMode.ForceLight -> DayNight.Day
DarkMode.ForceDark -> DayNight.Night
}
}
private fun applyDayNight(config: Configuration = resources.configuration) {
val dayNight = queryDayNight(config)
when (dayNight) {
DayNight.Night -> {
theme.applyStyle(R.style.AppThemeDark, true)
}
DayNight.Day -> {
theme.applyStyle(R.style.AppThemeLight, true)
}
DayNight.Night -> theme.applyStyle(R.style.AppThemeDark, true)
DayNight.Day -> theme.applyStyle(R.style.AppThemeLight, true)
}
window.isAllowForceDarkCompat = false
window.isSystemBarsTranslucentCompat = true
window.statusBarColor = resolveThemedColor(android.R.attr.statusBarColor)
window.navigationBarColor = resolveThemedColor(android.R.attr.navigationBarColor)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
window.isLightStatusBarsCompat =
resolveThemedBoolean(android.R.attr.windowLightStatusBar)
if (Build.VERSION.SDK_INT >= 23) {
window.isLightStatusBarsCompat = resolveThemedBoolean(android.R.attr.windowLightStatusBar)
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
window.isLightNavigationBarCompat =
resolveThemedBoolean(android.R.attr.windowLightNavigationBar)
if (Build.VERSION.SDK_INT >= 27) {
window.isLightNavigationBarCompat = resolveThemedBoolean(android.R.attr.windowLightNavigationBar)
}
this.dayNight = dayNight
}
enum class Event {
ServiceRecreated,
ActivityStart,
ActivityStop,
ClashStop,
ClashStart,
ProfileLoaded,
ProfileChanged,
ProfileUpdateCompleted,
ProfileUpdateFailed,
}
}

View file

@ -0,0 +1,92 @@
package com.github.kr328.clash
import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.widget.Toast
import androidx.activity.result.contract.ActivityResultContracts
import com.github.kr328.clash.common.constants.Intents
import com.github.kr328.clash.common.util.intent
import com.github.kr328.clash.common.util.setUUID
import com.github.kr328.clash.design.MainDesign
import com.github.kr328.clash.design.ui.ToastDuration
import com.github.kr328.clash.remote.Remote
import com.github.kr328.clash.remote.StatusClient
import com.github.kr328.clash.service.model.Profile
import com.github.kr328.clash.util.startClashService
import com.github.kr328.clash.util.stopClashService
import com.github.kr328.clash.util.withProfile
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch
import java.util.*
class ExternalControlActivity : Activity(), CoroutineScope by MainScope() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
when(intent.action) {
Intent.ACTION_VIEW -> {
val uri = intent.data ?: return finish()
val url = uri.getQueryParameter("url") ?: return finish()
launch {
val uuid = withProfile {
val type = when (uri.getQueryParameter("type")?.lowercase(Locale.getDefault())) {
"url" -> Profile.Type.Url
"file" -> Profile.Type.File
else -> Profile.Type.Url
}
val name = uri.getQueryParameter("name") ?: getString(R.string.new_profile)
create(type, name).also {
patch(it, name, url, 0)
}
}
startActivity(PropertiesActivity::class.intent.setUUID(uuid))
finish()
}
}
Intents.ACTION_TOGGLE_CLASH -> if(Remote.broadcasts.clashRunning) {
stopClash()
}
else {
startClash()
}
Intents.ACTION_START_CLASH -> if(!Remote.broadcasts.clashRunning) {
startClash()
}
else {
Toast.makeText(this, R.string.external_control_started, Toast.LENGTH_LONG).show()
}
Intents.ACTION_STOP_CLASH -> if(Remote.broadcasts.clashRunning) {
stopClash()
}
else {
Toast.makeText(this, R.string.external_control_stopped, Toast.LENGTH_LONG).show()
}
}
return finish()
}
private fun startClash() {
// if (currentProfile == null) {
// Toast.makeText(this, R.string.no_profile_selected, Toast.LENGTH_LONG).show()
// return
// }
val vpnRequest = startClashService()
if (vpnRequest != null) {
Toast.makeText(this, R.string.unable_to_start_vpn, Toast.LENGTH_LONG).show()
return
}
Toast.makeText(this, R.string.external_control_started, Toast.LENGTH_LONG).show()
}
private fun stopClash() {
stopClashService()
Toast.makeText(this, R.string.external_control_stopped, Toast.LENGTH_LONG).show()
}
}

View file

@ -1,44 +0,0 @@
package com.github.kr328.clash
import android.app.Activity
import android.content.Intent
import android.os.Bundle
import com.github.kr328.clash.common.util.intent
import com.github.kr328.clash.common.util.setUUID
import com.github.kr328.clash.service.model.Profile
import com.github.kr328.clash.util.withProfile
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch
import java.util.*
class ExternalImportActivity : Activity(), CoroutineScope by MainScope() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (intent.action != Intent.ACTION_VIEW)
return finish()
val uri = intent.data ?: return finish()
val url = uri.getQueryParameter("url") ?: return finish()
launch {
val uuid = withProfile {
val type = when (uri.getQueryParameter("type")?.lowercase(Locale.getDefault())) {
"url" -> Profile.Type.Url
"file" -> Profile.Type.File
else -> Profile.Type.Url
}
val name = uri.getQueryParameter("name") ?: getString(R.string.new_profile)
create(type, name).also {
patch(it, name, url, 0)
}
}
startActivity(PropertiesActivity::class.intent.setUUID(uuid))
finish()
}
}
}

View file

@ -116,7 +116,7 @@ class FilesActivity : BaseActivity<FilesDesign>() {
}
is FilesDesign.Request.ExportFile -> {
val uri: Uri? = startActivityForResult(
ActivityResultContracts.CreateDocument(),
ActivityResultContracts.CreateDocument("text/plain"),
it.file.name
)
@ -141,7 +141,7 @@ class FilesActivity : BaseActivity<FilesDesign>() {
}
override fun onBackPressed() {
design?.requests?.offer(FilesDesign.Request.PopStack)
design?.requests?.trySend(FilesDesign.Request.PopStack)
}
private suspend fun FilesDesign.fetch(client: FilesClient, stack: Stack<String>, root: String) {

View file

@ -8,6 +8,7 @@ import android.os.IBinder
import android.widget.Toast
import androidx.activity.result.contract.ActivityResultContracts
import com.github.kr328.clash.common.compat.startForegroundServiceCompat
import com.github.kr328.clash.common.log.Log
import com.github.kr328.clash.common.util.fileName
import com.github.kr328.clash.common.util.intent
import com.github.kr328.clash.common.util.ticker
@ -47,6 +48,7 @@ class LogcatActivity : BaseActivity<LogcatDesign>() {
val messages = try {
LogcatReader(this, file).readAll()
} catch (e: Exception) {
Log.e("Fail to read log file ${file.fileName}: ${e.message}")
return showInvalid()
}
@ -67,7 +69,7 @@ class LogcatActivity : BaseActivity<LogcatDesign>() {
}
LogcatDesign.Request.Export -> {
val output = startActivityForResult(
ActivityResultContracts.CreateDocument(),
ActivityResultContracts.CreateDocument("text/plain"),
file.fileName
)

View file

@ -1,7 +1,5 @@
package com.github.kr328.clash
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.app.Service
import android.content.ComponentName
@ -9,20 +7,21 @@ import android.content.Context
import android.content.Intent
import android.content.ServiceConnection
import android.os.Binder
import android.os.Build
import android.os.IBinder
import android.os.IInterface
import androidx.core.app.NotificationChannelCompat
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import com.github.kr328.clash.common.compat.getColorCompat
import com.github.kr328.clash.common.compat.pendingIntentFlags
import com.github.kr328.clash.common.log.Log
import com.github.kr328.clash.common.util.intent
import com.github.kr328.clash.core.model.LogMessage
import com.github.kr328.clash.log.LogcatCache
import com.github.kr328.clash.log.LogcatWriter
import com.github.kr328.clash.service.ClashManager
import com.github.kr328.clash.service.remote.IClashManager
import com.github.kr328.clash.service.RemoteService
import com.github.kr328.clash.service.remote.ILogObserver
import com.github.kr328.clash.service.remote.IRemoteService
import com.github.kr328.clash.service.remote.unwrap
import com.github.kr328.clash.util.logsDir
import kotlinx.coroutines.*
@ -52,7 +51,7 @@ class LogcatService : Service(), CoroutineScope by CoroutineScope(Dispatchers.De
showNotification()
bindService(ClashManager::class.intent, connection, Context.BIND_AUTO_CREATE)
bindService(RemoteService::class.intent, connection, Context.BIND_AUTO_CREATE)
}
override fun onDestroy() {
@ -88,7 +87,7 @@ class LogcatService : Service(), CoroutineScope by CoroutineScope(Dispatchers.De
return stopSelf()
launch(Dispatchers.IO) {
val service = binder.unwrap(IClashManager::class)
val service = binder.unwrap(IRemoteService::class).clash()
val channel = Channel<LogMessage>(CACHE_CAPACITY)
try {
@ -97,7 +96,7 @@ class LogcatService : Service(), CoroutineScope by CoroutineScope(Dispatchers.De
LogcatWriter(this@LogcatService).use {
val observer = object : ILogObserver {
override fun newItem(log: LogMessage) {
channel.offer(log)
channel.trySend(log)
}
}
@ -126,16 +125,12 @@ class LogcatService : Service(), CoroutineScope by CoroutineScope(Dispatchers.De
}
private fun createNotificationChannel() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O)
return
NotificationManagerCompat.from(this)
.createNotificationChannel(
NotificationChannel(
NotificationChannelCompat.Builder(
CHANNEL_ID,
getString(R.string.clash_logcat),
NotificationManager.IMPORTANCE_DEFAULT
)
NotificationManagerCompat.IMPORTANCE_DEFAULT
).setName(getString(R.string.clash_logcat)).build()
)
}
@ -152,7 +147,7 @@ class LogcatService : Service(), CoroutineScope by CoroutineScope(Dispatchers.De
R.id.nf_logcat_status,
LogcatActivity::class.intent
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP),
PendingIntent.FLAG_UPDATE_CURRENT
pendingIntentFlags(PendingIntent.FLAG_UPDATE_CURRENT)
)
)
.build()

View file

@ -47,7 +47,7 @@ class LogsActivity : BaseActivity<LogsDesign>() {
deleteAllLogs()
}
events.offer(Event.ActivityStart)
events.trySend(Event.ActivityStart)
}
}
is LogsDesign.Request.OpenFile -> {

View file

@ -5,14 +5,13 @@ import com.github.kr328.clash.common.util.intent
import com.github.kr328.clash.common.util.ticker
import com.github.kr328.clash.design.MainDesign
import com.github.kr328.clash.design.ui.ToastDuration
import com.github.kr328.clash.store.TipsStore
import com.github.kr328.clash.util.startClashService
import com.github.kr328.clash.util.stopClashService
import com.github.kr328.clash.util.withClash
import com.github.kr328.clash.util.withProfile
import com.github.kr328.clash.core.bridge.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import kotlinx.coroutines.selects.select
import kotlinx.coroutines.withContext
import java.util.concurrent.TimeUnit
@ -23,10 +22,6 @@ class MainActivity : BaseActivity<MainDesign>() {
setContentDesign(design)
launch(Dispatchers.IO) {
showUpdatedTips(design)
}
design.fetch()
val ticker = ticker(TimeUnit.SECONDS.toMillis(1))
@ -75,20 +70,6 @@ class MainActivity : BaseActivity<MainDesign>() {
}
}
private suspend fun showUpdatedTips(design: MainDesign) {
val tips = TipsStore(this)
if (tips.primaryVersion != TipsStore.CURRENT_PRIMARY_VERSION) {
tips.primaryVersion = TipsStore.CURRENT_PRIMARY_VERSION
val pkg = packageManager.getPackageInfo(packageName, 0)
if (pkg.firstInstallTime != pkg.lastUpdateTime) {
design.showUpdatedTips()
}
}
}
private suspend fun MainDesign.fetch() {
setClashRunning(clashRunning)
@ -145,7 +126,7 @@ class MainActivity : BaseActivity<MainDesign>() {
private suspend fun queryAppVersionName(): String {
return withContext(Dispatchers.IO) {
packageManager.getPackageInfo(packageName, 0).versionName
packageManager.getPackageInfo(packageName, 0).versionName + "\n" + Bridge.nativeCoreVersion().replace("_", "-")
}
}
}

View file

@ -7,9 +7,13 @@ import com.github.kr328.clash.common.compat.currentProcessName
import com.github.kr328.clash.common.log.Log
import com.github.kr328.clash.remote.Remote
import com.github.kr328.clash.service.util.sendServiceRecreated
import com.microsoft.appcenter.AppCenter
import com.microsoft.appcenter.analytics.Analytics
import com.microsoft.appcenter.crashes.Crashes
import com.github.kr328.clash.util.clashDir
import java.io.File
import java.io.FileOutputStream
import java.io.IOException
import java.io.InputStream
import java.io.OutputStream
@Suppress("unused")
class MainApplication : Application() {
@ -22,16 +26,8 @@ class MainApplication : Application() {
override fun onCreate() {
super.onCreate()
// Initialize AppCenter
if (BuildConfig.APP_CENTER_KEY != null && !BuildConfig.DEBUG) {
AppCenter.start(
this,
BuildConfig.APP_CENTER_KEY,
Analytics::class.java, Crashes::class.java
)
}
val processName = currentProcessName
extractGeoFiles()
Log.d("Process $processName started")
@ -41,4 +37,33 @@ class MainApplication : Application() {
sendServiceRecreated()
}
}
private fun extractGeoFiles() {
clashDir.mkdirs();
val geoipFile = File(clashDir, "geoip.metadb")
if(!geoipFile.exists()) {
FileOutputStream(geoipFile).use {
assets.open("geoip.metadb").copyTo(it);
}
}
val geositeFile = File(clashDir, "geosite.dat")
if(!geositeFile.exists()) {
FileOutputStream(geositeFile).use {
assets.open("geosite.dat").copyTo(it);
}
}
val ASNFile = File(clashDir, "ASN.mmdb")
if(!ASNFile.exists()) {
FileOutputStream(ASNFile).use {
assets.open("ASN.mmdb").copyTo(it);
}
}
}
fun finalize() {
Global.destroy()
}
}

View file

@ -0,0 +1,136 @@
package com.github.kr328.clash
import android.database.Cursor
import android.net.Uri
import android.provider.OpenableColumns
import android.widget.Toast
import androidx.activity.result.contract.ActivityResultContracts
import com.github.kr328.clash.core.Clash
import com.github.kr328.clash.design.MetaFeatureSettingsDesign
import com.github.kr328.clash.util.clashDir
import com.github.kr328.clash.util.withClash
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.isActive
import kotlinx.coroutines.selects.select
import kotlinx.coroutines.withContext
import java.io.File
import java.io.FileOutputStream
class MetaFeatureSettingsActivity : BaseActivity<MetaFeatureSettingsDesign>() {
override suspend fun main() {
val configuration = withClash { queryOverride(Clash.OverrideSlot.Persist) }
defer {
withClash {
patchOverride(Clash.OverrideSlot.Persist, configuration)
}
}
val design = MetaFeatureSettingsDesign(
this,
configuration
)
setContentDesign(design)
while (isActive) {
select<Unit> {
events.onReceive {
}
design.requests.onReceive {
when (it) {
MetaFeatureSettingsDesign.Request.ResetOverride -> {
if (design.requestResetConfirm()) {
defer {
withClash {
clearOverride(Clash.OverrideSlot.Persist)
}
}
finish()
}
}
MetaFeatureSettingsDesign.Request.ImportGeoIp -> {
val uri = startActivityForResult(
ActivityResultContracts.GetContent(),
"*/*")
importGeoFile(uri, MetaFeatureSettingsDesign.Request.ImportGeoIp)
}
MetaFeatureSettingsDesign.Request.ImportGeoSite -> {
val uri = startActivityForResult(
ActivityResultContracts.GetContent(),
"*/*")
importGeoFile(uri, MetaFeatureSettingsDesign.Request.ImportGeoSite)
}
MetaFeatureSettingsDesign.Request.ImportCountry -> {
val uri = startActivityForResult(
ActivityResultContracts.GetContent(),
"*/*")
importGeoFile(uri, MetaFeatureSettingsDesign.Request.ImportCountry)
}
MetaFeatureSettingsDesign.Request.ImportASN -> {
val uri = startActivityForResult(
ActivityResultContracts.GetContent(),
"*/*")
importGeoFile(uri, MetaFeatureSettingsDesign.Request.ImportASN)
}
}
}
}
}
}
private val validDatabaseExtensions = listOf(
".metadb", ".db", ".dat", ".mmdb"
)
private suspend fun importGeoFile(uri: Uri?, importType: MetaFeatureSettingsDesign.Request) {
val cursor: Cursor? = uri?.let {
contentResolver.query(it, null, null, null, null, null)
}
cursor?.use {
if (it.moveToFirst()) {
val columnIndex = it.getColumnIndex(OpenableColumns.DISPLAY_NAME)
val displayName: String =
if (columnIndex != -1) it.getString(columnIndex) else "";
val ext = "." + displayName.substringAfterLast(".")
if (!validDatabaseExtensions.contains(ext)) {
MaterialAlertDialogBuilder(this)
.setTitle(R.string.geofile_unknown_db_format)
.setMessage(getString(R.string.geofile_unknown_db_format_message,
validDatabaseExtensions.joinToString("/")))
.setPositiveButton("OK") { _, _ -> }
.show()
return
}
val outputFileName = when (importType) {
MetaFeatureSettingsDesign.Request.ImportGeoIp ->
"geoip$ext"
MetaFeatureSettingsDesign.Request.ImportGeoSite ->
"geosite$ext"
MetaFeatureSettingsDesign.Request.ImportCountry ->
"country$ext"
MetaFeatureSettingsDesign.Request.ImportASN ->
"ASN$ext"
else -> ""
}
withContext(Dispatchers.IO) {
val outputFile = File(clashDir, outputFileName);
contentResolver.openInputStream(uri).use { ins ->
FileOutputStream(outputFile).use { outs ->
ins?.copyTo(outs)
}
}
}
Toast.makeText(this, getString(R.string.geofile_imported, displayName),
Toast.LENGTH_LONG).show()
return
}
}
Toast.makeText(this, R.string.geofile_import_failed, Toast.LENGTH_LONG).show()
}
}

View file

@ -45,45 +45,14 @@ class OverrideSettingsActivity : BaseActivity<OverrideSettingsDesign>() {
withClash {
clearOverride(Clash.OverrideSlot.Persist)
}
service.sideloadGeoip = ""
}
finish()
}
}
OverrideSettingsDesign.Request.EditSideloadGeoip -> {
withContext(Dispatchers.IO) {
val list = querySideloadProviders()
val initial = service.sideloadGeoip
val exist = list.any { info -> info.packageName == initial }
service.sideloadGeoip =
design.requestSelectSideload(if (exist) initial else "", list)
}
}
}
}
}
}
}
private fun querySideloadProviders(): List<AppInfo> {
val apps = packageManager.getInstalledPackages(PackageManager.GET_META_DATA)
.filter {
it.applicationInfo.metaData?.containsKey(Metadata.GEOIP_FILE_NAME)
?: false
}
.map { it.toAppInfo(packageManager) }
return listOf(
AppInfo(
packageName = "",
label = getString(R.string.use_built_in),
icon = getDrawableCompat(R.drawable.ic_baseline_work)!!,
installTime = 0,
updateDate = 0,
)
) + apps
}
}

View file

@ -1,13 +1,23 @@
package com.github.kr328.clash
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import com.github.kr328.clash.common.util.intent
import com.github.kr328.clash.common.util.setUUID
import com.github.kr328.clash.common.util.ticker
import com.github.kr328.clash.design.ProfilesDesign
import com.github.kr328.clash.design.ui.ToastDuration
import com.github.kr328.clash.R
import com.github.kr328.clash.service.model.Profile
import com.github.kr328.clash.util.withProfile
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import kotlinx.coroutines.selects.select
import kotlinx.coroutines.withContext
import java.util.*
import java.util.concurrent.TimeUnit
class ProfilesActivity : BaseActivity<ProfilesDesign>() {
@ -34,9 +44,16 @@ class ProfilesActivity : BaseActivity<ProfilesDesign>() {
startActivity(NewProfileActivity::class.intent)
ProfilesDesign.Request.UpdateAll ->
withProfile {
queryAll().forEach { p ->
if (p.imported && p.type != Profile.Type.File)
update(p.uuid)
try {
queryAll().forEach { p ->
if (p.imported && p.type != Profile.Type.File)
update(p.uuid)
}
}
finally {
withContext(Dispatchers.Main) {
design.finishUpdateAll();
}
}
}
is ProfilesDesign.Request.Update ->
@ -74,4 +91,37 @@ class ProfilesActivity : BaseActivity<ProfilesDesign>() {
patchProfiles(queryAll())
}
}
override fun onProfileUpdateCompleted(uuid: UUID?) {
if(uuid == null)
return;
launch {
var name: String? = null;
withProfile {
name = queryByUUID(uuid)?.name
}
design?.showToast(
getString(R.string.toast_profile_updated_complete, name),
ToastDuration.Long
)
}
}
override fun onProfileUpdateFailed(uuid: UUID?, reason: String?) {
if(uuid == null)
return;
launch {
var name: String? = null;
withProfile {
name = queryByUUID(uuid)?.name
}
design?.showToast(
getString(R.string.toast_profile_updated_failed, name, reason),
ToastDuration.Long
){
setAction(R.string.edit) {
startActivity(PropertiesActivity::class.intent.setUUID(uuid))
}
}
}
}
}

View file

@ -5,15 +5,12 @@ import com.github.kr328.clash.core.Clash
import com.github.kr328.clash.core.model.Proxy
import com.github.kr328.clash.design.ProxyDesign
import com.github.kr328.clash.design.model.ProxyState
import com.github.kr328.clash.store.TipsStore
import com.github.kr328.clash.util.withClash
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import kotlinx.coroutines.selects.select
import kotlinx.coroutines.sync.Semaphore
import kotlinx.coroutines.sync.withPermit
import java.util.concurrent.TimeUnit
class ProxyActivity : BaseActivity<ProxyDesign>() {
override suspend fun main() {
@ -22,7 +19,6 @@ class ProxyActivity : BaseActivity<ProxyDesign>() {
val states = List(names.size) { ProxyState("?") }
val unorderedStates = names.indices.map { names[it] to states[it] }.toMap()
val reloadLock = Semaphore(10)
val tips = TipsStore(this)
val design = ProxyDesign(
this,
@ -33,17 +29,6 @@ class ProxyActivity : BaseActivity<ProxyDesign>() {
setContentDesign(design)
launch(Dispatchers.IO) {
val pkg = packageManager.getPackageInfo(packageName, 0)
val validate = System.currentTimeMillis() - pkg.firstInstallTime > TimeUnit.DAYS.toMillis(5)
if (tips.requestDonate && validate) {
tips.requestDonate = false
design.requestDonate()
}
}
design.requests.send(ProxyDesign.Request.ReloadAll)
while (isActive) {
@ -73,7 +58,7 @@ class ProxyActivity : BaseActivity<ProxyDesign>() {
}
ProxyDesign.Request.ReloadAll -> {
names.indices.forEach { idx ->
design.requests.offer(ProxyDesign.Request.Reload(idx))
design.requests.trySend(ProxyDesign.Request.Reload(idx))
}
}
is ProxyDesign.Request.Reload -> {

View file

@ -24,6 +24,8 @@ class SettingsActivity : BaseActivity<SettingsDesign>() {
startActivity(NetworkSettingsActivity::class.intent)
SettingsDesign.Request.StartOverride ->
startActivity(OverrideSettingsActivity::class.intent)
SettingsDesign.Request.StartMetaFeature ->
startActivity(MetaFeatureSettingsActivity::class.intent)
}
}
}

View file

@ -16,16 +16,28 @@ class LogcatReader(context: Context, file: LogFile) : AutoCloseable {
}
fun readAll(): List<LogMessage> {
var lastTime = Date(0)
return reader.lineSequence()
.map { it.trim() }
.filter { !it.startsWith("#") }
.map { it.split(":", limit = 3) }
.map {
LogMessage(
time = Date(it[0].toLong()),
level = LogMessage.Level.valueOf(it[1]),
message = it[2]
)
val time = it[0].toLongOrNull()?.let { Date(it) } ?: lastTime
val logMessage = if (it[0].toLongOrNull() != null) {
LogMessage(
time = time,
level = LogMessage.Level.valueOf(it[1]),
message = it[2]
)
} else {
LogMessage(
time = time,
level = LogMessage.Level.Warning, // or any default level
message = it.joinToString(":")
)
}
lastTime = time
logMessage
}
.toList()
}

View file

@ -8,7 +8,8 @@ object SystemLogcat {
"Go",
"DEBUG",
"AndroidRuntime",
"ClashForAndroid"
"ClashMetaForAndroid",
"LwIP",
)
fun dumpCrash(): String {

View file

@ -7,6 +7,7 @@ import android.content.Intent
import android.content.IntentFilter
import com.github.kr328.clash.common.constants.Intents
import com.github.kr328.clash.common.log.Log
import java.util.*
class Broadcasts(private val context: Application) {
interface Observer {
@ -14,6 +15,8 @@ class Broadcasts(private val context: Application) {
fun onStarted()
fun onStopped(cause: String?)
fun onProfileChanged()
fun onProfileUpdateCompleted(uuid: UUID?)
fun onProfileUpdateFailed(uuid: UUID?, reason: String?)
fun onProfileLoaded()
}
@ -52,6 +55,17 @@ class Broadcasts(private val context: Application) {
receivers.forEach {
it.onProfileChanged()
}
Intents.ACTION_PROFILE_UPDATE_COMPLETED ->
receivers.forEach {
it.onProfileUpdateCompleted(
UUID.fromString(intent.getStringExtra(Intents.EXTRA_UUID)))
}
Intents.ACTION_PROFILE_UPDATE_FAILED ->
receivers.forEach {
it.onProfileUpdateFailed(
UUID.fromString(intent.getStringExtra(Intents.EXTRA_UUID)),
intent.getStringExtra(Intents.EXTRA_FAIL_REASON))
}
Intents.ACTION_PROFILE_LOADED -> {
receivers.forEach {
it.onProfileLoaded()
@ -79,6 +93,8 @@ class Broadcasts(private val context: Application) {
addAction(Intents.ACTION_CLASH_STARTED)
addAction(Intents.ACTION_CLASH_STOPPED)
addAction(Intents.ACTION_PROFILE_CHANGED)
addAction(Intents.ACTION_PROFILE_UPDATE_COMPLETED)
addAction(Intents.ACTION_PROFILE_UPDATE_FAILED)
addAction(Intents.ACTION_PROFILE_LOADED)
})

View file

@ -5,18 +5,18 @@ import android.content.Intent
import com.github.kr328.clash.ApkBrokenActivity
import com.github.kr328.clash.AppCrashedActivity
import com.github.kr328.clash.common.Global
import com.github.kr328.clash.common.log.Log
import com.github.kr328.clash.common.util.intent
import com.github.kr328.clash.store.AppStore
import com.github.kr328.clash.util.ApplicationObserver
import com.github.kr328.clash.util.verifyApk
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.launch
object Remote {
val broadcasts: Broadcasts = Broadcasts(Global.application)
val services: Services = Services(Global.application) {
val service: Service = Service(Global.application) {
ApplicationObserver.createdActivities.forEach { it.finish() }
val intent = AppCrashedActivity::class.intent
@ -30,14 +30,25 @@ object Remote {
fun launch() {
ApplicationObserver.attach(Global.application)
ApplicationObserver.onVisibleChanged(visible::offer)
ApplicationObserver.onVisibleChanged {
if(it) {
Log.d("App becomes visible")
service.bind()
broadcasts.register()
}
else {
Log.d("App becomes invisible")
service.unbind()
broadcasts.unregister()
}
}
GlobalScope.launch(Dispatchers.IO) {
run()
Global.launch(Dispatchers.IO) {
verifyApp()
}
}
private suspend fun run() {
private suspend fun verifyApp() {
val context = Global.application
val store = AppStore(context)
val updatedAt = getLastUpdated(context)
@ -54,16 +65,6 @@ object Remote {
store.updatedAt = updatedAt
}
}
while (true) {
if (visible.receive()) {
services.bind()
broadcasts.register()
} else {
services.unbind()
broadcasts.unregister()
}
}
}
private fun getLastUpdated(context: Context): Long {

View file

@ -0,0 +1,59 @@
package com.github.kr328.clash.remote
import android.app.Application
import android.content.ComponentName
import android.content.Context
import android.content.ServiceConnection
import android.os.IBinder
import com.github.kr328.clash.common.log.Log
import com.github.kr328.clash.common.util.intent
import com.github.kr328.clash.service.RemoteService
import com.github.kr328.clash.service.remote.IRemoteService
import com.github.kr328.clash.service.remote.unwrap
import com.github.kr328.clash.util.unbindServiceSilent
import java.util.concurrent.TimeUnit
class Service(private val context: Application, val crashed: () -> Unit) {
val remote = Resource<IRemoteService>()
private val connection = object : ServiceConnection {
private var lastCrashed: Long = -1
override fun onServiceConnected(name: ComponentName?, service: IBinder) {
remote.set(service.unwrap(IRemoteService::class))
}
override fun onServiceDisconnected(name: ComponentName?) {
remote.set(null)
if (System.currentTimeMillis() - lastCrashed < TOGGLE_CRASHED_INTERVAL) {
unbind()
crashed()
}
lastCrashed = System.currentTimeMillis()
Log.w("RemoteService killed or crashed")
}
}
fun bind() {
try {
context.bindService(RemoteService::class.intent, connection, Context.BIND_AUTO_CREATE)
} catch (e: Exception) {
unbind()
crashed()
}
}
fun unbind() {
context.unbindServiceSilent(connection)
remote.set(null)
}
companion object {
private val TOGGLE_CRASHED_INTERVAL = TimeUnit.SECONDS.toMillis(10)
}
}

View file

@ -1,88 +0,0 @@
package com.github.kr328.clash.remote
import android.app.Application
import android.content.ComponentName
import android.content.Context
import android.content.ServiceConnection
import android.os.IBinder
import com.github.kr328.clash.common.log.Log
import com.github.kr328.clash.common.util.intent
import com.github.kr328.clash.service.ClashManager
import com.github.kr328.clash.service.ProfileService
import com.github.kr328.clash.service.remote.IClashManager
import com.github.kr328.clash.service.remote.IProfileManager
import com.github.kr328.clash.service.remote.unwrap
import com.github.kr328.clash.util.unbindServiceSilent
import java.util.concurrent.TimeUnit
class Services(private val context: Application, val crashed: () -> Unit) {
val clash = Resource<IClashManager>()
val profile = Resource<IProfileManager>()
private val clashConnection = object : ServiceConnection {
private var lastCrashed: Long = -1
override fun onServiceConnected(name: ComponentName?, service: IBinder?) {
clash.set(service?.unwrap(IClashManager::class))
}
override fun onServiceDisconnected(name: ComponentName?) {
clash.set(null)
if (System.currentTimeMillis() - lastCrashed < TOGGLE_CRASHED_INTERVAL) {
unbind()
crashed()
}
lastCrashed = System.currentTimeMillis()
Log.w("ClashManager crashed")
}
}
private val profileConnection = object : ServiceConnection {
private var lastCrashed: Long = -1
override fun onServiceConnected(name: ComponentName?, service: IBinder?) {
profile.set(service?.unwrap(IProfileManager::class))
}
override fun onServiceDisconnected(name: ComponentName?) {
profile.set(null)
if (System.currentTimeMillis() - lastCrashed < TOGGLE_CRASHED_INTERVAL) {
unbind()
crashed()
}
lastCrashed = System.currentTimeMillis()
Log.w("ProfileService crashed")
}
}
fun bind() {
try {
context.bindService(ClashManager::class.intent, clashConnection, Context.BIND_AUTO_CREATE)
context.bindService(ProfileService::class.intent, profileConnection, Context.BIND_AUTO_CREATE)
} catch (e: Exception) {
unbind()
crashed()
}
}
fun unbind() {
context.unbindServiceSilent(clashConnection)
context.unbindServiceSilent(profileConnection)
clash.set(null)
profile.set(null)
}
companion object {
private val TOGGLE_CRASHED_INTERVAL = TimeUnit.SECONDS.toMillis(10)
}
}

View file

@ -9,7 +9,8 @@ import java.io.File
import java.util.zip.ZipFile
object ApplicationObserver {
private val activities: MutableSet<Activity> = mutableSetOf()
private val _createdActivities: MutableSet<Activity> = mutableSetOf()
private val _visibleActivities: MutableSet<Activity> = mutableSetOf()
private var visibleChanged: (Boolean) -> Unit = {}
@ -23,25 +24,31 @@ object ApplicationObserver {
}
val createdActivities: Set<Activity>
get() = activities
get() = _createdActivities
private val activityObserver = object : Application.ActivityLifecycleCallbacks {
@Synchronized
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
activities.add(activity)
appVisible = true
_createdActivities.add(activity)
}
@Synchronized
override fun onActivityDestroyed(activity: Activity) {
activities.remove(activity)
appVisible = activities.isNotEmpty()
_createdActivities.remove(activity)
_visibleActivities.remove(activity)
appVisible = _visibleActivities.isNotEmpty()
}
override fun onActivityStarted(activity: Activity) {
_visibleActivities.add(activity)
appVisible = true
}
override fun onActivityStopped(activity: Activity) {
_visibleActivities.remove(activity)
appVisible = _visibleActivities.isNotEmpty()
}
override fun onActivityStarted(activity: Activity) {}
override fun onActivityStopped(activity: Activity) {}
override fun onActivityPaused(activity: Activity) {}
override fun onActivityResumed(activity: Activity) {}
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {}

View file

@ -4,4 +4,7 @@ import android.content.Context
import java.io.File
val Context.logsDir: File
get() = cacheDir.resolve("logs")
get() = cacheDir.resolve("logs")
val Context.clashDir: File
get() = filesDir.resolve("clash")

View file

@ -14,14 +14,15 @@ suspend fun <T> withClash(
block: suspend IClashManager.() -> T
): T {
while (true) {
val client = Remote.services.clash.get()
val remote = Remote.service.remote.get()
val client = remote.clash()
try {
return withContext(context) { client.block() }
} catch (e: DeadObjectException) {
Log.w("Remote services panic")
Remote.services.clash.reset(client)
Remote.service.remote.reset(remote)
}
}
}
@ -31,14 +32,15 @@ suspend fun <T> withProfile(
block: suspend IProfileManager.() -> T
): T {
while (true) {
val client = Remote.services.profile.get()
val remote = Remote.service.remote.get()
val client = remote.profile()
try {
return withContext(context) { client.block() }
} catch (e: DeadObjectException) {
Log.w("Remote services panic")
Remote.services.profile.reset(client)
Remote.service.remote.reset(remote)
}
}
}

View file

@ -2,14 +2,15 @@
xmlns:tools="http://schemas.android.com/tools"
android:width="108dp"
android:height="108dp"
android:viewportWidth="406.92642"
android:viewportHeight="406.92642">
<group
android:translateX="103.4632"
android:translateY="103.4632">
android:viewportWidth="403"
android:viewportHeight="403"
android:name="vector">
<group>
<path
android:fillColor="#1E4376"
android:pathData="M47.211,168.128C70.531,-34.962 67.471,13.788 94.071,43.818c13.45,-1.52 27.24,-3.47 40.82,-0.67c2.64,0.13 5.42,1.86 7.71,0.18c4.12,-6.27 7.35,-13.54 11.35,-20c12.19,-24.44 12.85,19.54 15.48,26.52c5.23,32.99 10.89,64.46 14.67,97.59c0.31,10.72 5.74,32.92 1.08,33.56c-49.36,5.23 -147.71,3.91 -160.84,-6.3c-15.85,-10.5 -15.18,-35.33 2.03,-43.72c3.63,-2.03 10.68,-3.72 11.94,0.7c-2.41,4.99 -8.79,5.77 -12.12,11.17C16.621,158.948 33.111,168.888 47.211,168.128zM87.841,74.008c-10.42,0.52 -9.59,14.89 -0.07,15.18C98.191,88.668 97.361,74.298 87.841,74.008zM149.121,89.188c10.46,-0.34 9.85,-14.71 0.38,-15.18C139.031,74.348 139.651,88.718 149.121,89.188zM107.871,99.228c2.16,3.48 5.28,3.29 9.79,0.16c3.81,3.17 8.06,3.28 9.18,-0.19c-3.78,1.17 -7.04,0.79 -9.4,-3.49C115.371,100.108 112.071,100.428 107.871,99.228z"
tools:ignore="VectorPath" />
android:pathData="M 141.08 128.47 C 141.88 128.42 142.72 128.38 143.41 128.8 C 144.51 129.46 145.39 130.41 146.33 131.25 C 160.38 144.1 174.48 156.9 188.53 169.75 C 189.48 170.59 190.37 171.56 191.54 172.11 C 192.45 172.55 193.49 172.33 194.46 172.2 C 197.04 171.76 199.66 171.74 202.26 171.74 C 204.77 171.78 207.29 171.86 209.77 172.27 C 210.77 172.38 211.95 172.71 212.71 171.84 C 228.19 157.7 243.73 143.58 259.23 129.43 C 260.54 128.06 262.55 128.36 264.26 128.57 C 268.58 129.21 272.94 129.51 277.28 130 C 278 130.14 279.02 130.19 279.27 131.05 C 279.61 132.54 279.42 134.07 279.46 135.58 C 279.44 166.17 279.44 196.77 279.42 227.36 C 279.41 228.92 279.51 230.47 279.35 232.01 C 279.29 232.56 279.22 233.21 278.76 233.59 C 277.8 234.01 276.74 234.17 275.72 234.42 C 271.39 235.43 266.98 236.16 262.66 237.26 C 260.49 237.83 258.25 237.61 256.04 237.64 C 254.91 237.63 253.74 237.73 252.61 237.54 C 251.95 237.49 251.48 236.9 251.43 236.26 C 251.19 234.74 251.33 233.2 251.31 231.67 C 251.29 216.61 251.28 201.54 251.29 186.48 C 251.27 185 251.38 183.49 251.17 182.01 C 250.9 180.3 249.11 179.1 247.44 179.31 C 246.51 179.32 245.72 179.9 245.05 180.49 C 237.57 187.38 230 194.15 222.54 201.02 C 221.68 201.76 220.7 202.63 219.48 202.51 C 217.88 202.37 216.37 201.8 214.82 201.44 C 208.61 199.89 202.12 199.7 195.77 200.24 C 192.68 200.67 189.56 201.02 186.59 202 C 185.63 202.27 184.66 202.57 183.67 202.52 C 182.65 202.45 181.86 201.78 181.14 201.15 C 173.72 194.33 166.23 187.63 158.81 180.81 C 158.09 180.18 157.31 179.49 156.33 179.34 C 155.1 179.19 153.83 179.69 152.99 180.59 C 152.26 181.42 152.23 182.56 152.19 183.61 C 152.23 200.72 152.18 217.81 152.21 234.91 C 152.18 235.57 152.18 236.24 151.92 236.87 C 151.53 237.58 150.62 237.61 149.91 237.64 C 147.99 237.68 146.08 237.63 144.16 237.64 C 141.99 237.68 139.9 237.05 137.81 236.62 C 133.97 235.77 130.14 234.91 126.29 234.1 C 125.48 233.9 124.35 233.66 124.2 232.66 C 123.96 230.91 124.13 229.14 124.1 227.36 C 124.06 196.88 124.08 166.41 124.08 135.93 C 124.08 134.49 124 133.06 124.13 131.64 C 124.18 131.12 124.33 130.51 124.84 130.24 C 125.38 130 125.99 129.97 126.56 129.88 C 131.42 129.55 136.25 128.96 141.08 128.47 Z M 198.81 240.82 C 200.99 240.64 203.19 240.7 205.35 240.82 C 207.04 240.8 208.08 242.85 207.31 244.28 C 206.36 246.17 205.38 248.03 204.27 249.84 C 203.56 251.14 201.5 251.39 200.57 250.19 C 199.67 249.09 199.15 247.78 198.44 246.56 C 197.9 245.55 197.21 244.59 196.96 243.44 C 196.7 242.24 197.62 240.99 198.81 240.82 Z"
android:fillColor="#3372b6"/>
<path
android:pathData="M 125.67 244.75 C 126.09 244.7 126.51 244.67 126.95 244.67 C 139.02 244.7 151.09 244.69 163.19 244.69 C 164.26 244.67 165.5 244.94 166.14 245.92 C 166.8 247.02 166.66 248.72 165.52 249.45 C 164.74 249.99 163.74 249.99 162.83 250.02 C 150.88 249.99 138.9 250.01 126.95 250.02 C 126.28 249.99 125.6 249.99 124.97 249.77 C 123.94 249.38 123.25 248.25 123.4 247.15 C 123.49 245.97 124.43 244.86 125.67 244.76 L 125.67 244.75 Z M 239.67 244.75 C 241.29 244.59 242.93 244.72 244.57 244.69 C 255.33 244.67 266.1 244.72 276.86 244.67 C 277.55 244.7 278.27 244.69 278.92 244.97 C 279.88 245.4 280.42 246.44 280.42 247.47 C 280.44 248.67 279.44 249.8 278.24 249.92 C 276.7 250.11 275.15 249.99 273.61 250 L 243.85 250 C 242.33 249.99 240.79 250.12 239.29 249.87 C 238.15 249.67 237.23 248.64 237.31 247.46 C 237.16 246.07 238.34 244.85 239.67 244.75 Z M 162.61 257.67 C 163.41 257.45 164.3 257.33 165.06 257.72 C 166.65 258.45 167.02 260.98 165.6 262.08 C 164.76 262.67 163.74 262.91 162.8 263.24 C 159.22 264.36 155.74 265.76 152.16 266.87 C 148.04 268.17 144 269.71 139.9 271.09 C 136.91 272.06 133.94 273.07 130.97 274.1 C 129.73 274.52 128.54 275.06 127.27 275.33 C 126.49 275.5 125.63 275.35 125.02 274.83 C 124.01 274.03 123.82 272.5 124.4 271.4 C 124.87 270.6 125.82 270.32 126.63 270 C 129.2 269.1 131.73 268.17 134.31 267.36 C 140.78 265.27 147.14 262.84 153.63 260.8 C 156.65 259.81 159.59 258.62 162.61 257.67 Z M 239.3 257.54 C 240.23 257.32 241.14 257.67 242.02 257.92 C 244.84 258.89 247.61 259.97 250.45 260.88 C 257.12 262.99 263.65 265.51 270.34 267.62 C 272.53 268.33 274.71 269.14 276.91 269.9 C 277.73 270.22 278.64 270.49 279.25 271.18 C 280.21 272.5 279.64 274.64 278.1 275.23 C 277.11 275.62 276.06 275.23 275.1 274.93 C 271.13 273.46 267.11 272.14 263.09 270.83 C 259.18 269.47 255.29 268.04 251.36 266.79 C 247.78 265.66 244.32 264.26 240.74 263.16 C 239.79 262.82 238.78 262.59 238.02 261.91 C 236.65 260.58 237.39 257.88 239.3 257.54 Z"
android:fillColor="#f39800"/>
</group>
</vector>

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/color_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/color_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_banner_background">#FFFFFF</color>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>

View file

@ -1,12 +1,165 @@
@file:Suppress("UNUSED_VARIABLE")
allprojects {
repositories {
google()
mavenCentral()
import com.android.build.gradle.AppExtension
import com.android.build.gradle.BaseExtension
import java.net.URL
import java.util.*
maven {
url = uri("https://maven.kr328.app")
buildscript {
repositories {
mavenCentral()
google()
maven("https://raw.githubusercontent.com/MetaCubeX/maven-backup/main/releases")
}
dependencies {
classpath(libs.build.android)
classpath(libs.build.kotlin.common)
classpath(libs.build.kotlin.serialization)
classpath(libs.build.ksp)
classpath(libs.build.golang)
}
}
subprojects {
repositories {
mavenCentral()
google()
maven("https://raw.githubusercontent.com/MetaCubeX/maven-backup/main/releases")
}
val isApp = name == "app"
apply(plugin = if (isApp) "com.android.application" else "com.android.library")
extensions.configure<BaseExtension> {
defaultConfig {
if (isApp) {
applicationId = "com.github.metacubex.clash"
}
minSdk = 21
targetSdk = 31
versionName = "2.11.2"
versionCode = 211002
resValue("string", "release_name", "v$versionName")
resValue("integer", "release_code", "$versionCode")
externalNativeBuild {
cmake {
abiFilters("arm64-v8a", "armeabi-v7a", "x86", "x86_64")
}
}
if (!isApp) {
consumerProguardFiles("consumer-rules.pro")
} else {
setProperty("archivesBaseName", "cmfa-$versionName")
}
}
ndkVersion = "23.0.7599858"
compileSdkVersion(defaultConfig.targetSdk!!)
if (isApp) {
packagingOptions {
resources {
excludes.add("DebugProbesKt.bin")
}
}
}
productFlavors {
flavorDimensions("feature")
create("alpha") {
isDefault = true
dimension = flavorDimensionList[0]
versionNameSuffix = ".Alpha"
buildConfigField("boolean", "PREMIUM", "Boolean.parseBoolean(\"false\")")
resValue("string", "launch_name", "@string/launch_name_alpha")
resValue("string", "application_name", "@string/application_name_alpha")
if (isApp) {
applicationIdSuffix = ".alpha"
}
}
create("meta") {
dimension = flavorDimensionList[0]
versionNameSuffix = ".Meta"
buildConfigField("boolean", "PREMIUM", "Boolean.parseBoolean(\"false\")")
resValue("string", "launch_name", "@string/launch_name_meta")
resValue("string", "application_name", "@string/application_name_meta")
if (isApp) {
applicationIdSuffix = ".meta"
}
}
}
sourceSets {
getByName("meta") {
java.srcDirs("src/foss/java")
}
getByName("alpha") {
java.srcDirs("src/foss/java")
}
}
signingConfigs {
val keystore = rootProject.file("signing.properties")
if (keystore.exists()) {
create("release") {
val prop = Properties().apply {
keystore.inputStream().use(this::load)
}
storeFile = rootProject.file("release.keystore")
storePassword = prop.getProperty("keystore.password")!!
keyAlias = prop.getProperty("key.alias")!!
keyPassword = prop.getProperty("key.password")!!
}
}
}
buildTypes {
named("release") {
isMinifyEnabled = isApp
isShrinkResources = isApp
signingConfig = signingConfigs.findByName("release")
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
named("debug") {
versionNameSuffix = ".debug"
}
}
buildFeatures.apply {
dataBinding {
isEnabled = name != "hideapi"
}
}
if (isApp) {
this as AppExtension
splits {
abi {
isEnable = true
isUniversalApk = true
}
}
}
}
}
@ -14,3 +167,15 @@ allprojects {
task("clean", type = Delete::class) {
delete(rootProject.buildDir)
}
tasks.wrapper {
distributionType = Wrapper.DistributionType.ALL
doLast {
val sha256 = URL("$distributionUrl.sha256").openStream()
.use { it.reader().readText().trim() }
file("gradle/wrapper/gradle-wrapper.properties")
.appendText("distributionSha256Sum=$sha256")
}
}

View file

@ -1,35 +0,0 @@
plugins {
kotlin("jvm") version "1.5.0"
`java-gradle-plugin`
}
repositories {
mavenCentral()
google()
}
dependencies {
implementation(kotlin("stdlib"))
compileOnly(gradleApi())
api(kotlin("gradle-plugin"))
api(kotlin("serialization"))
api("com.android.tools.build:gradle:4.2.1") {
exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk8")
exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk7")
exclude("org.jetbrains.kotlin", "kotlin-reflect")
}
api("com.google.devtools.ksp:symbol-processing-gradle-plugin:1.5.0-1.0.0-alpha10") {
exclude("com.android.tools.build", "gradle")
}
}
gradlePlugin {
plugins {
create("golang") {
id = "library-golang"
implementationClass = "LibraryGolangPlugin"
}
}
}

View file

@ -1,17 +0,0 @@
import org.gradle.api.Project
const val buildVersionCode = 203022
const val buildVersionName = "2.3.22"
const val buildMinSdkVersion = 21
const val buildTargetSdkVersion = 30
const val buildNdkVersion = "23.0.7123448"
val Project.buildFlavor: String
get() {
return if (project(":core").file("src/main/golang/clash/script/script.go").exists())
"premium"
else
"open"
}

View file

@ -1,14 +0,0 @@
const val activityVersion = "1.2.3"
const val coroutineVersion = "1.4.3"
const val roomVersion = "2.3.0"
const val ktxVersion = "1.3.2"
const val appcompatVersion = "1.2.0"
const val muiltprocessVersion = "1.0.0"
const val kaidlVersion = "1.11"
const val appcenterVersion = "4.1.1"
const val serializationVersion = "1.2.1"
const val materialVersion = "1.3.0"
const val coordinatorlayoutVersion = "1.1.0"
const val recyclerviewVersion = "1.2.0"
const val fragmentVersion = "1.3.3"
const val viewpagerVersion = "1.0.0"

View file

@ -1,8 +0,0 @@
import org.gradle.api.Project
import java.io.File
val Project.golangSource: File
get() = file("src/main/golang")
val Project.golangBuild: File
get() = buildDir.resolve("intermediates/golang")

View file

@ -1,119 +0,0 @@
import org.apache.tools.ant.taskdefs.condition.Os
import org.gradle.api.DefaultTask
import org.gradle.api.GradleScriptException
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.provider.Property
import org.gradle.api.provider.SetProperty
import org.gradle.api.tasks.*
import java.io.ByteArrayOutputStream
import java.io.File
import java.io.FileNotFoundException
import java.io.IOException
abstract class GolangBuildTask : DefaultTask() {
abstract val debug: Property<Boolean>
@Input get
abstract val premium: Property<Boolean>
@Input get
abstract val nativeAbis: SetProperty<String>
@Input get
abstract val minSdkVersion: Property<Int>
@Input get
abstract val cCompilerBasePath: DirectoryProperty
@InputDirectory get
abstract val inputDirectory: DirectoryProperty
@InputDirectory get
abstract val outputDirectory: DirectoryProperty
@OutputDirectory get
@TaskAction
fun build() {
val src = inputDirectory.get().asFile
val cmd = if (debug.get()) {
"""
go build --buildmode=c-shared -trimpath -o "%s" -tags "without_gvisor,without_system,debug${if (premium.get()) ",premium" else ""}"
""".trimIndent().trim()
} else {
"""
go build --buildmode=c-shared -trimpath -o "%s" -tags "without_gvisor,without_system${if (premium.get()) ",premium" else ""}" -ldflags "-s -w"
""".trimIndent().trim()
}
nativeAbis.get().parallelStream().forEach {
val out = outputDirectory.get().file("$it/libclash.so")
cmd.format(out).exec(pwd = src, env = generateGolangBuildEnvironment(it))
}
}
private fun generateGolangBuildEnvironment(abi: String): Map<String, String> {
val (goArch, goArm) = when (abi) {
"arm64-v8a" -> "arm64" to ""
"armeabi-v7a" -> "arm" to "7"
"x86" -> "386" to ""
"x86_64" -> "amd64" to ""
else -> throw UnsupportedOperationException("unsupported abi: $abi")
}
val compiler = when (abi) {
"armeabi-v7a" ->
"armv7a-linux-androideabi${minSdkVersion.get()}-clang"
"arm64-v8a" ->
"aarch64-linux-android${minSdkVersion.get()}-clang"
"x86" ->
"i686-linux-android${minSdkVersion.get()}-clang"
"x86_64" ->
"x86_64-linux-android${minSdkVersion.get()}-clang"
else ->
throw GradleScriptException(
"Unsupported abi $abi",
FileNotFoundException("Unsupported abi $abi")
)
}
return mapOf(
"CC" to cCompilerBasePath.get().asFile.resolve(compiler).absolutePath,
"GOOS" to "android",
"GOARCH" to goArch,
"GOARM" to goArm,
"CGO_ENABLED" to "1",
"CFLAGS" to "-O3 -Werror",
)
}
private fun String.exec(
pwd: File,
env: Map<String, String> = System.getenv()
): String {
val process = ProcessBuilder().run {
if (Os.isFamily(Os.FAMILY_WINDOWS))
command("cmd.exe", "/c", this@exec)
else
command("bash", "-c", this@exec)
environment().putAll(env)
directory(pwd)
redirectErrorStream(true)
start()
}
val outputStream = ByteArrayOutputStream()
process.inputStream.copyTo(outputStream)
if (process.waitFor() != 0) {
println(outputStream.toString("utf-8"))
throw GradleScriptException("Exec $this failure", IOException())
}
return outputStream.toString("utf-8")
}
}

View file

@ -1,69 +0,0 @@
import com.android.build.gradle.LibraryExtension
import org.apache.tools.ant.taskdefs.condition.Os
import org.gradle.api.GradleScriptException
import org.gradle.api.Plugin
import org.gradle.api.Project
import java.io.File
import java.io.FileNotFoundException
import java.util.*
class LibraryGolangPlugin : Plugin<Project> {
override fun apply(target: Project) {
target.extensions.getByType(LibraryExtension::class.java).apply {
target.afterEvaluate {
libraryVariants.forEach { variant ->
val abis = defaultConfig.externalNativeBuild.cmake.abiFilters +
defaultConfig.externalNativeBuild.ndkBuild.abiFilters
val nameCapitalize = variant.name.capitalize(Locale.getDefault())
val golangBuildDir = target.golangBuild.resolve(variant.name)
val task = target.tasks.register(
"externalGolangBuild$nameCapitalize",
GolangBuildTask::class.java
) {
it.premium.set(variant.flavorName == "premium")
it.debug.set(variant.name == "debug")
it.nativeAbis.set(abis)
it.minSdkVersion.set(defaultConfig.minSdk!!)
it.cCompilerBasePath.set(compilerBasePath)
it.inputDirectory.set(target.golangSource)
it.outputDirectory.set(golangBuildDir)
}
sourceSets.named(variant.name) {
it.jniLibs {
srcDir(golangBuildDir)
}
}
variant.externalNativeBuildProviders.forEach {
it.get().dependsOn(task)
}
target.tasks.filter { it.name.startsWith("buildCMake") }.forEach {
it.mustRunAfter(task)
}
}
}
}
}
private val LibraryExtension.compilerBasePath: File
get() {
val host = when {
Os.isFamily(Os.FAMILY_WINDOWS) ->
"windows"
Os.isFamily(Os.FAMILY_MAC) ->
"darwin"
Os.isFamily(Os.FAMILY_UNIX) ->
"linux"
else ->
throw GradleScriptException(
"Unsupported host",
FileNotFoundException("Unsupported host")
)
}
return ndkDirectory.resolve("toolchains/llvm/prebuilt/$host-x86_64/bin")
}
}

View file

@ -1,47 +1,11 @@
plugins {
id("com.android.library")
kotlin("android")
}
android {
compileSdk = buildTargetSdkVersion
defaultConfig {
minSdk = buildMinSdkVersion
targetSdk = buildTargetSdkVersion
versionCode = buildVersionCode
versionName = buildVersionName
consumerProguardFiles("consumer-rules.pro")
}
buildTypes {
named("release") {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
id("com.android.library")
}
dependencies {
compileOnly(project(":hideapi"))
implementation(kotlin("stdlib-jdk7"))
implementation("androidx.core:core-ktx:$ktxVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutineVersion")
}
repositories {
mavenCentral()
google()
implementation(libs.kotlin.coroutine)
implementation(libs.androidx.core)
}

View file

@ -1,8 +1,11 @@
package com.github.kr328.clash.common
import android.app.Application
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.cancel
object Global {
object Global : CoroutineScope by CoroutineScope(Dispatchers.IO) {
val application: Application
get() = application_
@ -11,4 +14,8 @@ object Global {
fun init(application: Application) {
this.application_ = application
}
fun destroy() {
cancel()
}
}

View file

@ -2,6 +2,8 @@ package com.github.kr328.clash.common.compat
import android.app.ActivityThread
import android.app.Application
import android.graphics.drawable.AdaptiveIconDrawable
import android.graphics.drawable.Drawable
import android.os.Build
import com.github.kr328.clash.common.log.Log
@ -18,3 +20,12 @@ val Application.currentProcessName: String
packageName
}
}
fun Drawable.foreground(): Drawable {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
this is AdaptiveIconDrawable && this.background == null
) {
return this.foreground
}
return this
}

View file

@ -4,17 +4,12 @@ package com.github.kr328.clash.common.compat
import android.content.Context
import android.graphics.drawable.Drawable
import android.os.Build
import androidx.annotation.ColorRes
import androidx.annotation.DrawableRes
import androidx.core.content.ContextCompat
fun Context.getColorCompat(@ColorRes id: Int): Int {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
this.getColor(id)
} else {
resources.getColor(id)
}
return ContextCompat.getColor(this, id)
}
fun Context.getDrawableCompat(@DrawableRes id: Int): Drawable? {

View file

@ -7,7 +7,7 @@ import android.text.Html
import android.text.Spanned
fun fromHtmlCompat(content: String): Spanned {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
return if (Build.VERSION.SDK_INT >= 24) {
Html.fromHtml(content, Html.FROM_HTML_MODE_COMPACT)
} else {
Html.fromHtml(content)

View file

@ -3,9 +3,13 @@ package com.github.kr328.clash.common.compat
import android.app.PendingIntent
import android.os.Build
fun pendingIntentFlags(flags: Int, immutable: Boolean = false): Int {
return if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M && immutable) {
flags or PendingIntent.FLAG_IMMUTABLE
fun pendingIntentFlags(flags: Int, mutable: Boolean = false): Int {
return if (Build.VERSION.SDK_INT >= 24) {
if (Build.VERSION.SDK_INT > 30 && mutable) {
flags or PendingIntent.FLAG_MUTABLE
} else {
flags or PendingIntent.FLAG_IMMUTABLE
}
} else {
flags
}

View file

@ -6,7 +6,7 @@ import android.content.pm.PackageInfo
val PackageInfo.versionCodeCompat: Long
get() {
return if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P) {
return if (android.os.Build.VERSION.SDK_INT >= 28) {
longVersionCode
} else {
versionCode.toLong()

View file

@ -8,7 +8,7 @@ import java.util.*
val Configuration.preferredLocale: Locale
get() {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
return if (Build.VERSION.SDK_INT >= 24) {
locales[0]
} else {
locale

View file

@ -5,7 +5,7 @@ import android.content.Intent
import android.os.Build
fun Context.startForegroundServiceCompat(intent: Intent) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (Build.VERSION.SDK_INT >= 26) {
startForegroundService(intent)
} else {
startService(intent)

View file

@ -4,6 +4,8 @@ import android.content.ComponentName
import com.github.kr328.clash.common.util.packageName
object Components {
val MAIN_ACTIVITY = ComponentName(packageName, "$packageName.MainActivity")
val PROPERTIES_ACTIVITY = ComponentName(packageName, "$packageName.PropertiesActivity")
private const val componentsPackageName = "com.github.kr328.clash"
val MAIN_ACTIVITY = ComponentName(packageName, "$componentsPackageName.MainActivity")
val PROPERTIES_ACTIVITY = ComponentName(packageName, "$componentsPackageName.PropertiesActivity")
}

View file

@ -5,6 +5,9 @@ import com.github.kr328.clash.common.util.packageName
object Intents {
// Public
val ACTION_PROVIDE_URL = "$packageName.action.PROVIDE_URL"
val ACTION_START_CLASH = "$packageName.action.START_CLASH"
val ACTION_STOP_CLASH = "$packageName.action.STOP_CLASH"
val ACTION_TOGGLE_CLASH = "$packageName.action.TOGGLE_CLASH"
const val EXTRA_NAME = "name"
@ -14,6 +17,8 @@ object Intents {
val ACTION_CLASH_STOPPED = "$packageName.intent.action.CLASH_STOPPED"
val ACTION_CLASH_REQUEST_STOP = "$packageName.intent.action.CLASH_REQUEST_STOP"
val ACTION_PROFILE_CHANGED = "$packageName.intent.action.PROFILE_CHANGED"
val ACTION_PROFILE_UPDATE_COMPLETED = "$packageName.intent.action.PROFILE_UPDATE_COMPLETED"
val ACTION_PROFILE_UPDATE_FAILED = "$packageName.intent.action.PROFILE_UPDATE_FAILED"
val ACTION_PROFILE_REQUEST_UPDATE = "$packageName.intent.action.REQUEST_UPDATE"
val ACTION_PROFILE_SCHEDULE_UPDATES = "$packageName.intent.action.SCHEDULE_UPDATES"
val ACTION_PROFILE_LOADED = "$packageName.intent.action.PROFILE_LOADED"
@ -21,4 +26,5 @@ object Intents {
const val EXTRA_STOP_REASON = "stop_reason"
const val EXTRA_UUID = "uuid"
const val EXTRA_FAIL_REASON = "fail_reason"
}

View file

@ -1,7 +1,7 @@
package com.github.kr328.clash.common.log
object Log {
private const val TAG = "ClashForAndroid"
private const val TAG = "ClashMetaForAndroid"
fun i(message: String, throwable: Throwable? = null) =
android.util.Log.i(TAG, message, throwable)

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="receive_clash_broadcasts">Получать оповещения от Clash</string>
<string name="receive_broadcasts_of_clash">Получать оповещения от сервисов Clash</string>
</resources>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="receive_clash_broadcasts">接收 Clash 廣播</string>
<string name="receive_broadcasts_of_clash">接收來自 Clash 內部的廣播</string>
</resources>

View file

@ -1,72 +1,48 @@
import com.github.kr328.golang.GolangBuildTask
import com.github.kr328.golang.GolangPlugin
import java.io.FileOutputStream
import java.net.URL
import java.time.Duration
plugins {
id("com.android.library")
kotlin("android")
id("com.android.library")
id("kotlinx-serialization")
id("library-golang")
id("golang-android")
}
val geoipDatabaseUrl =
"https://github.com/Dreamacro/maxmind-geoip/releases/latest/download/Country.mmdb"
val geoipInvalidate = Duration.ofDays(7)!!
val geoipOutput = buildDir.resolve("intermediates/golang_blob")
val golangSource = file("src/main/golang/native")
golang {
sourceSets {
create("alpha") {
tags.set(listOf("foss","with_gvisor","cmfa"))
srcDir.set(file("src/foss/golang"))
}
create("meta") {
tags.set(listOf("foss","with_gvisor","cmfa"))
srcDir.set(file("src/foss/golang"))
}
all {
fileName.set("libclash.so")
packageName.set("cfa/native")
}
}
}
android {
compileSdk = buildTargetSdkVersion
ndkVersion = buildNdkVersion
flavorDimensions(buildFlavor)
defaultConfig {
minSdk = buildMinSdkVersion
targetSdk = buildTargetSdkVersion
versionCode = buildVersionCode
versionName = buildVersionName
consumerProguardFiles("consumer-rules.pro")
externalNativeBuild {
cmake {
abiFilters("arm64-v8a", "armeabi-v7a", "x86", "x86_64")
arguments(
"-DGO_SOURCE:STRING=$golangSource",
"-DGO_OUTPUT:STRING=$golangBuild",
"-DFLAVOR_NAME=$buildFlavor"
)
productFlavors {
all {
externalNativeBuild {
cmake {
arguments("-DGO_SOURCE:STRING=${golangSource}")
arguments("-DGO_OUTPUT:STRING=${GolangPlugin.outputDirOf(project, null, null)}")
arguments("-DFLAVOR_NAME:STRING=$name")
}
}
}
}
buildTypes {
named("release") {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
productFlavors {
create("open") {
dimension = "open"
}
create("premium") {
dimension = "premium"
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
externalNativeBuild {
cmake {
path = file("src/main/cpp/CMakeLists.txt")
@ -75,60 +51,15 @@ android {
}
dependencies {
api(project(":common"))
implementation(project(":common"))
implementation(kotlin("stdlib-jdk7"))
implementation("androidx.core:core-ktx:$ktxVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutineVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$serializationVersion")
}
repositories {
mavenCentral()
}
task("downloadGeoipDatabase") {
val databaseFile = geoipOutput.resolve("Country.mmdb")
val moduleFile = geoipOutput.resolve("go.mod")
val sourceFile = geoipOutput.resolve("blob.go")
val moduleContent = """
module "cfa/blob"
""".trimIndent()
val sourceContent = """
package blob
import _ "embed"
//go:embed Country.mmdb
var GeoipDatabase []byte
""".trimIndent()
onlyIf {
System.currentTimeMillis() - databaseFile.lastModified() > geoipInvalidate.toMillis()
}
doLast {
geoipOutput.mkdirs()
moduleFile.writeText(moduleContent)
sourceFile.writeText(sourceContent)
URL(geoipDatabaseUrl).openConnection().getInputStream().use { input ->
FileOutputStream(databaseFile).use { output ->
input.copyTo(output)
}
}
}
implementation(libs.androidx.core)
implementation(libs.kotlin.coroutine)
implementation(libs.kotlin.serialization.json)
}
afterEvaluate {
val downloadTask = tasks["downloadGeoipDatabase"]
tasks.forEach {
if (it.name.startsWith("externalGolangBuild")) {
it.dependsOn(downloadTask)
}
tasks.withType(GolangBuildTask::class.java).forEach {
it.inputs.dir(golangSource)
}
}

@ -0,0 +1 @@
Subproject commit 89dfabe9b36b22df896dcd1ab03c67c667ec20f3

120
core/src/foss/golang/go.mod Normal file
View file

@ -0,0 +1,120 @@
module foss
go 1.20
require cfa v0.0.0
require (
github.com/3andne/restls-client-go v0.1.6 // indirect
github.com/RyuaNerin/go-krypto v1.2.4 // indirect
github.com/Yawning/aez v0.0.0-20211027044916-e49e68abd344 // indirect
github.com/ajg/form v1.5.1 // indirect
github.com/andybalholm/brotli v1.0.6 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/coreos/go-iptables v0.8.0 // indirect
github.com/dlclark/regexp2 v1.11.4 // indirect
github.com/ebitengine/purego v0.8.1 // indirect
github.com/enfein/mieru/v3 v3.8.4 // indirect
github.com/ericlagergren/aegis v0.0.0-20230312195928-b4ce538b56f9 // indirect
github.com/ericlagergren/polyval v0.0.0-20220411101811-e25bc10ba391 // indirect
github.com/ericlagergren/siv v0.0.0-20220507050439-0b757b3aa5f1 // indirect
github.com/ericlagergren/subtle v0.0.0-20220507045147-890d697da010 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gaukas/godicttls v0.0.4 // indirect
github.com/go-chi/chi/v5 v5.1.0 // indirect
github.com/go-chi/render v1.0.3 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/gobwas/httphead v0.1.0 // indirect
github.com/gobwas/pool v0.2.1 // indirect
github.com/gobwas/ws v1.4.0 // indirect
github.com/gofrs/uuid/v5 v5.3.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
github.com/hashicorp/yamux v0.1.2 // indirect
github.com/insomniacslk/dhcp v0.0.0-20241203100832-a481575ed0ef // indirect
github.com/josharian/native v1.1.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mdlayher/netlink v1.7.2 // indirect
github.com/mdlayher/socket v0.4.1 // indirect
github.com/metacubex/amneziawg-go v0.0.0-20240922133038-fdf3a4d5a4ab // indirect
github.com/metacubex/bbolt v0.0.0-20240822011022-aed6d4850399 // indirect
github.com/metacubex/chacha v0.1.0 // indirect
github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759 // indirect
github.com/metacubex/gvisor v0.0.0-20241126021258-5b028898cc5a // indirect
github.com/metacubex/mihomo v1.7.0 // indirect
github.com/metacubex/quic-go v0.48.3-0.20241126053724-b69fea3888da // indirect
github.com/metacubex/randv2 v0.2.0 // indirect
github.com/metacubex/sing-quic v0.0.0-20240827003841-cd97758ed8b4 // indirect
github.com/metacubex/sing-shadowsocks v0.2.8 // indirect
github.com/metacubex/sing-shadowsocks2 v0.2.2 // indirect
github.com/metacubex/sing-tun v0.4.2 // indirect
github.com/metacubex/sing-vmess v0.1.9-0.20240719134745-1df6fb20bbf9 // indirect
github.com/metacubex/sing-wireguard v0.0.0-20241126021510-0827d417b589 // indirect
github.com/metacubex/tfo-go v0.0.0-20241006021335-daedaf0ca7aa // indirect
github.com/metacubex/utls v1.6.6 // indirect
github.com/metacubex/wireguard-go v0.0.0-20240922131502-c182e7471181 // indirect
github.com/miekg/dns v1.1.62 // indirect
github.com/mroth/weightedrand/v2 v2.1.0 // indirect
github.com/oasisprotocol/deoxysii v0.0.0-20220228165953-2091330c22b7 // indirect
github.com/onsi/ginkgo/v2 v2.9.5 // indirect
github.com/openacid/low v0.1.21 // indirect
github.com/oschwald/maxminddb-golang v1.12.0 // indirect
github.com/pierrec/lz4/v4 v4.1.14 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/puzpuzpuz/xsync/v3 v3.4.0 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/qtls-go1-20 v0.4.1 // indirect
github.com/sagernet/cors v1.2.1 // indirect
github.com/sagernet/fswatch v0.1.1 // indirect
github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a // indirect
github.com/sagernet/nftables v0.3.0-beta.4 // indirect
github.com/sagernet/sing v0.5.1 // indirect
github.com/sagernet/sing-mux v0.2.1 // indirect
github.com/sagernet/sing-shadowtls v0.1.5 // indirect
github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7 // indirect
github.com/samber/lo v1.47.0 // indirect
github.com/shirou/gopsutil/v4 v4.24.11 // indirect
github.com/sina-ghaderi/poly1305 v0.0.0-20220724002748-c5926b03988b // indirect
github.com/sina-ghaderi/rabaead v0.0.0-20220730151906-ab6e06b96e8c // indirect
github.com/sina-ghaderi/rabbitio v0.0.0-20220730151941-9ce26f4f872e // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/u-root/uio v0.0.0-20230220225925-ffce2a382923 // indirect
github.com/vishvananda/netns v0.0.4 // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
gitlab.com/go-extension/aes-ccm v0.0.0-20230221065045-e58665ef23c7 // indirect
gitlab.com/yawning/bsaes.git v0.0.0-20190805113838-0a714cd429ec // indirect
go.uber.org/mock v0.4.0 // indirect
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect
golang.org/x/mod v0.20.0 // indirect
golang.org/x/net v0.32.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.7.0 // indirect
golang.org/x/tools v0.24.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.3.0 // indirect
)
replace github.com/sagernet/sing => github.com/metacubex/sing v0.0.0-20241121030428-33b6ebc52000
replace cfa => ../../main/golang
replace github.com/metacubex/mihomo => ./clash

279
core/src/foss/golang/go.sum Normal file
View file

@ -0,0 +1,279 @@
github.com/3andne/restls-client-go v0.1.6 h1:tRx/YilqW7iHpgmEL4E1D8dAsuB0tFF3uvncS+B6I08=
github.com/3andne/restls-client-go v0.1.6/go.mod h1:iEdTZNt9kzPIxjIGSMScUFSBrUH6bFRNg0BWlP4orEY=
github.com/RyuaNerin/elliptic2 v1.0.0/go.mod h1:wWB8fWrJI/6EPJkyV/r1Rj0hxUgrusmqSj8JN6yNf/A=
github.com/RyuaNerin/go-krypto v1.2.4 h1:mXuNdK6M317aPV0llW6Xpjbo4moOlPF7Yxz4tb4b4Go=
github.com/RyuaNerin/go-krypto v1.2.4/go.mod h1:QqCYkoutU3yInyD9INt2PGolVRsc3W4oraQadVGXJ/8=
github.com/Yawning/aez v0.0.0-20211027044916-e49e68abd344 h1:cDVUiFo+npB0ZASqnw4q90ylaVAbnYyx0JYqK4YcGok=
github.com/Yawning/aez v0.0.0-20211027044916-e49e68abd344/go.mod h1:9pIqrY6SXNL8vjRQE5Hd/OL5GyK/9MrGUWs87z/eFfk=
github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU=
github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
github.com/andybalholm/brotli v1.0.6 h1:Yf9fFpf49Zrxb9NlQaluyE92/+X7UVHlhMNJN2sxfOI=
github.com/andybalholm/brotli v1.0.6/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU=
github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA=
github.com/coreos/go-iptables v0.8.0 h1:MPc2P89IhuVpLI7ETL/2tx3XZ61VeICZjYqDEgNsPRc=
github.com/coreos/go-iptables v0.8.0/go.mod h1:Qe8Bv2Xik5FyTXwgIbLAnv2sWSBmvWdFETJConOQ//Q=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo=
github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
github.com/ebitengine/purego v0.8.1 h1:sdRKd6plj7KYW33EH5As6YKfe8m9zbN9JMrOjNVF/BE=
github.com/ebitengine/purego v0.8.1/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
github.com/enfein/mieru/v3 v3.8.4 h1:PmBQykuEcl8yKcQ647pg8Qbjl433CRYgUbW6VLBgGn4=
github.com/enfein/mieru/v3 v3.8.4/go.mod h1:YtU00qjAEt54mCBQu4WZPCey6cBdB1BUtXjvrHLEUNQ=
github.com/ericlagergren/aegis v0.0.0-20230312195928-b4ce538b56f9 h1:/5RkVc9Rc81XmMyVqawCiDyrBHZbLAZgTTCqou4mwj8=
github.com/ericlagergren/aegis v0.0.0-20230312195928-b4ce538b56f9/go.mod h1:hkIFzoiIPZYxdFOOLyDho59b7SrDfo+w3h+yWdlg45I=
github.com/ericlagergren/polyval v0.0.0-20220411101811-e25bc10ba391 h1:8j2RH289RJplhA6WfdaPqzg1MjH2K8wX5e0uhAxrw2g=
github.com/ericlagergren/polyval v0.0.0-20220411101811-e25bc10ba391/go.mod h1:K2R7GhgxrlJzHw2qiPWsCZXf/kXEJN9PLnQK73Ll0po=
github.com/ericlagergren/saferand v0.0.0-20220206064634-960a4dd2bc5c h1:RUzBDdZ+e/HEe2Nh8lYsduiPAZygUfVXJn0Ncj5sHMg=
github.com/ericlagergren/siv v0.0.0-20220507050439-0b757b3aa5f1 h1:tlDMEdcPRQKBEz5nGDMvswiajqh7k8ogWRlhRwKy5mY=
github.com/ericlagergren/siv v0.0.0-20220507050439-0b757b3aa5f1/go.mod h1:4RfsapbGx2j/vU5xC/5/9qB3kn9Awp1YDiEnN43QrJ4=
github.com/ericlagergren/subtle v0.0.0-20220507045147-890d697da010 h1:fuGucgPk5dN6wzfnxl3D0D3rVLw4v2SbBT9jb4VnxzA=
github.com/ericlagergren/subtle v0.0.0-20220507045147-890d697da010/go.mod h1:JtBcj7sBuTTRupn7c2bFspMDIObMJsVK8TeUvpShPok=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/gaukas/godicttls v0.0.4 h1:NlRaXb3J6hAnTmWdsEKb9bcSBD6BvcIjdGdeb0zfXbk=
github.com/gaukas/godicttls v0.0.4/go.mod h1:l6EenT4TLWgTdwslVb4sEMOCf7Bv0JAK67deKr9/NCI=
github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw=
github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
github.com/go-chi/render v1.0.3 h1:AsXqd2a1/INaIfUSKq3G5uA8weYx20FOsM7uSoCyyt4=
github.com/go-chi/render v1.0.3/go.mod h1:/gr3hVkmYR0YlEy3LxCuVRFzEu9Ruok+gFqbIofjao0=
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
github.com/gobwas/httphead v0.1.0 h1:exrUm0f4YX0L7EBwZHuCF4GDp8aJfVeBrlLQrs6NqWU=
github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM=
github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og=
github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
github.com/gobwas/ws v1.4.0 h1:CTaoG1tojrh4ucGPcoJFiAQUAsEWekEWvLy7GsVNqGs=
github.com/gobwas/ws v1.4.0/go.mod h1:G3gNqMNtPppf5XUz7O4shetPpcZ1VJ7zt18dlUeakrc=
github.com/gofrs/uuid/v5 v5.3.0 h1:m0mUMr+oVYUdxpMLgSYCZiXe7PuVPnI94+OMeVBNedk=
github.com/gofrs/uuid/v5 v5.3.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg=
github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE=
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/tink/go v1.6.1 h1:t7JHqO8Ath2w2ig5vjwQYJzhGEZymedQc90lQXUBa4I=
github.com/hashicorp/yamux v0.1.2 h1:XtB8kyFOyHXYVFnwT5C3+Bdo8gArse7j2AQ0DA0Uey8=
github.com/hashicorp/yamux v0.1.2/go.mod h1:C+zze2n6e/7wshOZep2A70/aQU6QBRWJO/G6FT1wIns=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/insomniacslk/dhcp v0.0.0-20241203100832-a481575ed0ef h1:NzQKDfd5ZOPnuZYf9MnRee8x2qecsVqzsnaLjEZiBko=
github.com/insomniacslk/dhcp v0.0.0-20241203100832-a481575ed0ef/go.mod h1:KclMyHxX06VrVr0DJmeFSUb1ankt7xTfoOA35pCkoic=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/josharian/native v1.0.1-0.20221213033349-c1e37c09b531/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w=
github.com/josharian/native v1.1.0 h1:uuaP0hAbW7Y4l0ZRQ6C9zfb7Mg1mbFKry/xzDAfmtLA=
github.com/josharian/native v1.1.0/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w=
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/klauspost/cpuid/v2 v2.2.9 h1:66ze0taIn2H33fBvCkXuv9BmCwDfafmiIVpKV9kKGuY=
github.com/klauspost/cpuid/v2 v2.2.9/go.mod h1:rqkxqrZ1EhYM9G+hXH7YdowN5R5RGN6NK4QwQ3WMXF8=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40 h1:EnfXoSqDfSNJv0VBNqY/88RNnhSGYkrHaO0mmFGbVsc=
github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40/go.mod h1:vy1vK6wD6j7xX6O6hXe621WabdtNkou2h7uRtTfRMyg=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mdlayher/netlink v1.7.2 h1:/UtM3ofJap7Vl4QWCPDGXY8d3GIY2UGSDbK+QWmY8/g=
github.com/mdlayher/netlink v1.7.2/go.mod h1:xraEF7uJbxLhc5fpHL4cPe221LI2bdttWlU+ZGLfQSw=
github.com/mdlayher/socket v0.4.1 h1:eM9y2/jlbs1M615oshPQOHZzj6R6wMT7bX5NPiQvn2U=
github.com/mdlayher/socket v0.4.1/go.mod h1:cAqeGjoufqdxWkD7DkpyS+wcefOtmu5OQ8KuoJGIReA=
github.com/metacubex/amneziawg-go v0.0.0-20240922133038-fdf3a4d5a4ab h1:Chbw+/31UC14YFNr78pESt5Vowlc62zziw05JCUqoL4=
github.com/metacubex/amneziawg-go v0.0.0-20240922133038-fdf3a4d5a4ab/go.mod h1:xVKK8jC5Sd3hfh7WjmCq+HorehIbrBijaUWmcuKjPcI=
github.com/metacubex/bbolt v0.0.0-20240822011022-aed6d4850399 h1:oBowHVKZycNtAFbZ6avaCSZJYeme2Nrj+4RpV2cNJig=
github.com/metacubex/bbolt v0.0.0-20240822011022-aed6d4850399/go.mod h1:4xcieuIK+M4bGQmQYZVqEaIYqjS1ahO4kXG7EmDgEro=
github.com/metacubex/chacha v0.1.0 h1:tg9RSJ18NvL38cCWNyYH1eiG6qDCyyXIaTLQthon0sc=
github.com/metacubex/chacha v0.1.0/go.mod h1:Djn9bPZxLTXbJFSeyo0/qzEzQI+gUSSzttuzZM75GH8=
github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759 h1:cjd4biTvOzK9ubNCCkQ+ldc4YSH/rILn53l/xGBFHHI=
github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759/go.mod h1:UHOv2xu+RIgLwpXca7TLrXleEd4oR3sPatW6IF8wU88=
github.com/metacubex/gvisor v0.0.0-20241126021258-5b028898cc5a h1:cZ6oNVrsmsi3SNlnSnRio4zOgtQq+/XidwsaNgKICcg=
github.com/metacubex/gvisor v0.0.0-20241126021258-5b028898cc5a/go.mod h1:xBw/SYJPgUMPQ1tklV/brGn2nxhfr3BnvBzNlyi4Nic=
github.com/metacubex/quic-go v0.48.3-0.20241126053724-b69fea3888da h1:Mq6cbHbPTLLTUfA9scrwBmOGkvl6y99E3WmtMIMqo30=
github.com/metacubex/quic-go v0.48.3-0.20241126053724-b69fea3888da/go.mod h1:AiZ+UPgrkO1DTnmiAX4b+kRoV1Vfc65UkYD7RbFlIZA=
github.com/metacubex/randv2 v0.2.0 h1:uP38uBvV2SxYfLj53kuvAjbND4RUDfFJjwr4UigMiLs=
github.com/metacubex/randv2 v0.2.0/go.mod h1:kFi2SzrQ5WuneuoLLCMkABtiBu6VRrMrWFqSPyj2cxY=
github.com/metacubex/sing v0.0.0-20241121030428-33b6ebc52000 h1:gUbMXcQXhXGj0vCpCVFTUyIH7TMpD1dpTcNv/MCS+ok=
github.com/metacubex/sing v0.0.0-20241121030428-33b6ebc52000/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
github.com/metacubex/sing-quic v0.0.0-20240827003841-cd97758ed8b4 h1:HobpULaPK6OoxrHMmgcwLkwwIduXVmwdcznwUfH1GQM=
github.com/metacubex/sing-quic v0.0.0-20240827003841-cd97758ed8b4/go.mod h1:g7Mxj7b7zm7YVqD975mk/hSmrb0A0G4bVvIMr2MMzn8=
github.com/metacubex/sing-shadowsocks v0.2.8 h1:wIhlaigswzjPw4hej75sEvWte3QR0+AJRafgwBHO5B4=
github.com/metacubex/sing-shadowsocks v0.2.8/go.mod h1:X3x88XtJpBxG0W0/ECOJL6Ib0SJ3xdniAkU/6/RMWU0=
github.com/metacubex/sing-shadowsocks2 v0.2.2 h1:eaf42uVx4Lr21S6MDYs0ZdTvGA0GEhDpb9no4+gdXPo=
github.com/metacubex/sing-shadowsocks2 v0.2.2/go.mod h1:BhOug03a/RbI7y6hp6q+6ITM1dXjnLTmeWBHSTwvv2Q=
github.com/metacubex/sing-tun v0.4.2 h1:fwrQp3P536Pswu6gR1FJ+8GH55e+t2+B8LHIjwRtWbc=
github.com/metacubex/sing-tun v0.4.2/go.mod h1:V0N4rr0dWPBEE20ESkTXdbtx2riQYcb6YtwC5w/9wl0=
github.com/metacubex/sing-vmess v0.1.9-0.20240719134745-1df6fb20bbf9 h1:OAXiCosqY8xKDp3pqTW3qbrCprZ1l6WkrXSFSCwyY4I=
github.com/metacubex/sing-vmess v0.1.9-0.20240719134745-1df6fb20bbf9/go.mod h1:olVkD4FChQ5gKMHG4ZzuD7+fMkJY1G8vwOKpRehjrmY=
github.com/metacubex/sing-wireguard v0.0.0-20241126021510-0827d417b589 h1:Z6bNy0HLTjx6BKIkV48sV/yia/GP8Bnyb5JQuGgSGzg=
github.com/metacubex/sing-wireguard v0.0.0-20241126021510-0827d417b589/go.mod h1:4NclTLIZuk+QkHVCGrP87rHi/y8YjgPytxTgApJNMhc=
github.com/metacubex/tfo-go v0.0.0-20241006021335-daedaf0ca7aa h1:9mcjV+RGZVC3reJBNDjjNPyS8PmFG97zq56X7WNaFO4=
github.com/metacubex/tfo-go v0.0.0-20241006021335-daedaf0ca7aa/go.mod h1:4tLB5c8U0CxpkFM+AJJB77jEaVDbLH5XQvy42vAGsWw=
github.com/metacubex/utls v1.6.6 h1:3D12YKHTf2Z41UPhQU2dWerNWJ5TVQD9gKoQ+H+iLC8=
github.com/metacubex/utls v1.6.6/go.mod h1:+WLFUnXjcpdxXCnyX25nggw8C6YonZ8zOK2Zm/oRvdo=
github.com/metacubex/wireguard-go v0.0.0-20240922131502-c182e7471181 h1:hJLQviGySBuaynlCwf/oYgIxbVbGRUIKZCxdya9YrbQ=
github.com/metacubex/wireguard-go v0.0.0-20240922131502-c182e7471181/go.mod h1:phewKljNYiTVT31Gcif8RiCKnTUOgVWFJjccqYM8s+Y=
github.com/miekg/dns v1.1.62 h1:cN8OuEF1/x5Rq6Np+h1epln8OiyPWV+lROx9LxcGgIQ=
github.com/miekg/dns v1.1.62/go.mod h1:mvDlcItzm+br7MToIKqkglaGhlFMHJ9DTNNWONWXbNQ=
github.com/mroth/weightedrand/v2 v2.1.0 h1:o1ascnB1CIVzsqlfArQQjeMy1U0NcIbBO5rfd5E/OeU=
github.com/mroth/weightedrand/v2 v2.1.0/go.mod h1:f2faGsfOGOwc1p94wzHKKZyTpcJUW7OJ/9U4yfiNAOU=
github.com/oasisprotocol/deoxysii v0.0.0-20220228165953-2091330c22b7 h1:1102pQc2SEPp5+xrS26wEaeb26sZy6k9/ZXlZN+eXE4=
github.com/oasisprotocol/deoxysii v0.0.0-20220228165953-2091330c22b7/go.mod h1:UqoUn6cHESlliMhOnKLWr+CBH+e3bazUPvFj1XZwAjs=
github.com/onsi/ginkgo/v2 v2.9.5 h1:+6Hr4uxzP4XIUyAkg61dWBw8lb/gc4/X5luuxN/EC+Q=
github.com/onsi/ginkgo/v2 v2.9.5/go.mod h1:tvAoo1QUJwNEU2ITftXTpR7R1RbCzoZUOs3RonqW57k=
github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE=
github.com/openacid/errors v0.8.1/go.mod h1:GUQEJJOJE3W9skHm8E8Y4phdl2LLEN8iD7c5gcGgdx0=
github.com/openacid/low v0.1.21 h1:Tr2GNu4N/+rGRYdOsEHOE89cxUIaDViZbVmKz29uKGo=
github.com/openacid/low v0.1.21/go.mod h1:q+MsKI6Pz2xsCkzV4BLj7NR5M4EX0sGz5AqotpZDVh0=
github.com/openacid/must v0.1.3/go.mod h1:luPiXCuJlEo3UUFQngVQokV0MPGryeYvtCbQPs3U1+I=
github.com/openacid/testkeys v0.1.6/go.mod h1:MfA7cACzBpbiwekivj8StqX0WIRmqlMsci1c37CA3Do=
github.com/oschwald/maxminddb-golang v1.12.0 h1:9FnTOD0YOhP7DGxGsq4glzpGy5+w7pq50AS6wALUMYs=
github.com/oschwald/maxminddb-golang v1.12.0/go.mod h1:q0Nob5lTCqyQ8WT6FYgS1L7PXKVVbgiymefNwIjPzgY=
github.com/pierrec/lz4/v4 v4.1.14 h1:+fL8AQEZtz/ijeNnpduH0bROTu0O3NZAlPjQxGn8LwE=
github.com/pierrec/lz4/v4 v4.1.14/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw=
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/puzpuzpuz/xsync/v3 v3.4.0 h1:DuVBAdXuGFHv8adVXjWWZ63pJq+NRXOWVXlKDBZ+mJ4=
github.com/puzpuzpuz/xsync/v3 v3.4.0/go.mod h1:VjzYrABPabuM4KyBh1Ftq6u8nhwY5tBPKP9jpmh0nnA=
github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo=
github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A=
github.com/quic-go/qtls-go1-20 v0.4.1 h1:D33340mCNDAIKBqXuAvexTNMUByrYmFYVfKfDN5nfFs=
github.com/quic-go/qtls-go1-20 v0.4.1/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k=
github.com/sagernet/cors v1.2.1 h1:Cv5Z8y9YSD6Gm+qSpNrL3LO4lD3eQVvbFYJSG7JCMHQ=
github.com/sagernet/cors v1.2.1/go.mod h1:O64VyOjjhrkLmQIjF4KGRrJO/5dVXFdpEmCW/eISRAI=
github.com/sagernet/fswatch v0.1.1 h1:YqID+93B7VRfqIH3PArW/XpJv5H4OLEVWDfProGoRQs=
github.com/sagernet/fswatch v0.1.1/go.mod h1:nz85laH0mkQqJfaOrqPpkwtU1znMFNVTpT/5oRsVz/o=
github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a h1:ObwtHN2VpqE0ZNjr6sGeT00J8uU7JF4cNUdb44/Duis=
github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a/go.mod h1:xLnfdiJbSp8rNqYEdIW/6eDO4mVoogml14Bh2hSiFpM=
github.com/sagernet/nftables v0.3.0-beta.4 h1:kbULlAwAC3jvdGAC1P5Fa3GSxVwQJibNenDW2zaXr8I=
github.com/sagernet/nftables v0.3.0-beta.4/go.mod h1:OQXAjvjNGGFxaTgVCSTRIhYB5/llyVDeapVoENYBDS8=
github.com/sagernet/sing-mux v0.2.1 h1:N/3MHymfnFZRd29tE3TaXwPUVVgKvxhtOkiCMLp9HVo=
github.com/sagernet/sing-mux v0.2.1/go.mod h1:dm3BWL6NvES9pbib7llpylrq7Gq+LjlzG+0RacdxcyE=
github.com/sagernet/sing-shadowtls v0.1.5 h1:uXxmq/HXh8DIiBGLzpMjCbWnzIAFs+lIxiTOjdgG5qo=
github.com/sagernet/sing-shadowtls v0.1.5/go.mod h1:tvrDPTGLrSM46Wnf7mSr+L8NHvgvF8M4YnJF790rZX4=
github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7 h1:DImB4lELfQhplLTxeq2z31Fpv8CQqqrUwTbrIRumZqQ=
github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7/go.mod h1:FP9X2xjT/Az1EsG/orYYoC+5MojWnuI7hrffz8fGwwo=
github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc=
github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU=
github.com/shirou/gopsutil/v4 v4.24.11 h1:WaU9xqGFKvFfsUv94SXcUPD7rCkU0vr/asVdQOBZNj8=
github.com/shirou/gopsutil/v4 v4.24.11/go.mod h1:s4D/wg+ag4rG0WO7AiTj2BeYCRhym0vM7DHbZRxnIT8=
github.com/sina-ghaderi/poly1305 v0.0.0-20220724002748-c5926b03988b h1:rXHg9GrUEtWZhEkrykicdND3VPjlVbYiLdX9J7gimS8=
github.com/sina-ghaderi/poly1305 v0.0.0-20220724002748-c5926b03988b/go.mod h1:X7qrxNQViEaAN9LNZOPl9PfvQtp3V3c7LTo0dvGi0fM=
github.com/sina-ghaderi/rabaead v0.0.0-20220730151906-ab6e06b96e8c h1:DjKMC30y6yjG3IxDaeAj3PCoRr+IsO+bzyT+Se2m2Hk=
github.com/sina-ghaderi/rabaead v0.0.0-20220730151906-ab6e06b96e8c/go.mod h1:NV/a66PhhWYVmUMaotlXJ8fIEFB98u+c8l/CQIEFLrU=
github.com/sina-ghaderi/rabbitio v0.0.0-20220730151941-9ce26f4f872e h1:ur8uMsPIFG3i4Gi093BQITvwH9znsz2VUZmnmwHvpIo=
github.com/sina-ghaderi/rabbitio v0.0.0-20220730151941-9ce26f4f872e/go.mod h1:+e5fBW3bpPyo+3uLo513gIUblc03egGjMM0+5GKbzK8=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
github.com/u-root/uio v0.0.0-20230220225925-ffce2a382923 h1:tHNk7XK9GkmKUR6Gh8gVBKXc2MVSZ4G/NnWLtzw4gNA=
github.com/u-root/uio v0.0.0-20230220225925-ffce2a382923/go.mod h1:eLL9Nub3yfAho7qB0MzZizFhTU2QkLeoVsWdHtDW264=
github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE=
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU=
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
github.com/vishvananda/netns v0.0.4 h1:Oeaw1EM2JMxD51g9uhtC0D7erkIjgmj8+JZc26m1YX8=
github.com/vishvananda/netns v0.0.4/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8=
github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
gitlab.com/go-extension/aes-ccm v0.0.0-20230221065045-e58665ef23c7 h1:UNrDfkQqiEYzdMlNsVvBYOAJWZjdktqFE9tQh5BT2+4=
gitlab.com/go-extension/aes-ccm v0.0.0-20230221065045-e58665ef23c7/go.mod h1:E+rxHvJG9H6PUdzq9NRG6csuLN3XUx98BfGOVWNYnXs=
gitlab.com/yawning/bsaes.git v0.0.0-20190805113838-0a714cd429ec h1:FpfFs4EhNehiVfzQttTuxanPIT43FtkkCFypIod8LHo=
gitlab.com/yawning/bsaes.git v0.0.0-20190805113838-0a714cd429ec/go.mod h1:BZ1RAoRPbCxum9Grlv5aeksu2H8BiKehBYooU2LFiOQ=
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBseWJUpBw5I82+2U4M=
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e h1:I88y4caeGeuDQxgdoFPUq097j7kNfw6uvuiNxUBfcBk=
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI=
golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ=
golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
lukechampine.com/blake3 v1.3.0 h1:sJ3XhFINmHSrYCgl958hscfIa3bw8x4DqMP3u1YvoYE=
lukechampine.com/blake3 v1.3.0/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k=

View file

@ -0,0 +1,5 @@
package golang
import (
_ "cfa/native/all"
)

View file

@ -1,7 +1,53 @@
cmake_minimum_required(VERSION 3.0)
# 获取git hash
message(STATUS "CMAKE_CURRENT_SOURCE_DIR= ${CMAKE_CURRENT_SOURCE_DIR}")
execute_process(
COMMAND git submodule foreach git log -1 --format=%H
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE COMMIT_HASH
)
string(REPLACE "\n" ";" COMMIT_HASH "${COMMIT_HASH}")
list(GET COMMIT_HASH 1 COMMIT_HASH)
string (REGEX REPLACE "[\n\t\r]" "" COMMIT_HASH ${COMMIT_HASH})
string(SUBSTRING ${COMMIT_HASH} 0 7 COMMIT_HASH)
message(STATUS "git hash= ${COMMIT_HASH}")
# 获取分支名称
execute_process(
COMMAND git submodule foreach git branch -r --contains ${COMMIT_HASH}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE CURRENT_BRANCH
)
string(REPLACE "\n" ";" CURRENT_BRANCH "${CURRENT_BRANCH}")
list(GET CURRENT_BRANCH 1 CURRENT_BRANCH)
string (REGEX REPLACE "origin/" "" CURRENT_BRANCH ${CURRENT_BRANCH})
string (REGEX REPLACE "[\n\t\r]" "" CURRENT_BRANCH ${CURRENT_BRANCH})
#string(SUBSTRING ${CURRENT_BRANCH} 0 8 CURRENT_BRANCH)
message(STATUS "git current branch = ${CURRENT_BRANCH}")
# 获取生成时间
string(TIMESTAMP COMPILE_TIME "%y%m%d")
string (REGEX REPLACE "[\n\t\r]" "" COMPILE_TIME ${COMPILE_TIME})
string(REGEX REPLACE "\"" "" COMPILE_TIME ${COMPILE_TIME})
# 生成版本信息
set(GIT_VERSION "${CURRENT_BRANCH}_${COMMIT_HASH}_${COMPILE_TIME}")
message(STATUS "version info = ${GIT_VERSION}")
# 去除空格
string(REGEX REPLACE "[ ]+" "" GIT_VERSION "${GIT_VERSION}")
# 保存变量到文件
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_SOURCE_DIR}/version.h @ONLY)
project(clash-bridge C)
set(CMAKE_POSITION_INDEPENDENT_CODE on)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3")
set(GO_OUTPUT_BASE ${GO_OUTPUT}/${FLAVOR_NAME})
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
@ -20,4 +66,4 @@ include_directories("${GO_SOURCE}")
link_directories("${GO_OUTPUT_BASE}/${CMAKE_ANDROID_ARCH_ABI}")
add_library(bridge SHARED main.c jni_helper.c bridge_helper.c)
target_link_libraries(bridge log clash)
target_link_libraries(bridge log clash)

View file

@ -54,20 +54,27 @@ int jni_catch_exception(JNIEnv *env) {
return result;
}
void jni_attach_thread(JNIEnv **penv) {
void jni_attach_thread(struct _scoped_jni *jni) {
JavaVM *vm = global_java_vm();
if ((*vm)->AttachCurrentThread(vm, penv, NULL) != JNI_OK) {
if ((*vm)->GetEnv(vm, (void **) &jni->env, JNI_VERSION_1_6) == JNI_OK) {
jni->require_release = 0;
return;
}
if ((*vm)->AttachCurrentThread(vm, &jni->env, NULL) != JNI_OK) {
abort();
}
jni->require_release = 1;
}
void jni_detach_thread(JNIEnv **env) {
(void) env;
void jni_detach_thread(struct _scoped_jni *jni) {
JavaVM *vm = global_java_vm();
(*vm)->DetachCurrentThread(vm);
if (jni->require_release) {
(*vm)->DetachCurrentThread(vm);
}
}
void release_string(char **str) {

View file

@ -6,21 +6,23 @@
#include <malloc.h>
#include <android/log.h>
struct _scoped_jni {
JNIEnv *env;
int require_release;
};
extern void initialize_jni(JavaVM *vm, JNIEnv *env);
extern jstring jni_new_string(JNIEnv *env, const char *str);
extern char *jni_get_string(JNIEnv *env, jstring str);
extern int jni_catch_exception(JNIEnv *env);
extern void jni_attach_thread(JNIEnv **penv);
extern void jni_detach_thread(JNIEnv **env);
extern void jni_attach_thread(struct _scoped_jni *jni);
extern void jni_detach_thread(struct _scoped_jni *env);
extern void release_string(char **str);
#define ATTACH_JNI() __attribute__((unused, cleanup(jni_detach_thread))) JNIEnv *env = NULL; jni_attach_thread(&env)
#define ATTACH_JNI() __attribute__((unused, cleanup(jni_detach_thread))) \
struct _scoped_jni _jni; \
jni_attach_thread(&_jni); \
JNIEnv *env = _jni.env
#define scoped_string __attribute__((cleanup(release_string))) char*

View file

@ -8,6 +8,9 @@
#include "jni_helper.h"
#include "trace.h"
#include "version.h" // 添加当前编译core版本号变量
JNIEXPORT void JNICALL
Java_com_github_kr328_clash_core_bridge_Bridge_nativeInit(JNIEnv *env, jobject thiz,
jstring home,
@ -16,8 +19,9 @@ Java_com_github_kr328_clash_core_bridge_Bridge_nativeInit(JNIEnv *env, jobject t
scoped_string _home = get_string(home);
scoped_string _version_name = get_string(version_name);
char* _git_version = make_String(GIT_VERSION);
coreInit(_home, _version_name, sdk_version);
coreInit(_home, _version_name, _git_version, sdk_version);
}
JNIEXPORT void JNICALL
@ -84,6 +88,16 @@ Java_com_github_kr328_clash_core_bridge_Bridge_nativeNotifyDnsChanged(JNIEnv *en
notifyDnsChanged(_dns_list);
}
JNIEXPORT void JNICALL
Java_com_github_kr328_clash_core_bridge_Bridge_nativeNotifyTimeZoneChanged(JNIEnv *env, jobject thiz,
jstring name, jint offset) {
TRACE_METHOD();
scoped_string _name = get_string(name);
notifyTimeZoneChanged(_name, offset);
}
JNIEXPORT void JNICALL
Java_com_github_kr328_clash_core_bridge_Bridge_nativeNotifyInstalledAppChanged(JNIEnv *env,
jobject thiz,
@ -96,18 +110,22 @@ Java_com_github_kr328_clash_core_bridge_Bridge_nativeNotifyInstalledAppChanged(J
}
JNIEXPORT void JNICALL
Java_com_github_kr328_clash_core_bridge_Bridge_nativeStartTun(JNIEnv *env, jobject thiz, jint fd,
jint mtu, jstring gateway,
jstring mirror, jstring dns,
Java_com_github_kr328_clash_core_bridge_Bridge_nativeStartTun(JNIEnv *env, jobject thiz,
jint fd,
jstring stack,
jstring gateway,
jstring portal,
jstring dns,
jobject cb) {
TRACE_METHOD();
scoped_string _stack = get_string(stack);
scoped_string _gateway = get_string(gateway);
scoped_string _mirror = get_string(mirror);
scoped_string _portal = get_string(portal);
scoped_string _dns = get_string(dns);
jobject _interface = new_global(cb);
startTun(fd, mtu, _gateway, _mirror, _dns, _interface);
startTun(fd, _stack, _gateway, _portal, _dns, _interface);
}
JNIEXPORT void JNICALL
@ -272,33 +290,6 @@ Java_com_github_kr328_clash_core_bridge_Bridge_nativeClearOverride(JNIEnv *env,
clearOverride(slot);
}
JNIEXPORT void JNICALL
Java_com_github_kr328_clash_core_bridge_Bridge_nativeInstallSideloadGeoip(JNIEnv *env, jobject thiz,
jbyteArray data) {
TRACE_METHOD();
if (data == NULL) {
installSideloadGeoip(NULL, 0);
return;
}
jbyte *bytes = (*env)->GetByteArrayElements(env, data, NULL);
int size = (*env)->GetArrayLength(env, data);
scoped_string err = installSideloadGeoip(bytes, size);
(*env)->ReleaseByteArrayElements(env, data, bytes, JNI_ABORT);
if (err != NULL) {
(*env)->ThrowNew(
env,
find_class("com/github/kr328/clash/core/bridge/ClashException"),
err
);
}
}
JNIEXPORT jstring JNICALL
Java_com_github_kr328_clash_core_bridge_Bridge_nativeQueryConfiguration(JNIEnv *env, jobject thiz) {
TRACE_METHOD();
@ -318,6 +309,7 @@ Java_com_github_kr328_clash_core_bridge_Bridge_nativeSubscribeLogcat(JNIEnv *env
subscribeLogcat(_callback);
}
static jmethodID m_tun_interface_mark_socket;
static jmethodID m_tun_interface_query_socket_uid;
static jmethodID m_completable_complete;
@ -525,4 +517,13 @@ JNI_OnLoad(JavaVM *vm, void *reserved) {
release_object_func = &release_jni_object_impl;
return JNI_VERSION_1_6;
}
JNIEXPORT jstring JNICALL
Java_com_github_kr328_clash_core_bridge_Bridge_nativeCoreVersion(JNIEnv *env, jobject thiz) {
TRACE_METHOD();
char* Version = make_String(GIT_VERSION);
return new_string(Version);
}

View file

@ -0,0 +1,12 @@
#ifndef VERSION_H_IN
#define VERSION_H_IN
/**
* core版本号
*/
#define GIT_VERSION @GIT_VERSION@
#define make_Str(x) #x
#define make_String(x) make_Str(x)
#endif

View file

@ -5,7 +5,6 @@
<option name="MOVE_ALL_IMPORTS_IN_ONE_DECLARATION" value="true" />
<option name="MOVE_ALL_STDLIB_IMPORTS_IN_ONE_GROUP" value="true" />
<option name="GROUP_STDLIB_IMPORTS" value="true" />
<option name="GROUP_CURRENT_PROJECT_IMPORTS" value="true" />
</GoCodeStyleSettings>
</code_scheme>
</component>

View file

@ -1,15 +0,0 @@
package app
import "strings"
var systemDns []string
func NotifyDnsChanged(dnsList string) {
dns := strings.Split(dnsList, ",")
systemDns = dns
}
func SystemDns() []string {
return systemDns
}

@ -1 +0,0 @@
Subproject commit ab13a0d119700ce2cc80bf3a07f0989f418021fd

View file

@ -1,27 +0,0 @@
package config
var (
defaultNameServers = []string{
"223.5.5.5",
"119.29.29.29",
"8.8.8.8",
"1.1.1.1",
}
defaultFakeIPFilter = []string{
// stun services
"+.stun.*.*",
"+.stun.*.*.*",
"+.stun.*.*.*.*",
// Google Voices
"lens.l.google.com",
"stun.l.google.com",
// Nintendo Switch
"*.n.n.srv.nintendo.net",
}
localNetwork = []string{
"0.0.0.0/32",
"127.0.0.0/8",
}
)

View file

@ -1,108 +0,0 @@
package config
import (
"encoding/json"
"errors"
"fmt"
"strings"
"github.com/Dreamacro/clash/log"
"github.com/dlclark/regexp2"
"cfa/app"
"cfa/common"
"github.com/Dreamacro/clash/config"
"github.com/Dreamacro/clash/dns"
)
var processors = []processor{
patchOverride,
patchGeneral,
patchProfile,
patchDns,
patchProviders,
validConfig,
}
type processor func(cfg *config.RawConfig, profileDir string) error
func patchOverride(cfg *config.RawConfig, _ string) error {
if err := json.NewDecoder(strings.NewReader(ReadOverride(OverrideSlotPersist))).Decode(cfg); err != nil {
log.Warnln("Apply persist override: %s", err.Error())
}
if err := json.NewDecoder(strings.NewReader(ReadOverride(OverrideSlotSession))).Decode(cfg); err != nil {
log.Warnln("Apply session override: %s", err.Error())
}
return nil
}
func patchGeneral(cfg *config.RawConfig, _ string) error {
cfg.Interface = ""
cfg.ExternalUI = ""
cfg.ExternalController = ""
return nil
}
func patchProfile(cfg *config.RawConfig, _ string) error {
cfg.Profile.StoreSelected = false
return nil
}
func patchDns(cfg *config.RawConfig, _ string) error {
if !cfg.DNS.Enable {
cfg.DNS.Enable = true
cfg.DNS.IPv6 = false
cfg.DNS.NameServer = defaultNameServers
cfg.DNS.Fallback = []string{}
cfg.DNS.FallbackFilter.GeoIP = false
cfg.DNS.FallbackFilter.IPCIDR = localNetwork
cfg.DNS.EnhancedMode = dns.FAKEIP
cfg.DNS.FakeIPRange = "198.18.0.0/16"
cfg.DNS.DefaultNameserver = defaultNameServers
cfg.DNS.FakeIPFilter = defaultFakeIPFilter
cfg.ClashForAndroid.AppendSystemDNS = true
}
if cfg.ClashForAndroid.AppendSystemDNS {
cfg.DNS.NameServer = append(cfg.DNS.NameServer, app.SystemDns()...)
}
return nil
}
func patchProviders(cfg *config.RawConfig, profileDir string) error {
forEachProviders(cfg, func(index int, total int, key string, provider map[string]interface{}) {
if path, ok := provider["path"].(string); ok {
provider["path"] = profileDir + "/providers/" + common.ResolveAsRoot(path)
}
})
return nil
}
func validConfig(cfg *config.RawConfig, _ string) error {
if len(cfg.Proxy) == 0 && len(cfg.ProxyProvider) == 0 {
return errors.New("profile does not contain `proxies` or `proxy-providers`")
}
if _, err := regexp2.Compile(cfg.ClashForAndroid.UiSubtitlePattern, 0); err != nil {
return fmt.Errorf("compile ui-subtitle-pattern: %s", err.Error())
}
return nil
}
func process(cfg *config.RawConfig, profileDir string) error {
for _, p := range processors {
if err := p(cfg, profileDir); err != nil {
return err
}
}
return nil
}

View file

@ -1,22 +0,0 @@
// +build !premium
package config
import "github.com/Dreamacro/clash/config"
func forEachProviders(rawCfg *config.RawConfig, fun func(index int, total int, key string, provider map[string]interface{})) {
total := len(rawCfg.ProxyProvider)
index := 0
for k, v := range rawCfg.ProxyProvider {
fun(index, total, k, v)
index++
}
}
func destroyProviders(cfg *config.Config) {
for _, p := range cfg.Providers {
_ = p.Destroy()
}
}

Some files were not shown because too many files have changed in this diff Show more