Skip to content

Commit

Permalink
udp and ipv6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
uoosef committed Aug 30, 2023
1 parent cc4145e commit 2f06a0b
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 25 deletions.
2 changes: 1 addition & 1 deletion app_bepass/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ android {
defaultConfig {
applicationId = "moe.matsuri.plugin.bepass"
versionCode = 1
versionName = "1.3.6"
versionName = "1.4.1"
}
}
8 changes: 4 additions & 4 deletions download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ dl_and_chmod() {
}

download_bepass() {
dl_and_chmod arm64-v8a "https://github.com/uoosef/bepass/releases/download/v1.1.12/Bepass-linux-arm64.e8e7a3.zip"
dl_and_chmod armeabi-v7a "https://github.com/uoosef/bepass/releases/download/v1.1.12/Bepass-linux-arm7.e8e7a3.zip"
dl_and_chmod x86 "https://github.com/uoosef/bepass/releases/download/v1.1.12/Bepass-linux-386.e8e7a3.zip"
dl_and_chmod x86_64 "https://github.com/uoosef/bepass/releases/download/v1.1.12/Bepass-linux-amd64.e8e7a3.zip"
dl_and_chmod arm64-v8a "https://github.com/uoosef/bepass/releases/download/v1.2.8-beta/Bepass-linux-arm64.83b8cd.zip"
dl_and_chmod armeabi-v7a "https://github.com/uoosef/bepass/releases/download/v1.2.8-beta/Bepass-linux-arm7.83b8cd.zip"
dl_and_chmod x86 "https://github.com/uoosef/bepass/releases/download/v1.2.8-beta/Bepass-linux-386.83b8cd.zip"
dl_and_chmod x86_64 "https://github.com/uoosef/bepass/releases/download/v1.2.8-beta/Bepass-linux-amd64.83b8cd.zip"
}

download_"$1"
76 changes: 56 additions & 20 deletions js/plugin_bepass/bepass.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ class bepassClass {
this.defaultSharedStorage.workerCleanIPAndPort = "104.31.16.104:443";
this.defaultSharedStorage.hosts = "example.com:1.2.3.4, yarp.lefolgoc.net:5.39.88.20";
this.defaultSharedStorage.workerAddress = "https://example.user.worker.dev/dns-query";
this.defaultSharedStorage.udpBindAddress = "0.0.0.0";
this.defaultSharedStorage.udpReadTimeout = "120";
this.defaultSharedStorage.udpWriteTimeout = "120";
this.defaultSharedStorage.udpLinkIdleTimeout = "120";

for (var k in this.defaultSharedStorage) {
let v = this.defaultSharedStorage[k];
Expand Down Expand Up @@ -66,6 +70,10 @@ class bepassClass {
builder.searchParams.set("hosts", this.sharedStorage.hosts)
builder.searchParams.set("dnsCacheTTL", this.sharedStorage.dnsCacheTTL)
builder.searchParams.set("dnsRequestTimeout", this.sharedStorage.dnsRequestTimeout)
builder.searchParams.set("udpBindAddress", this.sharedStorage.udpBindAddress)
builder.searchParams.set("udpReadTimeout", this.sharedStorage.udpReadTimeout)
builder.searchParams.set("udpWriteTimeout", this.sharedStorage.udpWriteTimeout)
builder.searchParams.set("udpLinkIdleTimeout", this.sharedStorage.udpLinkIdleTimeout)

if (this.sharedStorage.allowInsecure) {
builder.searchParams.set("allow_insecure", "1")
Expand Down Expand Up @@ -154,11 +162,6 @@ class bepassClass {
key: "hosts",
icon: "baseline_wrap_text_24",
},
{
"type": "SwitchPreference",
"key": "tlsPaddingEnabled",
"icon": "ic_baseline_fingerprint_24",
},
{
"type": "SwitchPreference",
"key": "allowInsecure",
Expand All @@ -169,11 +172,6 @@ class bepassClass {
"key": "workerEnabled",
"icon": "ic_hardware_router",
},
],
},
{
"key": "workerSettingsCategory",
"preferences": [
{
"type": "SwitchPreference",
"key": "workerDNSOnly",
Expand All @@ -189,15 +187,40 @@ class bepassClass {
"key": "workerCleanIPAndPort",
"icon": "ic_maps_directions_boat",
},
]
{
"type": "SwitchPreference",
"key": "tlsPaddingEnabled",
"icon": "ic_baseline_fingerprint_24",
},
{
"type": "EditTextPreference",
"key": "tlsPaddingSize",
"icon": "ic_file_cloud_queue",
},
],
},
{
"key": "tlsPaddingCategory",
"key": "udpSettings",
"preferences": [
{
"type": "EditTextPreference",
"key": "tlsPaddingSize",
"icon": "ic_file_cloud_queue",
"key": "udpBindAddress",
"icon": "ic_hardware_router",
},
{
"type": "EditTextPreference",
"key": "udpReadTimeout",
"icon": "ic_baseline_timelapse_24",
},
{
"type": "EditTextPreference",
"key": "udpWriteTimeout",
"icon": "ic_baseline_timelapse_24",
},
{
"type": "EditTextPreference",
"key": "udpLinkIdleTimeout",
"icon": "ic_baseline_timelapse_24",
},
]
},
Expand Down Expand Up @@ -226,6 +249,7 @@ class bepassClass {
}

listenOnPreferenceChangedNow("workerEnabled")
listenOnPreferenceChangedNow("tlsPaddingEnabled")
}

sharedStorageFromProfileCache() {
Expand All @@ -243,18 +267,22 @@ class bepassClass {
}

_onPreferenceChanged(key, newValue) {
if (key == "wrokerEnabled") {
if (key == "workerEnabled") {
if (newValue == true) {
neko.setPreferenceVisibility("workerSettingsCategory", true)
neko.setPreferenceVisibility("workerDNSOnly", true)
neko.setPreferenceVisibility("workerAddress", true)
neko.setPreferenceVisibility("workerCleanIPAndPort", true)
} else {
neko.setPreferenceVisibility("workerSettingsCategory", false)
neko.setPreferenceVisibility("workerDNSOnly", false)
neko.setPreferenceVisibility("workerAddress", false)
neko.setPreferenceVisibility("workerCleanIPAndPort", false)
}
}
if (key == "tlsPaddingEnabled") {
if (newValue == true) {
neko.setPreferenceVisibility("tlsPaddingCategory", true)
neko.setPreferenceVisibility("tlsPaddingSize", true)
} else {
neko.setPreferenceVisibility("tlsPaddingCategory", false)
neko.setPreferenceVisibility("tlsPaddingSize", false)
}
}
}
Expand All @@ -281,6 +309,10 @@ class bepassClass {
this.sharedStorage.dnsCacheTTL = builder.searchParams.get("dnsCacheTTL")
this.sharedStorage.dnsRequestTimeout = builder.searchParams.get("dnsRequestTimeout")
this.sharedStorage.hosts = builder.searchParams.get("hosts")
this.sharedStorage.udpBindAddress = builder.searchParams.get("udpBindAddress")
this.sharedStorage.udpReadTimeout = builder.searchParams.get("udpReadTimeout")
this.sharedStorage.udpWriteTimeout = builder.searchParams.get("udpWriteTimeout")
this.sharedStorage.udpLinkIdleTimeout = builder.searchParams.get("udpLinkIdleTimeout")

util.ifNotNull(url.searchParams.get("allow_insecure"), (it) => {
if (it == "1" || it == "true") this.sharedStorage.allowInsecure = true
Expand Down Expand Up @@ -329,7 +361,11 @@ class bepassClass {
"WorkerEnabled": bepass.workerEnabled,
"WorkerDNSOnly": bepass.workerDNSOnly,
"EnableLowLevelSockets": true,
"Hosts": util.stringToHostsArray(bepass.hosts)
"Hosts": util.stringToHostsArray(bepass.hosts),
"UDPBindAddress": bepass.udpBindAddress,
"UDPReadTimeout": util.stringToInt(bepass.udpReadTimeout),
"UDPWriteTimeout": util.stringToInt(bepass.udpWriteTimeout),
"udpLinkIdleTimeout": util.stringToInt(bepass.udpLinkIdleTimeout)
};

let v = {};
Expand Down

0 comments on commit 2f06a0b

Please sign in to comment.