ha-frp-rn 1.0.16 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/android/build/.transforms/66c11c57a73a38f4bbb04b9b88dc5137/transformed/bundleLibRuntimeToDirRelease/bundleLibRuntimeToDirRelease_dex/io/github/acedroidx/frp/ShellService$Companion.dex +0 -0
  2. package/android/build/.transforms/66c11c57a73a38f4bbb04b9b88dc5137/transformed/bundleLibRuntimeToDirRelease/bundleLibRuntimeToDirRelease_dex/io/github/acedroidx/frp/ShellService.dex +0 -0
  3. package/android/build/.transforms/8976eb8239f11fc86931495268aa2e67/transformed/classes/classes_dex/classes.dex +0 -0
  4. package/android/build/intermediates/aar_main_jar/release/syncReleaseLibJars/classes.jar +0 -0
  5. package/android/build/intermediates/compile_library_classes_jar/release/bundleLibCompileToJarRelease/classes.jar +0 -0
  6. package/android/build/intermediates/full_jar/release/createFullJarRelease/full.jar +0 -0
  7. package/android/build/intermediates/incremental/release/mergeReleaseResources/compile-file-map.properties +1 -1
  8. package/android/build/intermediates/incremental/release/packageReleaseResources/compile-file-map.properties +1 -1
  9. package/android/build/intermediates/local_aar_for_lint/release/out.aar +0 -0
  10. package/android/build/intermediates/runtime_library_classes_dir/release/bundleLibRuntimeToDirRelease/io/github/acedroidx/frp/ShellService$Companion.class +0 -0
  11. package/android/build/intermediates/runtime_library_classes_dir/release/bundleLibRuntimeToDirRelease/io/github/acedroidx/frp/ShellService.class +0 -0
  12. package/android/build/intermediates/runtime_library_classes_jar/release/bundleLibRuntimeToJarRelease/classes.jar +0 -0
  13. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  14. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  15. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  16. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  17. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  18. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  19. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  20. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  21. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  22. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  23. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  24. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  25. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  26. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  27. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  28. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  29. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/counters.tab +1 -1
  30. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
  31. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  32. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
  33. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
  34. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  35. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
  36. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  37. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
  38. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  39. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  40. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  41. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
  42. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  43. package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  44. package/android/build/kotlin/compileReleaseKotlin/cacheable/last-build.bin +0 -0
  45. package/android/build/kotlin/compileReleaseKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
  46. package/android/build/kotlin/compileReleaseKotlin/local-state/build-history.bin +0 -0
  47. package/android/build/outputs/aar/ha-frp-rn-release.aar +0 -0
  48. package/android/build/outputs/logs/manifest-merger-release-report.txt +9 -9
  49. package/android/build/tmp/compileReleaseJavaWithJavac/previous-compilation-data.bin +0 -0
  50. package/android/build/tmp/kotlin-classes/release/io/github/acedroidx/frp/ShellService$Companion.class +0 -0
  51. package/android/build/tmp/kotlin-classes/release/io/github/acedroidx/frp/ShellService.class +0 -0
  52. package/{assets → android/src/main/assets}/frpc-visitor-default.toml +141 -141
  53. package/android/src/main/java/io/github/acedroidx/frp/ShellService.kt +277 -226
  54. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- #Wed Dec 24 14:56:04 CST 2025
1
+ #Tue Dec 30 14:08:53 CST 2025
2
2
  io.github.acedroidx.frp.ha-frp-rn-appcompat-1.7.0-10\:/drawable-xxxhdpi-v4/abc_text_select_handle_right_mtrl.png=D\:\\Project\\Page_Manager\\ha-mobile-rn\\node_modules\\ha-frp-rn\\android\\build\\intermediates\\merged_res\\release\\mergeReleaseResources\\drawable-xxxhdpi-v4\\abc_text_select_handle_right_mtrl.png
3
3
  io.github.acedroidx.frp.ha-frp-rn-appcompat-1.7.0-10\:/layout/abc_action_mode_bar.xml=D\:\\Project\\Page_Manager\\ha-mobile-rn\\node_modules\\ha-frp-rn\\android\\build\\intermediates\\merged_res\\release\\mergeReleaseResources\\layout\\abc_action_mode_bar.xml
4
4
  io.github.acedroidx.frp.ha-frp-rn-core-1.13.1-17\:/drawable-hdpi-v4/notification_bg_low_pressed.9.png=D\:\\Project\\Page_Manager\\ha-mobile-rn\\node_modules\\ha-frp-rn\\android\\build\\intermediates\\merged_res\\release\\mergeReleaseResources\\drawable-hdpi-v4\\notification_bg_low_pressed.9.png
@@ -1 +1 @@
1
- #Wed Dec 24 14:44:33 CST 2025
1
+ #Tue Dec 30 14:08:45 CST 2025
@@ -1,16 +1,16 @@
1
1
  -- Merging decision tree log ---
2
2
  manifest
3
- ADDED from D:\Project\Page_Manager\ha-mobile-rn\node_modules\ha-frp-rn\android\build\intermediates\tmp\ProcessLibraryManifest\release\tempAndroidManifest2194563455099757824.xml:2:13-83
4
- INJECTED from D:\Project\Page_Manager\ha-mobile-rn\node_modules\ha-frp-rn\android\build\intermediates\tmp\ProcessLibraryManifest\release\tempAndroidManifest2194563455099757824.xml:2:13-83
3
+ ADDED from D:\Project\Page_Manager\ha-mobile-rn\node_modules\ha-frp-rn\android\build\intermediates\tmp\ProcessLibraryManifest\release\tempAndroidManifest14099836558573805620.xml:2:13-83
4
+ INJECTED from D:\Project\Page_Manager\ha-mobile-rn\node_modules\ha-frp-rn\android\build\intermediates\tmp\ProcessLibraryManifest\release\tempAndroidManifest14099836558573805620.xml:2:13-83
5
5
  package
6
- INJECTED from D:\Project\Page_Manager\ha-mobile-rn\node_modules\ha-frp-rn\android\build\intermediates\tmp\ProcessLibraryManifest\release\tempAndroidManifest2194563455099757824.xml
6
+ INJECTED from D:\Project\Page_Manager\ha-mobile-rn\node_modules\ha-frp-rn\android\build\intermediates\tmp\ProcessLibraryManifest\release\tempAndroidManifest14099836558573805620.xml
7
7
  xmlns:android
8
- ADDED from D:\Project\Page_Manager\ha-mobile-rn\node_modules\ha-frp-rn\android\build\intermediates\tmp\ProcessLibraryManifest\release\tempAndroidManifest2194563455099757824.xml:2:23-81
8
+ ADDED from D:\Project\Page_Manager\ha-mobile-rn\node_modules\ha-frp-rn\android\build\intermediates\tmp\ProcessLibraryManifest\release\tempAndroidManifest14099836558573805620.xml:2:23-81
9
9
  uses-sdk
10
- INJECTED from D:\Project\Page_Manager\ha-mobile-rn\node_modules\ha-frp-rn\android\build\intermediates\tmp\ProcessLibraryManifest\release\tempAndroidManifest2194563455099757824.xml reason: use-sdk injection requested
11
- INJECTED from D:\Project\Page_Manager\ha-mobile-rn\node_modules\ha-frp-rn\android\build\intermediates\tmp\ProcessLibraryManifest\release\tempAndroidManifest2194563455099757824.xml
12
- INJECTED from D:\Project\Page_Manager\ha-mobile-rn\node_modules\ha-frp-rn\android\build\intermediates\tmp\ProcessLibraryManifest\release\tempAndroidManifest2194563455099757824.xml
10
+ INJECTED from D:\Project\Page_Manager\ha-mobile-rn\node_modules\ha-frp-rn\android\build\intermediates\tmp\ProcessLibraryManifest\release\tempAndroidManifest14099836558573805620.xml reason: use-sdk injection requested
11
+ INJECTED from D:\Project\Page_Manager\ha-mobile-rn\node_modules\ha-frp-rn\android\build\intermediates\tmp\ProcessLibraryManifest\release\tempAndroidManifest14099836558573805620.xml
12
+ INJECTED from D:\Project\Page_Manager\ha-mobile-rn\node_modules\ha-frp-rn\android\build\intermediates\tmp\ProcessLibraryManifest\release\tempAndroidManifest14099836558573805620.xml
13
13
  android:targetSdkVersion
14
- INJECTED from D:\Project\Page_Manager\ha-mobile-rn\node_modules\ha-frp-rn\android\build\intermediates\tmp\ProcessLibraryManifest\release\tempAndroidManifest2194563455099757824.xml
14
+ INJECTED from D:\Project\Page_Manager\ha-mobile-rn\node_modules\ha-frp-rn\android\build\intermediates\tmp\ProcessLibraryManifest\release\tempAndroidManifest14099836558573805620.xml
15
15
  android:minSdkVersion
16
- INJECTED from D:\Project\Page_Manager\ha-mobile-rn\node_modules\ha-frp-rn\android\build\intermediates\tmp\ProcessLibraryManifest\release\tempAndroidManifest2194563455099757824.xml
16
+ INJECTED from D:\Project\Page_Manager\ha-mobile-rn\node_modules\ha-frp-rn\android\build\intermediates\tmp\ProcessLibraryManifest\release\tempAndroidManifest14099836558573805620.xml
@@ -1,141 +1,141 @@
1
- # ===============================================
2
- # frpc visitor config for native clients (Android / Windows)
3
- #
4
- # ✏️ BEFORE USE:
5
- # 1. Replace all 'change_me_*' with real secretKey values
6
- # 2. Update FRP_SERVER_ADDR and auth.token if needed
7
- # 3. Save as 'frpc-visitor.toml' and load into your client
8
- #
9
- # This file is auto-generated from:
10
- # - .env (优先)
11
- # - .env.example
12
- # - visitors/builtin/*.toml
13
- # To update, run: ./scripts/render-full-config.py
14
- # ===============================================
15
-
16
- serverAddr = "103.236.89.242"
17
- serverPort = 7000
18
- auth.token = "2ab9901b45476e8dabaa12c8b556dd5b"
19
-
20
- [[visitors]]
21
- name = "aiws-stcp"
22
- type = "stcp"
23
- serverName = "gx10-a880-aiws-stcp"
24
- secretKey = "your_strong_secret_here_32_chars"
25
- bindPort = -1
26
-
27
-
28
- [[visitors]]
29
- name = "aiws-xtcp"
30
- type = "xtcp"
31
- serverName = "gx10-a880-aiws-xtcp"
32
- secretKey = "your_strong_secret_here_32_chars"
33
- bindAddr = "127.0.0.1"
34
- bindPort = 10006
35
- fallbackTo = "aiws-stcp"
36
- fallbackTimeoutMs = 200
37
-
38
-
39
- [[visitors]]
40
- name = "dialog-agent2-10197"
41
- type = "xtcp"
42
- serverName = "gx10-a880-dialog-agent2-10197-xtcp"
43
- secretKey = "your_strong_secret_here_32_chars"
44
- bindAddr = "127.0.0.1"
45
- bindPort = 10197
46
- fallbackTo = "dialog-agent2-10197-stcp"
47
- fallbackTimeoutMs = 300
48
-
49
- [[visitors]]
50
- name = "dialog-agent2-10197-stcp"
51
- type = "stcp"
52
- serverName = "gx10-a880-dialog-agent2-10197-stcp"
53
- secretKey = "your_strong_secret_here_32_chars"
54
- bindPort = -1
55
-
56
-
57
- [[visitors]]
58
- name = "frigate-stcp"
59
- type = "stcp"
60
- serverName = "gx10-a880-frigate-stcp"
61
- secretKey = "your_strong_secret_here_32_chars"
62
- bindPort = -1
63
-
64
-
65
- [[visitors]]
66
- name = "frigate-xtcp"
67
- type = "xtcp"
68
- serverName = "gx10-a880-frigate-xtcp"
69
- secretKey = "your_strong_secret_here_32_chars"
70
- bindAddr = "127.0.0.1"
71
- bindPort = 5000
72
- fallbackTo = "frigate-stcp"
73
- fallbackTimeoutMs = 500
74
-
75
-
76
- [[visitors]]
77
- name = "ha-stcp"
78
- type = "stcp"
79
- serverName = "gx10-a880-ha-stcp"
80
- secretKey = "your_strong_secret_here_32_chars"
81
- bindPort = -1
82
-
83
-
84
- [[visitors]]
85
- name = "ha-xtcp"
86
- type = "xtcp"
87
- serverName = "gx10-a880-ha-xtcp"
88
- secretKey = "your_strong_secret_here_32_chars"
89
- bindAddr = "127.0.0.1"
90
- bindPort = 8123
91
- fallbackTo = "ha-stcp"
92
- fallbackTimeoutMs = 500
93
-
94
-
95
- # xtcp visitor for TCP port 7880
96
- [[visitors]]
97
- name = "livekit-7880-xtcp"
98
- type = "xtcp"
99
- serverName = "gx10-a880-livekit-7880-xtcp"
100
- secretKey = "your_strong_secret_here_32_chars"
101
- bindAddr = "127.0.0.1"
102
- bindPort = 7880
103
- fallbackTo = "livekit-7880-stcp"
104
- fallbackTimeoutMs = 300
105
-
106
- # stcp visitor for TCP port 7880
107
- [[visitors]]
108
- name = "livekit-7880-stcp"
109
- type = "stcp"
110
- serverName = "gx10-a880-livekit-7880-stcp"
111
- secretKey = "your_strong_secret_here_32_chars"
112
- bindPort = -1
113
-
114
- # sudp visitor for UDP port 7883
115
- [[visitors]]
116
- name = "livekit-7883-sudp"
117
- type = "sudp"
118
- serverName = "gx10-a880-livekit-7883-sudp"
119
- secretKey = "your_strong_secret_here_32_chars"
120
- bindAddr = "127.0.0.1"
121
- bindPort = 7883
122
-
123
-
124
- [[visitors]]
125
- name = "ssh-stcp"
126
- type = "stcp"
127
- serverName = "gx10-a880-ssh-stcp"
128
- secretKey = "your_strong_secret_here_32_chars"
129
- bindPort = -1
130
-
131
-
132
- [[visitors]]
133
- name = "ssh-xtcp"
134
- type = "xtcp"
135
- serverName = "gx10-a880-ssh-xtcp"
136
- secretKey = "your_strong_secret_here_32_chars"
137
- bindAddr = "127.0.0.1"
138
- bindPort = 2222
139
- fallbackTo = "ssh-stcp"
140
- fallbackTimeoutMs = 500
141
-
1
+ # ===============================================
2
+ # frpc visitor config for native clients (Android / Windows)
3
+ #
4
+ # ✏️ BEFORE USE:
5
+ # 1. Replace all 'change_me_*' with real secretKey values
6
+ # 2. Update FRP_SERVER_ADDR and auth.token if needed
7
+ # 3. Save as 'frpc-visitor.toml' and load into your client
8
+ #
9
+ # This file is auto-generated from:
10
+ # - .env (优先)
11
+ # - .env.example
12
+ # - visitors/builtin/*.toml
13
+ # To update, run: ./scripts/render-full-config.py
14
+ # ===============================================
15
+
16
+ serverAddr = "103.236.89.242"
17
+ serverPort = 7000
18
+ auth.token = "2ab9901b45476e8dabaa12c8b556dd5b"
19
+
20
+ [[visitors]]
21
+ name = "aiws-stcp"
22
+ type = "stcp"
23
+ serverName = "gx10-a880-aiws-stcp"
24
+ secretKey = "your_strong_secret_here_32_chars"
25
+ bindPort = -1
26
+
27
+
28
+ [[visitors]]
29
+ name = "aiws-xtcp"
30
+ type = "xtcp"
31
+ serverName = "gx10-a880-aiws-xtcp"
32
+ secretKey = "your_strong_secret_here_32_chars"
33
+ bindAddr = "127.0.0.1"
34
+ bindPort = 10006
35
+ fallbackTo = "aiws-stcp"
36
+ fallbackTimeoutMs = 200
37
+
38
+
39
+ [[visitors]]
40
+ name = "dialog-agent2-10197"
41
+ type = "xtcp"
42
+ serverName = "gx10-a880-dialog-agent2-10197-xtcp"
43
+ secretKey = "your_strong_secret_here_32_chars"
44
+ bindAddr = "127.0.0.1"
45
+ bindPort = 10197
46
+ fallbackTo = "dialog-agent2-10197-stcp"
47
+ fallbackTimeoutMs = 300
48
+
49
+ [[visitors]]
50
+ name = "dialog-agent2-10197-stcp"
51
+ type = "stcp"
52
+ serverName = "gx10-a880-dialog-agent2-10197-stcp"
53
+ secretKey = "your_strong_secret_here_32_chars"
54
+ bindPort = -1
55
+
56
+
57
+ [[visitors]]
58
+ name = "frigate-stcp"
59
+ type = "stcp"
60
+ serverName = "gx10-a880-frigate-stcp"
61
+ secretKey = "your_strong_secret_here_32_chars"
62
+ bindPort = -1
63
+
64
+
65
+ [[visitors]]
66
+ name = "frigate-xtcp"
67
+ type = "xtcp"
68
+ serverName = "gx10-a880-frigate-xtcp"
69
+ secretKey = "your_strong_secret_here_32_chars"
70
+ bindAddr = "127.0.0.1"
71
+ bindPort = 5000
72
+ fallbackTo = "frigate-stcp"
73
+ fallbackTimeoutMs = 500
74
+
75
+
76
+ [[visitors]]
77
+ name = "ha-stcp"
78
+ type = "stcp"
79
+ serverName = "gx10-a880-ha-stcp"
80
+ secretKey = "your_strong_secret_here_32_chars"
81
+ bindPort = -1
82
+
83
+
84
+ [[visitors]]
85
+ name = "ha-xtcp"
86
+ type = "xtcp"
87
+ serverName = "gx10-a880-ha-xtcp"
88
+ secretKey = "your_strong_secret_here_32_chars"
89
+ bindAddr = "127.0.0.1"
90
+ bindPort = 8123
91
+ fallbackTo = "ha-stcp"
92
+ fallbackTimeoutMs = 500
93
+
94
+
95
+ # xtcp visitor for TCP port 7880
96
+ [[visitors]]
97
+ name = "livekit-7880-xtcp"
98
+ type = "xtcp"
99
+ serverName = "gx10-a880-livekit-7880-xtcp"
100
+ secretKey = "your_strong_secret_here_32_chars"
101
+ bindAddr = "127.0.0.1"
102
+ bindPort = 7880
103
+ fallbackTo = "livekit-7880-stcp"
104
+ fallbackTimeoutMs = 300
105
+
106
+ # stcp visitor for TCP port 7880
107
+ [[visitors]]
108
+ name = "livekit-7880-stcp"
109
+ type = "stcp"
110
+ serverName = "gx10-a880-livekit-7880-stcp"
111
+ secretKey = "your_strong_secret_here_32_chars"
112
+ bindPort = -1
113
+
114
+ # sudp visitor for UDP port 7883
115
+ [[visitors]]
116
+ name = "livekit-7883-sudp"
117
+ type = "sudp"
118
+ serverName = "gx10-a880-livekit-7883-sudp"
119
+ secretKey = "your_strong_secret_here_32_chars"
120
+ bindAddr = "127.0.0.1"
121
+ bindPort = 7883
122
+
123
+
124
+ [[visitors]]
125
+ name = "ssh-stcp"
126
+ type = "stcp"
127
+ serverName = "gx10-a880-ssh-stcp"
128
+ secretKey = "your_strong_secret_here_32_chars"
129
+ bindPort = -1
130
+
131
+
132
+ [[visitors]]
133
+ name = "ssh-xtcp"
134
+ type = "xtcp"
135
+ serverName = "gx10-a880-ssh-xtcp"
136
+ secretKey = "your_strong_secret_here_32_chars"
137
+ bindAddr = "127.0.0.1"
138
+ bindPort = 2222
139
+ fallbackTo = "ssh-stcp"
140
+ fallbackTimeoutMs = 500
141
+
@@ -1,226 +1,277 @@
1
- package io.github.acedroidx.frp
2
-
3
- import android.content.Context
4
- import android.util.Log
5
- import java.io.*
6
- import java.util.concurrent.Executors
7
- import java.util.concurrent.TimeUnit
8
-
9
- class ShellService(private val context: Context) {
10
-
11
- enum class Status {
12
- STOPPED,
13
- STARTING,
14
- RUNNING,
15
- STOPPING,
16
- ERROR
17
- }
18
-
19
- private var process: Process? = null
20
- private var status = Status.STOPPED
21
- private var lastMessage = ""
22
- private var executorService = Executors.newSingleThreadExecutor()
23
- private var onStatusChangeListener: ((Status, String) -> Unit)? = null
24
- private val TAG = "ShellService"
25
-
26
- fun setOnStatusChangeListener(listener: (Status, String) -> Unit) {
27
- this.onStatusChangeListener = listener
28
- }
29
-
30
- /**
31
- * 使用配置路径启动FRP访问者模式
32
- *
33
- * @param configPath - 配置文件路径
34
- */
35
- fun startVisitor(configPath: String) {
36
- startFrp("frpc", configPath)
37
- }
38
-
39
- /**
40
- * 使用配置路径启动FRP服务器模式
41
- *
42
- * @param configPath - 配置文件路径
43
- */
44
- fun startServer(configPath: String) {
45
- startFrp("frps", configPath)
46
- }
47
-
48
- /**
49
- * 使用FrpConfig对象启动FRP
50
- *
51
- * @param frpConfig - FRP配置对象
52
- */
53
- fun start(frpConfig: FrpConfig) {
54
- val binaryName = when (frpConfig.type) {
55
- FrpType.FRPC -> "frpc"
56
- FrpType.FRPS -> "frps"
57
- }
58
- val configPath = frpConfig.getFile(context).absolutePath
59
- startFrp(binaryName, configPath)
60
- }
61
-
62
- private fun startFrp(binaryName: String, configPath: String) {
63
- if (status == Status.RUNNING) {
64
- Log.w(TAG, "FRP is already running")
65
- return
66
- }
67
-
68
- setStatus(Status.STARTING, "Starting $binaryName...")
69
-
70
- executorService.submit {
71
- try {
72
- // 使用正确的工作目录
73
- val frpDir = File(context.cacheDir, "frp")
74
- if (!frpDir.exists()) {
75
- frpDir.mkdirs()
76
- }
77
-
78
- // 获取应用的nativeLibraryDir,找到真正的FRP二进制文件
79
- val packageManager = context.packageManager
80
- val applicationInfo = packageManager.getApplicationInfo(
81
- context.packageName,
82
- android.content.pm.PackageManager.GET_SHARED_LIBRARY_FILES
83
- )
84
-
85
- // 构建完整的FRP二进制文件路径
86
- val nativeLibraryDir = applicationInfo.nativeLibraryDir
87
- val libName = when (binaryName) {
88
- "frpc" -> "libfrpc.so"
89
- "frps" -> "libfrps.so"
90
- else -> {
91
- Log.e(TAG, "Unknown binary name: $binaryName")
92
- setStatus(Status.ERROR, "Unknown binary name: $binaryName")
93
- return@submit
94
- }
95
- }
96
-
97
- val binaryPath = File(nativeLibraryDir, libName)
98
- if (!binaryPath.exists()) {
99
- Log.e(TAG, "FRP binary not found: $binaryPath")
100
- setStatus(Status.ERROR, "FRP binary not found: $binaryPath")
101
- return@submit
102
- }
103
-
104
- // 确保二进制文件可执行
105
- binaryPath.setExecutable(true)
106
-
107
- // 构建命令
108
- val command = arrayOf(
109
- binaryPath.absolutePath, // 使用完整的二进制文件路径
110
- "-c",
111
- configPath
112
- )
113
-
114
- Log.i(TAG, "Executing: ${command.joinToString(" ")}")
115
- Log.i(TAG, "Working directory: ${frpDir.absolutePath}")
116
-
117
- // 执行命令
118
- val pb = ProcessBuilder(*command)
119
- .redirectErrorStream(true)
120
- .directory(frpDir)
121
-
122
- process = pb.start()
123
- setStatus(Status.RUNNING, "$binaryName started successfully")
124
- lastMessage = "$binaryName is running normally"
125
- onStatusChangeListener?.invoke(status, lastMessage)
126
-
127
- // 读取输出
128
- BufferedReader(InputStreamReader(process?.inputStream)).use { reader ->
129
- var line: String?
130
- while (reader.readLine().also { line = it } != null) {
131
- Log.d(TAG, "FRP output: $line")
132
- lastMessage = line ?: ""
133
- onStatusChangeListener?.invoke(status, lastMessage)
134
- }
135
- }
136
-
137
- // 监控进程
138
- monitorProcess()
139
-
140
- } catch (e: Exception) {
141
- Log.e(TAG, "Error running FRP: ${e.message}", e)
142
- setStatus(Status.ERROR, "Failed to start FRP: ${e.message}")
143
- }
144
- }
145
- }
146
-
147
- private fun monitorProcess() {
148
- executorService.submit {
149
- try {
150
- process?.waitFor()
151
- val exitCode = process?.exitValue() ?: -1
152
- setStatus(Status.STOPPED, "FRP stopped with exit code $exitCode")
153
- } catch (e: Exception) {
154
- Log.e(TAG, "Error monitoring FRP process: ${e.message}", e)
155
- setStatus(Status.ERROR, "Error monitoring FRP: ${e.message}")
156
- }
157
- }
158
- }
159
-
160
- fun stop() {
161
- if (status != Status.RUNNING && status != Status.STARTING) {
162
- Log.w(TAG, "FRP is not running")
163
- return
164
- }
165
-
166
- setStatus(Status.STOPPING, "Stopping FRP...")
167
-
168
- try {
169
- process?.destroy()
170
- process?.waitFor(5, TimeUnit.SECONDS)
171
- if (process?.isAlive == true) {
172
- process?.destroyForcibly()
173
- process?.waitFor(2, TimeUnit.SECONDS)
174
- }
175
- setStatus(Status.STOPPED, "FRP stopped")
176
- } catch (e: Exception) {
177
- Log.e(TAG, "Error stopping FRP: ${e.message}", e)
178
- setStatus(Status.ERROR, "Failed to stop FRP: ${e.message}")
179
- } finally {
180
- process = null
181
- }
182
- }
183
-
184
- private fun extractBinary(binaryName: String): String? {
185
- // FRP二进制文件作为Native Library打包在APK的lib目录下
186
- // 直接返回正确的二进制文件名(Android会自动加载)
187
- Log.i(TAG, "Using native library for $binaryName")
188
- return when (binaryName) {
189
- "frpc" -> "libfrpc.so"
190
- "frps" -> "libfrps.so"
191
- else -> {
192
- Log.e(TAG, "Unknown binary name: $binaryName")
193
- null
194
- }
195
- }
196
- }
197
-
198
- private fun setStatus(newStatus: Status, message: String) {
199
- status = newStatus
200
- lastMessage = message
201
- Log.i(TAG, "Status: $status, Message: $message")
202
- onStatusChangeListener?.invoke(newStatus, message)
203
- }
204
-
205
- fun getStatus(): Status {
206
- return status
207
- }
208
-
209
- fun getLastMessage(): String {
210
- return lastMessage
211
- }
212
-
213
- companion object {
214
- // Properties for external access
215
- val Status.status: Status
216
- get() = this
217
- val Status.message: String
218
- get() = when (this) {
219
- Status.STOPPED -> "Stopped"
220
- Status.STARTING -> "Starting"
221
- Status.RUNNING -> "Running"
222
- Status.STOPPING -> "Stopping"
223
- Status.ERROR -> "Error"
224
- }
225
- }
226
- }
1
+ package io.github.acedroidx.frp
2
+
3
+ import android.content.Context
4
+ import android.util.Log
5
+ import java.io.*
6
+ import java.util.concurrent.Executors
7
+ import java.util.concurrent.TimeUnit
8
+
9
+ class ShellService(private val context: Context) {
10
+
11
+ enum class Status {
12
+ STOPPED,
13
+ STARTING,
14
+ RUNNING,
15
+ STOPPING,
16
+ ERROR
17
+ }
18
+
19
+ private var process: Process? = null
20
+ private var status = Status.STOPPED
21
+ private var lastMessage = ""
22
+ private var executorService = Executors.newSingleThreadExecutor()
23
+ private var onStatusChangeListener: ((Status, String) -> Unit)? = null
24
+ private val TAG = "ShellService"
25
+
26
+ fun setOnStatusChangeListener(listener: (Status, String) -> Unit) {
27
+ this.onStatusChangeListener = listener
28
+ }
29
+
30
+ /**
31
+ * 使用配置路径启动FRP访问者模式
32
+ *
33
+ * @param configPath - 配置文件路径
34
+ */
35
+ fun startVisitor(configPath: String) {
36
+ startFrp("frpc", configPath)
37
+ }
38
+
39
+ /**
40
+ * 使用配置路径启动FRP服务器模式
41
+ *
42
+ * @param configPath - 配置文件路径
43
+ */
44
+ fun startServer(configPath: String) {
45
+ startFrp("frps", configPath)
46
+ }
47
+
48
+ /**
49
+ * 使用FrpConfig对象启动FRP
50
+ *
51
+ * @param frpConfig - FRP配置对象
52
+ */
53
+ fun start(frpConfig: FrpConfig) {
54
+ val binaryName = when (frpConfig.type) {
55
+ FrpType.FRPC -> "frpc"
56
+ FrpType.FRPS -> "frps"
57
+ }
58
+ val configPath = frpConfig.getFile(context).absolutePath
59
+ startFrp(binaryName, configPath)
60
+ }
61
+
62
+ private fun startFrp(binaryName: String, configPath: String) {
63
+ if (status == Status.RUNNING) {
64
+ Log.w(TAG, "FRP is already running")
65
+ return
66
+ }
67
+
68
+ // === 添加调试代码 ===
69
+ Log.i(TAG, "Starting FRP with config path: $configPath")
70
+ listAssetsFiles(context) // 添加这行
71
+
72
+
73
+ setStatus(Status.STARTING, "Starting $binaryName...")
74
+
75
+ executorService.submit {
76
+ try {
77
+ // === 关键修复:区分 asset 和真实文件 ===
78
+ val rawConfigFile = File(configPath)
79
+ val isAssetPath = configPath.startsWith("assets/") || configPath.contains("asset")
80
+
81
+ val actualConfigFile: File = if (isAssetPath) {
82
+ // 复制 asset 到可写目录
83
+ val internalDir = context.filesDir // /data/data/.../files
84
+ val destFile = File(internalDir, "frpc-running.toml") // 可写位置
85
+ copyAssetToFile(context, configPath.substringAfterLast("/"), destFile)
86
+ destFile
87
+ } else {
88
+ // 已经是真实路径
89
+ if (!rawConfigFile.exists()) {
90
+ Log.e(TAG, "Config file does not exist: $configPath")
91
+ setStatus(Status.ERROR, "Config file not found: $configPath")
92
+ return@submit
93
+ }
94
+ rawConfigFile
95
+ }
96
+
97
+ // 此时 actualConfigFile 一定是可访问的真实文件
98
+ val workingDir = actualConfigFile.parentFile!!
99
+ val binaryPath = getBinaryPath(binaryName)
100
+
101
+ // 构建命令
102
+ val command = arrayOf(
103
+ binaryPath.absolutePath,
104
+ "-c",
105
+ actualConfigFile.name // 只传文件名,工作目录已设
106
+ )
107
+
108
+ Log.i(TAG, "Executing: ${command.joinToString(" ")}")
109
+ Log.i(TAG, "Working directory: ${workingDir.absolutePath}")
110
+ Log.i(TAG, "Config file: ${actualConfigFile.absolutePath}")
111
+
112
+ // 执行
113
+ val pb = ProcessBuilder(*command)
114
+ .redirectErrorStream(true)
115
+ .directory(workingDir)
116
+
117
+ process = pb.start()
118
+ setStatus(Status.RUNNING, "$binaryName started successfully")
119
+
120
+ // 输出监听
121
+ BufferedReader(InputStreamReader(process?.inputStream)).use { reader ->
122
+ var line: String?
123
+ while (reader.readLine().also { line = it } != null) {
124
+ Log.d(TAG, "FRP output: $line")
125
+ lastMessage = line ?: ""
126
+ onStatusChangeListener?.invoke(status, lastMessage)
127
+ }
128
+ }
129
+
130
+ monitorProcess()
131
+
132
+ } catch (e: Exception) {
133
+ Log.e(TAG, "Error running FRP: ${e.message}", e)
134
+ setStatus(Status.ERROR, "Failed to start FRP: ${e.message}")
135
+ }
136
+ }
137
+ }
138
+
139
+ /**
140
+ * 调试用:列出assets目录下的所有文件
141
+ */
142
+ private fun listAssetsFiles(context: Context) {
143
+ try {
144
+ val assets = context.assets
145
+ val fileList = assets.list("") ?: emptyArray()
146
+
147
+ Log.i(TAG, "=== Assets Files List ===")
148
+ fileList.forEach { fileName ->
149
+ Log.i(TAG, "Asset file: $fileName")
150
+ }
151
+ Log.i(TAG, "Total files: ${fileList.size}")
152
+ Log.i(TAG, "======================")
153
+ } catch (e: IOException) {
154
+ Log.e(TAG, "Failed to list assets files", e)
155
+ }
156
+ }
157
+
158
+ /**
159
+ * 将 assets 中的文件复制到目标文件
160
+ */
161
+ private fun copyAssetToFile(context: Context, assetName: String, destFile: File) {
162
+ try {
163
+ context.assets.open(assetName).use { input ->
164
+ FileOutputStream(destFile).use { output ->
165
+ val buffer = ByteArray(1024)
166
+ var length: Int
167
+ while (input.read(buffer).also { length = it } > 0) {
168
+ output.write(buffer, 0, length)
169
+ }
170
+ }
171
+ }
172
+ Log.i(TAG, "Successfully copied asset $assetName to ${destFile.absolutePath}")
173
+ } catch (e: IOException) {
174
+ Log.e(TAG, "Failed to copy asset $assetName", e)
175
+ throw RuntimeException("Failed to copy asset: $assetName", e)
176
+ }
177
+ }
178
+
179
+ /**
180
+ * 获取 native 二进制路径
181
+ */
182
+ private fun getBinaryPath(binaryName: String): File {
183
+ val packageManager = context.packageManager
184
+ val applicationInfo = packageManager.getApplicationInfo(
185
+ context.packageName,
186
+ android.content.pm.PackageManager.GET_SHARED_LIBRARY_FILES
187
+ )
188
+ val nativeLibraryDir = File(applicationInfo.nativeLibraryDir)
189
+ val libName = when (binaryName) {
190
+ "frpc" -> "libfrpc.so"
191
+ "frps" -> "libfrps.so"
192
+ else -> throw IllegalArgumentException("Unknown binary: $binaryName")
193
+ }
194
+ return File(nativeLibraryDir, libName)
195
+ }
196
+
197
+
198
+ private fun monitorProcess() {
199
+ executorService.submit {
200
+ try {
201
+ process?.waitFor()
202
+ val exitCode = process?.exitValue() ?: -1
203
+ setStatus(Status.STOPPED, "FRP stopped with exit code $exitCode")
204
+ } catch (e: Exception) {
205
+ Log.e(TAG, "Error monitoring FRP process: ${e.message}", e)
206
+ setStatus(Status.ERROR, "Error monitoring FRP: ${e.message}")
207
+ }
208
+ }
209
+ }
210
+
211
+ fun stop() {
212
+ if (status != Status.RUNNING && status != Status.STARTING) {
213
+ Log.w(TAG, "FRP is not running")
214
+ return
215
+ }
216
+
217
+ setStatus(Status.STOPPING, "Stopping FRP...")
218
+
219
+ try {
220
+ process?.destroy()
221
+ process?.waitFor(5, TimeUnit.SECONDS)
222
+ if (process?.isAlive == true) {
223
+ process?.destroyForcibly()
224
+ process?.waitFor(2, TimeUnit.SECONDS)
225
+ }
226
+ setStatus(Status.STOPPED, "FRP stopped")
227
+ } catch (e: Exception) {
228
+ Log.e(TAG, "Error stopping FRP: ${e.message}", e)
229
+ setStatus(Status.ERROR, "Failed to stop FRP: ${e.message}")
230
+ } finally {
231
+ process = null
232
+ }
233
+ }
234
+
235
+ private fun extractBinary(binaryName: String): String? {
236
+ // FRP二进制文件作为Native Library打包在APK的lib目录下
237
+ // 直接返回正确的二进制文件名(Android会自动加载)
238
+ Log.i(TAG, "Using native library for $binaryName")
239
+ return when (binaryName) {
240
+ "frpc" -> "libfrpc.so"
241
+ "frps" -> "libfrps.so"
242
+ else -> {
243
+ Log.e(TAG, "Unknown binary name: $binaryName")
244
+ null
245
+ }
246
+ }
247
+ }
248
+
249
+ private fun setStatus(newStatus: Status, message: String) {
250
+ status = newStatus
251
+ lastMessage = message
252
+ Log.i(TAG, "Status: $status, Message: $message")
253
+ onStatusChangeListener?.invoke(newStatus, message)
254
+ }
255
+
256
+ fun getStatus(): Status {
257
+ return status
258
+ }
259
+
260
+ fun getLastMessage(): String {
261
+ return lastMessage
262
+ }
263
+
264
+ companion object {
265
+ // Properties for external access
266
+ val Status.status: Status
267
+ get() = this
268
+ val Status.message: String
269
+ get() = when (this) {
270
+ Status.STOPPED -> "Stopped"
271
+ Status.STARTING -> "Starting"
272
+ Status.RUNNING -> "Running"
273
+ Status.STOPPING -> "Stopping"
274
+ Status.ERROR -> "Error"
275
+ }
276
+ }
277
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ha-frp-rn",
3
- "version": "1.0.16",
3
+ "version": "1.0.19",
4
4
  "description": "React Native FRP module for network penetration",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",