Skip to content

Commit ae665d3

Browse files
authored
feat: multi tunnel support (#566)
* add support endpoint resolve to ipv6 preference
1 parent 1857977 commit ae665d3

File tree

133 files changed

+2710
-2159
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+2710
-2159
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,288 @@
1+
{
2+
"formatVersion": 1,
3+
"database": {
4+
"version": 16,
5+
"identityHash": "ae51793c4d09ea3194ecd26f0606f35c",
6+
"entities": [
7+
{
8+
"tableName": "Settings",
9+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_tunnel_enabled` INTEGER NOT NULL, `is_tunnel_on_mobile_data_enabled` INTEGER NOT NULL, `trusted_network_ssids` TEXT NOT NULL, `is_always_on_vpn_enabled` INTEGER NOT NULL, `is_tunnel_on_ethernet_enabled` INTEGER NOT NULL, `is_shortcuts_enabled` INTEGER NOT NULL DEFAULT false, `is_tunnel_on_wifi_enabled` INTEGER NOT NULL DEFAULT false, `is_kernel_enabled` INTEGER NOT NULL DEFAULT false, `is_restore_on_boot_enabled` INTEGER NOT NULL DEFAULT false, `is_multi_tunnel_enabled` INTEGER NOT NULL DEFAULT false, `is_ping_enabled` INTEGER NOT NULL DEFAULT false, `is_amnezia_enabled` INTEGER NOT NULL DEFAULT false, `is_wildcards_enabled` INTEGER NOT NULL DEFAULT false, `is_wifi_by_shell_enabled` INTEGER NOT NULL DEFAULT false, `is_stop_on_no_internet_enabled` INTEGER NOT NULL DEFAULT false, `is_vpn_kill_switch_enabled` INTEGER NOT NULL DEFAULT false, `is_kernel_kill_switch_enabled` INTEGER NOT NULL DEFAULT false, `is_lan_on_kill_switch_enabled` INTEGER NOT NULL DEFAULT false, `debounce_delay_seconds` INTEGER NOT NULL DEFAULT 3, `is_disable_kill_switch_on_trusted_enabled` INTEGER NOT NULL DEFAULT false)",
10+
"fields": [
11+
{
12+
"fieldPath": "id",
13+
"columnName": "id",
14+
"affinity": "INTEGER",
15+
"notNull": true
16+
},
17+
{
18+
"fieldPath": "isAutoTunnelEnabled",
19+
"columnName": "is_tunnel_enabled",
20+
"affinity": "INTEGER",
21+
"notNull": true
22+
},
23+
{
24+
"fieldPath": "isTunnelOnMobileDataEnabled",
25+
"columnName": "is_tunnel_on_mobile_data_enabled",
26+
"affinity": "INTEGER",
27+
"notNull": true
28+
},
29+
{
30+
"fieldPath": "trustedNetworkSSIDs",
31+
"columnName": "trusted_network_ssids",
32+
"affinity": "TEXT",
33+
"notNull": true
34+
},
35+
{
36+
"fieldPath": "isAlwaysOnVpnEnabled",
37+
"columnName": "is_always_on_vpn_enabled",
38+
"affinity": "INTEGER",
39+
"notNull": true
40+
},
41+
{
42+
"fieldPath": "isTunnelOnEthernetEnabled",
43+
"columnName": "is_tunnel_on_ethernet_enabled",
44+
"affinity": "INTEGER",
45+
"notNull": true
46+
},
47+
{
48+
"fieldPath": "isShortcutsEnabled",
49+
"columnName": "is_shortcuts_enabled",
50+
"affinity": "INTEGER",
51+
"notNull": true,
52+
"defaultValue": "false"
53+
},
54+
{
55+
"fieldPath": "isTunnelOnWifiEnabled",
56+
"columnName": "is_tunnel_on_wifi_enabled",
57+
"affinity": "INTEGER",
58+
"notNull": true,
59+
"defaultValue": "false"
60+
},
61+
{
62+
"fieldPath": "isKernelEnabled",
63+
"columnName": "is_kernel_enabled",
64+
"affinity": "INTEGER",
65+
"notNull": true,
66+
"defaultValue": "false"
67+
},
68+
{
69+
"fieldPath": "isRestoreOnBootEnabled",
70+
"columnName": "is_restore_on_boot_enabled",
71+
"affinity": "INTEGER",
72+
"notNull": true,
73+
"defaultValue": "false"
74+
},
75+
{
76+
"fieldPath": "isMultiTunnelEnabled",
77+
"columnName": "is_multi_tunnel_enabled",
78+
"affinity": "INTEGER",
79+
"notNull": true,
80+
"defaultValue": "false"
81+
},
82+
{
83+
"fieldPath": "isPingEnabled",
84+
"columnName": "is_ping_enabled",
85+
"affinity": "INTEGER",
86+
"notNull": true,
87+
"defaultValue": "false"
88+
},
89+
{
90+
"fieldPath": "isAmneziaEnabled",
91+
"columnName": "is_amnezia_enabled",
92+
"affinity": "INTEGER",
93+
"notNull": true,
94+
"defaultValue": "false"
95+
},
96+
{
97+
"fieldPath": "isWildcardsEnabled",
98+
"columnName": "is_wildcards_enabled",
99+
"affinity": "INTEGER",
100+
"notNull": true,
101+
"defaultValue": "false"
102+
},
103+
{
104+
"fieldPath": "isWifiNameByShellEnabled",
105+
"columnName": "is_wifi_by_shell_enabled",
106+
"affinity": "INTEGER",
107+
"notNull": true,
108+
"defaultValue": "false"
109+
},
110+
{
111+
"fieldPath": "isStopOnNoInternetEnabled",
112+
"columnName": "is_stop_on_no_internet_enabled",
113+
"affinity": "INTEGER",
114+
"notNull": true,
115+
"defaultValue": "false"
116+
},
117+
{
118+
"fieldPath": "isVpnKillSwitchEnabled",
119+
"columnName": "is_vpn_kill_switch_enabled",
120+
"affinity": "INTEGER",
121+
"notNull": true,
122+
"defaultValue": "false"
123+
},
124+
{
125+
"fieldPath": "isKernelKillSwitchEnabled",
126+
"columnName": "is_kernel_kill_switch_enabled",
127+
"affinity": "INTEGER",
128+
"notNull": true,
129+
"defaultValue": "false"
130+
},
131+
{
132+
"fieldPath": "isLanOnKillSwitchEnabled",
133+
"columnName": "is_lan_on_kill_switch_enabled",
134+
"affinity": "INTEGER",
135+
"notNull": true,
136+
"defaultValue": "false"
137+
},
138+
{
139+
"fieldPath": "debounceDelaySeconds",
140+
"columnName": "debounce_delay_seconds",
141+
"affinity": "INTEGER",
142+
"notNull": true,
143+
"defaultValue": "3"
144+
},
145+
{
146+
"fieldPath": "isDisableKillSwitchOnTrustedEnabled",
147+
"columnName": "is_disable_kill_switch_on_trusted_enabled",
148+
"affinity": "INTEGER",
149+
"notNull": true,
150+
"defaultValue": "false"
151+
}
152+
],
153+
"primaryKey": {
154+
"autoGenerate": true,
155+
"columnNames": [
156+
"id"
157+
]
158+
},
159+
"indices": [],
160+
"foreignKeys": []
161+
},
162+
{
163+
"tableName": "TunnelConfig",
164+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `wg_quick` TEXT NOT NULL, `tunnel_networks` TEXT NOT NULL DEFAULT '', `is_mobile_data_tunnel` INTEGER NOT NULL DEFAULT false, `is_primary_tunnel` INTEGER NOT NULL DEFAULT false, `am_quick` TEXT NOT NULL DEFAULT '', `is_Active` INTEGER NOT NULL DEFAULT false, `is_ping_enabled` INTEGER NOT NULL DEFAULT false, `ping_interval` INTEGER DEFAULT null, `ping_cooldown` INTEGER DEFAULT null, `ping_ip` TEXT DEFAULT null, `is_ethernet_tunnel` INTEGER NOT NULL DEFAULT false, `is_ipv4_preferred` INTEGER NOT NULL DEFAULT true)",
165+
"fields": [
166+
{
167+
"fieldPath": "id",
168+
"columnName": "id",
169+
"affinity": "INTEGER",
170+
"notNull": true
171+
},
172+
{
173+
"fieldPath": "name",
174+
"columnName": "name",
175+
"affinity": "TEXT",
176+
"notNull": true
177+
},
178+
{
179+
"fieldPath": "wgQuick",
180+
"columnName": "wg_quick",
181+
"affinity": "TEXT",
182+
"notNull": true
183+
},
184+
{
185+
"fieldPath": "tunnelNetworks",
186+
"columnName": "tunnel_networks",
187+
"affinity": "TEXT",
188+
"notNull": true,
189+
"defaultValue": "''"
190+
},
191+
{
192+
"fieldPath": "isMobileDataTunnel",
193+
"columnName": "is_mobile_data_tunnel",
194+
"affinity": "INTEGER",
195+
"notNull": true,
196+
"defaultValue": "false"
197+
},
198+
{
199+
"fieldPath": "isPrimaryTunnel",
200+
"columnName": "is_primary_tunnel",
201+
"affinity": "INTEGER",
202+
"notNull": true,
203+
"defaultValue": "false"
204+
},
205+
{
206+
"fieldPath": "amQuick",
207+
"columnName": "am_quick",
208+
"affinity": "TEXT",
209+
"notNull": true,
210+
"defaultValue": "''"
211+
},
212+
{
213+
"fieldPath": "isActive",
214+
"columnName": "is_Active",
215+
"affinity": "INTEGER",
216+
"notNull": true,
217+
"defaultValue": "false"
218+
},
219+
{
220+
"fieldPath": "isPingEnabled",
221+
"columnName": "is_ping_enabled",
222+
"affinity": "INTEGER",
223+
"notNull": true,
224+
"defaultValue": "false"
225+
},
226+
{
227+
"fieldPath": "pingInterval",
228+
"columnName": "ping_interval",
229+
"affinity": "INTEGER",
230+
"notNull": false,
231+
"defaultValue": "null"
232+
},
233+
{
234+
"fieldPath": "pingCooldown",
235+
"columnName": "ping_cooldown",
236+
"affinity": "INTEGER",
237+
"notNull": false,
238+
"defaultValue": "null"
239+
},
240+
{
241+
"fieldPath": "pingIp",
242+
"columnName": "ping_ip",
243+
"affinity": "TEXT",
244+
"notNull": false,
245+
"defaultValue": "null"
246+
},
247+
{
248+
"fieldPath": "isEthernetTunnel",
249+
"columnName": "is_ethernet_tunnel",
250+
"affinity": "INTEGER",
251+
"notNull": true,
252+
"defaultValue": "false"
253+
},
254+
{
255+
"fieldPath": "isIpv4Preferred",
256+
"columnName": "is_ipv4_preferred",
257+
"affinity": "INTEGER",
258+
"notNull": true,
259+
"defaultValue": "true"
260+
}
261+
],
262+
"primaryKey": {
263+
"autoGenerate": true,
264+
"columnNames": [
265+
"id"
266+
]
267+
},
268+
"indices": [
269+
{
270+
"name": "index_TunnelConfig_name",
271+
"unique": true,
272+
"columnNames": [
273+
"name"
274+
],
275+
"orders": [],
276+
"createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_TunnelConfig_name` ON `${TABLE_NAME}` (`name`)"
277+
}
278+
],
279+
"foreignKeys": []
280+
}
281+
],
282+
"views": [],
283+
"setupQueries": [
284+
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
285+
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'ae51793c4d09ea3194ecd26f0606f35c')"
286+
]
287+
}
288+
}

app/src/main/AndroidManifest.xml

+10-25
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
android:theme="@style/Theme.App.Start"
6767
tools:targetApi="tiramisu">
6868
<activity
69-
android:name=".ui.MainActivity"
69+
android:name=".MainActivity"
7070
android:exported="true"
7171
android:windowSoftInputMode="adjustResize"
7272
android:theme="@style/Theme.WireguardAutoTunnel"
@@ -87,7 +87,7 @@
8787
tools:replace="screenOrientation" />
8888

8989
<activity
90-
android:name=".service.shortcut.ShortcutsActivity"
90+
android:name=".core.shortcut.ShortcutsActivity"
9191
android:enabled="true"
9292
android:exported="true"
9393
android:noHistory="true"
@@ -107,7 +107,7 @@
107107
</provider>
108108

109109
<service
110-
android:name=".service.tile.TunnelControlTile"
110+
android:name=".core.service.tile.TunnelControlTile"
111111
android:exported="true"
112112
android:icon="@drawable/ic_launcher"
113113
android:label="@string/tunnel_control"
@@ -124,7 +124,7 @@
124124
</intent-filter>
125125
</service>
126126
<service
127-
android:name=".service.tile.AutoTunnelControlTile"
127+
android:name=".core.service.tile.AutoTunnelControlTile"
128128
android:exported="true"
129129
android:icon="@drawable/ic_launcher"
130130
android:label="@string/auto_tunnel"
@@ -140,23 +140,8 @@
140140
<action android:name="android.service.quicksettings.action.QS_TILE" />
141141
</intent-filter>
142142
</service>
143-
<service
144-
android:name=".service.tunnel.AlwaysOnVpnService"
145-
android:enabled="true"
146-
android:exported="false"
147-
android:foregroundServiceType="systemExempted"
148-
android:permission="android.permission.BIND_VPN_SERVICE"
149-
android:persistent="true"
150-
tools:node="merge">
151-
<intent-filter>
152-
<action android:name="android.net.VpnService" />
153-
</intent-filter>
154-
<meta-data
155-
android:name="android.net.VpnService.SUPPORTS_ALWAYS_ON"
156-
android:value="true" />
157-
</service>
158143
<service
159-
android:name=".service.foreground.autotunnel.AutoTunnelService"
144+
android:name=".core.service.autotunnel.AutoTunnelService"
160145
android:enabled="true"
161146
android:exported="false"
162147
android:foregroundServiceType="systemExempted"
@@ -165,7 +150,7 @@
165150
tools:node="merge" />
166151

167152
<service
168-
android:name=".service.foreground.TunnelForegroundService"
153+
android:name=".core.service.TunnelForegroundService"
169154
android:exported="false"
170155
android:persistent="true"
171156
android:foregroundServiceType="systemExempted"
@@ -176,7 +161,7 @@
176161
</service>
177162

178163
<receiver
179-
android:name=".receiver.BootReceiver"
164+
android:name=".core.broadcast.BootReceiver"
180165
android:enabled="true"
181166
android:exported="false">
182167
<intent-filter>
@@ -189,22 +174,22 @@
189174
</intent-filter>
190175
</receiver>
191176
<receiver
192-
android:name=".receiver.AppUpdateReceiver"
177+
android:name=".core.broadcast.AppUpdateReceiver"
193178
android:exported="false">
194179
<intent-filter>
195180
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
196181
</intent-filter>
197182
</receiver>
198183
<receiver
199-
android:name=".receiver.KernelReceiver"
184+
android:name=".core.broadcast.KernelReceiver"
200185
android:exported="false"
201186
android:permission="${applicationId}.permission.CONTROL_TUNNELS">
202187
<intent-filter>
203188
<action android:name="com.wireguard.android.action.REFRESH_TUNNEL_STATES" />
204189
</intent-filter>
205190
</receiver>
206191
<receiver
207-
android:name=".receiver.NotificationActionReceiver"
192+
android:name=".core.broadcast.NotificationActionReceiver"
208193
android:exported="false"
209194
android:permission="${applicationId}.permission.CONTROL_TUNNELS">
210195
</receiver>

0 commit comments

Comments
 (0)