mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-02-28 05:02:59 +00:00
Merge branch 'main' into node-mode
This commit is contained in:
commit
a9bf43e985
9 changed files with 156 additions and 46 deletions
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
|
|
@ -18,6 +18,7 @@ on:
|
||||||
- 'go.mod'
|
- 'go.mod'
|
||||||
- 'go.sum'
|
- 'go.sum'
|
||||||
- 'x-ui.service.debian'
|
- 'x-ui.service.debian'
|
||||||
|
- 'x-ui.service.arch'
|
||||||
- 'x-ui.service.rhel'
|
- 'x-ui.service.rhel'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
@ -80,6 +81,7 @@ jobs:
|
||||||
mkdir x-ui
|
mkdir x-ui
|
||||||
cp xui-release x-ui/
|
cp xui-release x-ui/
|
||||||
cp x-ui.service.debian x-ui/
|
cp x-ui.service.debian x-ui/
|
||||||
|
cp x-ui.service.arch x-ui/
|
||||||
cp x-ui.service.rhel x-ui/
|
cp x-ui.service.rhel x-ui/
|
||||||
cp x-ui.sh x-ui/
|
cp x-ui.sh x-ui/
|
||||||
mv x-ui/xui-release x-ui/x-ui
|
mv x-ui/xui-release x-ui/x-ui
|
||||||
|
|
@ -223,4 +225,4 @@ jobs:
|
||||||
file: x-ui-windows-amd64.zip
|
file: x-ui-windows-amd64.zip
|
||||||
asset_name: x-ui-windows-amd64.zip
|
asset_name: x-ui-windows-amd64.zip
|
||||||
overwrite: true
|
overwrite: true
|
||||||
prerelease: true
|
prerelease: true
|
||||||
|
|
|
||||||
12
install.sh
12
install.sh
|
|
@ -818,6 +818,15 @@ install_x-ui() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
arch | manjaro | parch)
|
||||||
|
if [ -f "x-ui.service.arch" ]; then
|
||||||
|
echo -e "${green}Found x-ui.service.arch in extracted files, installing...${plain}"
|
||||||
|
cp -f x-ui.service.arch ${xui_service}/x-ui.service >/dev/null 2>&1
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
service_installed=true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
if [ -f "x-ui.service.rhel" ]; then
|
if [ -f "x-ui.service.rhel" ]; then
|
||||||
echo -e "${green}Found x-ui.service.rhel in extracted files, installing...${plain}"
|
echo -e "${green}Found x-ui.service.rhel in extracted files, installing...${plain}"
|
||||||
|
|
@ -837,6 +846,9 @@ install_x-ui() {
|
||||||
ubuntu | debian | armbian)
|
ubuntu | debian | armbian)
|
||||||
curl -4fLRo ${xui_service}/x-ui.service https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.service.debian >/dev/null 2>&1
|
curl -4fLRo ${xui_service}/x-ui.service https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.service.debian >/dev/null 2>&1
|
||||||
;;
|
;;
|
||||||
|
arch | manjaro | parch)
|
||||||
|
curl -4fLRo ${xui_service}/x-ui.service https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.service.arch >/dev/null 2>&1
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
curl -4fLRo ${xui_service}/x-ui.service https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.service.rhel >/dev/null 2>&1
|
curl -4fLRo ${xui_service}/x-ui.service https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.service.rhel >/dev/null 2>&1
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
13
update.sh
13
update.sh
|
|
@ -737,6 +737,7 @@ update_x-ui() {
|
||||||
rm ${xui_folder} -f >/dev/null 2>&1
|
rm ${xui_folder} -f >/dev/null 2>&1
|
||||||
rm ${xui_folder}/x-ui.service -f >/dev/null 2>&1
|
rm ${xui_folder}/x-ui.service -f >/dev/null 2>&1
|
||||||
rm ${xui_folder}/x-ui.service.debian -f >/dev/null 2>&1
|
rm ${xui_folder}/x-ui.service.debian -f >/dev/null 2>&1
|
||||||
|
rm ${xui_folder}/x-ui.service.arch -f >/dev/null 2>&1
|
||||||
rm ${xui_folder}/x-ui.service.rhel -f >/dev/null 2>&1
|
rm ${xui_folder}/x-ui.service.rhel -f >/dev/null 2>&1
|
||||||
rm ${xui_folder}/x-ui -f >/dev/null 2>&1
|
rm ${xui_folder}/x-ui -f >/dev/null 2>&1
|
||||||
rm ${xui_folder}/x-ui.sh -f >/dev/null 2>&1
|
rm ${xui_folder}/x-ui.sh -f >/dev/null 2>&1
|
||||||
|
|
@ -819,6 +820,15 @@ update_x-ui() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
arch | manjaro | parch)
|
||||||
|
if [ -f "x-ui.service.arch" ]; then
|
||||||
|
echo -e "${green}Installing arch-like systemd unit...${plain}"
|
||||||
|
cp -f x-ui.service.arch ${xui_service}/x-ui.service >/dev/null 2>&1
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
service_installed=true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
if [ -f "x-ui.service.rhel" ]; then
|
if [ -f "x-ui.service.rhel" ]; then
|
||||||
echo -e "${green}Installing rhel-like systemd unit...${plain}"
|
echo -e "${green}Installing rhel-like systemd unit...${plain}"
|
||||||
|
|
@ -837,6 +847,9 @@ update_x-ui() {
|
||||||
ubuntu | debian | armbian)
|
ubuntu | debian | armbian)
|
||||||
${curl_bin} -4fLRo ${xui_service}/x-ui.service https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.service.debian >/dev/null 2>&1
|
${curl_bin} -4fLRo ${xui_service}/x-ui.service https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.service.debian >/dev/null 2>&1
|
||||||
;;
|
;;
|
||||||
|
arch | manjaro | parch)
|
||||||
|
${curl_bin} -4fLRo ${xui_service}/x-ui.service https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.service.arch >/dev/null 2>&1
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
${curl_bin} -4fLRo ${xui_service}/x-ui.service https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.service.rhel >/dev/null 2>&1
|
${curl_bin} -4fLRo ${xui_service}/x-ui.service https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.service.rhel >/dev/null 2>&1
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,12 @@ class WebSocketClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
connect() {
|
connect() {
|
||||||
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
if (this.ws && (this.ws.readyState === WebSocket.OPEN || this.ws.readyState === WebSocket.CONNECTING)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.shouldReconnect = true;
|
||||||
|
|
||||||
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||||
// Ensure basePath ends with '/' for proper URL construction
|
// Ensure basePath ends with '/' for proper URL construction
|
||||||
let basePath = this.basePath || '';
|
let basePath = this.basePath || '';
|
||||||
|
|
@ -97,7 +99,10 @@ class WebSocketClient {
|
||||||
if (!this.listeners.has(event)) {
|
if (!this.listeners.has(event)) {
|
||||||
this.listeners.set(event, []);
|
this.listeners.set(event, []);
|
||||||
}
|
}
|
||||||
this.listeners.get(event).push(callback);
|
const callbacks = this.listeners.get(event);
|
||||||
|
if (!callbacks.includes(callback)) {
|
||||||
|
callbacks.push(callback);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
off(event, callback) {
|
off(event, callback) {
|
||||||
|
|
|
||||||
|
|
@ -1618,7 +1618,6 @@
|
||||||
if (payload && Array.isArray(payload)) {
|
if (payload && Array.isArray(payload)) {
|
||||||
// Use setInbounds to properly convert to DBInbound objects with methods
|
// Use setInbounds to properly convert to DBInbound objects with methods
|
||||||
this.setInbounds(payload);
|
this.setInbounds(payload);
|
||||||
this.searchInbounds(this.searchKey);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1630,14 +1629,31 @@
|
||||||
|
|
||||||
// Update online clients list in real-time
|
// Update online clients list in real-time
|
||||||
if (payload && Array.isArray(payload.onlineClients)) {
|
if (payload && Array.isArray(payload.onlineClients)) {
|
||||||
this.onlineClients = payload.onlineClients;
|
const nextOnlineClients = payload.onlineClients;
|
||||||
// Recalculate client counts to update online status
|
let onlineChanged = this.onlineClients.length !== nextOnlineClients.length;
|
||||||
this.dbInbounds.forEach(dbInbound => {
|
if (!onlineChanged) {
|
||||||
const inbound = this.inbounds.find(ib => ib.id === dbInbound.id);
|
const prevSet = new Set(this.onlineClients);
|
||||||
if (inbound && this.clientCount[dbInbound.id]) {
|
for (const email of nextOnlineClients) {
|
||||||
this.clientCount[dbInbound.id] = this.getClientCounts(dbInbound, inbound);
|
if (!prevSet.has(email)) {
|
||||||
|
onlineChanged = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
this.onlineClients = nextOnlineClients;
|
||||||
|
if (onlineChanged) {
|
||||||
|
// Recalculate client counts to update online status
|
||||||
|
this.dbInbounds.forEach(dbInbound => {
|
||||||
|
const inbound = this.inbounds.find(ib => ib.id === dbInbound.id);
|
||||||
|
if (inbound && this.clientCount[dbInbound.id]) {
|
||||||
|
this.clientCount[dbInbound.id] = this.getClientCounts(dbInbound, inbound);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (this.enableFilter) {
|
||||||
|
this.filterInbounds();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update last online map in real-time
|
// Update last online map in real-time
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,43 @@
|
||||||
<script src="{{ .base_path }}assets/ant-design-vue/antd.min.js"></script>
|
<script src="{{ .base_path }}assets/ant-design-vue/antd.min.js"></script>
|
||||||
<script src="{{ .base_path }}assets/js/util/index.js?{{ .cur_ver }}"></script>
|
<script src="{{ .base_path }}assets/js/util/index.js?{{ .cur_ver }}"></script>
|
||||||
<script src="{{ .base_path }}assets/qrcode/qrious2.min.js?{{ .cur_ver }}"></script>
|
<script src="{{ .base_path }}assets/qrcode/qrious2.min.js?{{ .cur_ver }}"></script>
|
||||||
|
<style>
|
||||||
|
.subscription-page .subscription-link-box {
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 25px 20px 15px 20px;
|
||||||
|
margin-top: -12px;
|
||||||
|
word-break: break-all;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.5;
|
||||||
|
text-align: left;
|
||||||
|
font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
|
||||||
|
transition: all 0.3s;
|
||||||
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark.subscription-page .subscription-link-box {
|
||||||
|
background: rgba(0, 0, 0, 0.2);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark.subscription-page .subscription-link-box:hover {
|
||||||
|
background: rgba(0, 0, 0, 0.3);
|
||||||
|
border-color: rgba(255, 255, 255, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.light.subscription-page .subscription-link-box {
|
||||||
|
background: rgba(0, 0, 0, 0.03);
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.08);
|
||||||
|
color: rgba(0, 0, 0, 0.85);
|
||||||
|
}
|
||||||
|
|
||||||
|
.light.subscription-page .subscription-link-box:hover {
|
||||||
|
background: rgba(0, 0, 0, 0.05);
|
||||||
|
border-color: rgba(0, 0, 0, 0.14);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
{{ template "page/head_end" .}}
|
{{ template "page/head_end" .}}
|
||||||
|
|
||||||
{{ template "page/body_start" .}}
|
{{ template "page/body_start" .}}
|
||||||
|
|
@ -138,27 +175,12 @@
|
||||||
style="margin-bottom: -10px; position: relative; z-index: 2; box-shadow: 0 2px 4px rgba(0,0,0,0.2);">
|
style="margin-bottom: -10px; position: relative; z-index: 2; box-shadow: 0 2px 4px rgba(0,0,0,0.2);">
|
||||||
<span>[[ linkName(link, idx) ]]</span>
|
<span>[[ linkName(link, idx) ]]</span>
|
||||||
</a-tag>
|
</a-tag>
|
||||||
<div @click="copy(link)" style="
|
<div @click="copy(link)" class="subscription-link-box">
|
||||||
cursor: pointer;
|
|
||||||
background: rgba(0, 0, 0, 0.2);
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
||||||
border-radius: 12px;
|
|
||||||
padding: 25px 20px 15px 20px;
|
|
||||||
margin-top: -12px;
|
|
||||||
word-break: break-all;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 13px;
|
|
||||||
line-height: 1.5;
|
|
||||||
text-align: left;
|
|
||||||
font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
|
|
||||||
transition: all 0.3s;
|
|
||||||
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
|
||||||
" onmouseover="this.style.background='rgba(0, 0, 0, 0.3)'; this.style.borderColor='rgba(255, 255, 255, 0.2)'"
|
|
||||||
onmouseout="this.style.background='rgba(0, 0, 0, 0.2)'; this.style.borderColor='rgba(255, 255, 255, 0.1)'">
|
|
||||||
[[ link ]]
|
[[ link ]]
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,9 @@ func (s *XrayService) GetXrayErr() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
err := p.GetErr()
|
err := p.GetErr()
|
||||||
|
if err == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
if runtime.GOOS == "windows" && err.Error() == "exit status 1" {
|
if runtime.GOOS == "windows" && err.Error() == "exit status 1" {
|
||||||
// exit status 1 on Windows means that Xray process was killed
|
// exit status 1 on Windows means that Xray process was killed
|
||||||
|
|
|
||||||
16
x-ui.service.arch
Normal file
16
x-ui.service.arch
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
[Unit]
|
||||||
|
Description=x-ui Service
|
||||||
|
After=network.target
|
||||||
|
Wants=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
EnvironmentFile=-/etc/conf.d/x-ui
|
||||||
|
Environment="XRAY_VMESS_AEAD_FORCED=false"
|
||||||
|
Type=simple
|
||||||
|
WorkingDirectory=/usr/lib/x-ui/
|
||||||
|
ExecStart=/usr/lib/x-ui/x-ui
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=5s
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
57
x-ui.sh
57
x-ui.sh
|
|
@ -229,9 +229,9 @@ reset_user() {
|
||||||
|
|
||||||
read -rp "Do you want to disable currently configured two-factor authentication? (y/n): " twoFactorConfirm
|
read -rp "Do you want to disable currently configured two-factor authentication? (y/n): " twoFactorConfirm
|
||||||
if [[ $twoFactorConfirm != "y" && $twoFactorConfirm != "Y" ]]; then
|
if [[ $twoFactorConfirm != "y" && $twoFactorConfirm != "Y" ]]; then
|
||||||
${xui_folder}/x-ui setting -username ${config_account} -password ${config_password} -resetTwoFactor false >/dev/null 2>&1
|
${xui_folder}/x-ui setting -username "${config_account}" -password "${config_password}" -resetTwoFactor false >/dev/null 2>&1
|
||||||
else
|
else
|
||||||
${xui_folder}/x-ui setting -username ${config_account} -password ${config_password} -resetTwoFactor true >/dev/null 2>&1
|
${xui_folder}/x-ui setting -username "${config_account}" -password "${config_password}" -resetTwoFactor true >/dev/null 2>&1
|
||||||
echo -e "Two factor authentication has been disabled."
|
echo -e "Two factor authentication has been disabled."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -530,20 +530,27 @@ bbr_menu() {
|
||||||
|
|
||||||
disable_bbr() {
|
disable_bbr() {
|
||||||
|
|
||||||
if ! grep -q "net.core.default_qdisc=fq" /etc/sysctl.conf || ! grep -q "net.ipv4.tcp_congestion_control=bbr" /etc/sysctl.conf; then
|
if [[ $(sysctl -n net.ipv4.tcp_congestion_control) != "bbr" ]] || [[ ! $(sysctl -n net.core.default_qdisc) =~ ^(fq|cake)$ ]]; then
|
||||||
echo -e "${yellow}BBR is not currently enabled.${plain}"
|
echo -e "${yellow}BBR is not currently enabled.${plain}"
|
||||||
before_show_menu
|
before_show_menu
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Replace BBR with CUBIC configurations
|
if [ -f "/etc/sysctl.d/99-bbr-x-ui.conf" ]; then
|
||||||
sed -i 's/net.core.default_qdisc=fq/net.core.default_qdisc=pfifo_fast/' /etc/sysctl.conf
|
old_settings=$(head -1 /etc/sysctl.d/99-bbr-x-ui.conf | tr -d '#')
|
||||||
sed -i 's/net.ipv4.tcp_congestion_control=bbr/net.ipv4.tcp_congestion_control=cubic/' /etc/sysctl.conf
|
sysctl -w net.core.default_qdisc="${old_settings%:*}"
|
||||||
|
sysctl -w net.ipv4.tcp_congestion_control="${old_settings#*:}"
|
||||||
|
rm /etc/sysctl.d/99-bbr-x-ui.conf
|
||||||
|
sysctl --system
|
||||||
|
else
|
||||||
|
# Replace BBR with CUBIC configurations
|
||||||
|
if [ -f "/etc/sysctl.conf" ]; then
|
||||||
|
sed -i 's/net.core.default_qdisc=fq/net.core.default_qdisc=pfifo_fast/' /etc/sysctl.conf
|
||||||
|
sed -i 's/net.ipv4.tcp_congestion_control=bbr/net.ipv4.tcp_congestion_control=cubic/' /etc/sysctl.conf
|
||||||
|
sysctl -p
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Apply changes
|
if [[ $(sysctl -n net.ipv4.tcp_congestion_control) != "bbr" ]]; then
|
||||||
sysctl -p
|
|
||||||
|
|
||||||
# Verify that BBR is replaced with CUBIC
|
|
||||||
if [[ $(sysctl net.ipv4.tcp_congestion_control | awk '{print $3}') == "cubic" ]]; then
|
|
||||||
echo -e "${green}BBR has been replaced with CUBIC successfully.${plain}"
|
echo -e "${green}BBR has been replaced with CUBIC successfully.${plain}"
|
||||||
else
|
else
|
||||||
echo -e "${red}Failed to replace BBR with CUBIC. Please check your system configuration.${plain}"
|
echo -e "${red}Failed to replace BBR with CUBIC. Please check your system configuration.${plain}"
|
||||||
|
|
@ -551,20 +558,34 @@ disable_bbr() {
|
||||||
}
|
}
|
||||||
|
|
||||||
enable_bbr() {
|
enable_bbr() {
|
||||||
if grep -q "net.core.default_qdisc=fq" /etc/sysctl.conf && grep -q "net.ipv4.tcp_congestion_control=bbr" /etc/sysctl.conf; then
|
if [[ $(sysctl -n net.ipv4.tcp_congestion_control) == "bbr" ]] && [[ $(sysctl -n net.core.default_qdisc) =~ ^(fq|cake)$ ]]; then
|
||||||
echo -e "${green}BBR is already enabled!${plain}"
|
echo -e "${green}BBR is already enabled!${plain}"
|
||||||
before_show_menu
|
before_show_menu
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enable BBR
|
# Enable BBR
|
||||||
echo "net.core.default_qdisc=fq" | tee -a /etc/sysctl.conf
|
if [ -d "/etc/sysctl.d/" ]; then
|
||||||
echo "net.ipv4.tcp_congestion_control=bbr" | tee -a /etc/sysctl.conf
|
{
|
||||||
|
echo "#$(sysctl -n net.core.default_qdisc):$(sysctl -n net.ipv4.tcp_congestion_control)"
|
||||||
# Apply changes
|
echo "net.core.default_qdisc = fq"
|
||||||
sysctl -p
|
echo "net.ipv4.tcp_congestion_control = bbr"
|
||||||
|
} > "/etc/sysctl.d/99-bbr-x-ui.conf"
|
||||||
|
if [ -f "/etc/sysctl.conf" ]; then
|
||||||
|
# Backup old settings from sysctl.conf, if any
|
||||||
|
sed -i 's/^net.core.default_qdisc/# &/' /etc/sysctl.conf
|
||||||
|
sed -i 's/^net.ipv4.tcp_congestion_control/# &/' /etc/sysctl.conf
|
||||||
|
fi
|
||||||
|
sysctl --system
|
||||||
|
else
|
||||||
|
sed -i '/net.core.default_qdisc/d' /etc/sysctl.conf
|
||||||
|
sed -i '/net.ipv4.tcp_congestion_control/d' /etc/sysctl.conf
|
||||||
|
echo "net.core.default_qdisc=fq" | tee -a /etc/sysctl.conf
|
||||||
|
echo "net.ipv4.tcp_congestion_control=bbr" | tee -a /etc/sysctl.conf
|
||||||
|
sysctl -p
|
||||||
|
fi
|
||||||
|
|
||||||
# Verify that BBR is enabled
|
# Verify that BBR is enabled
|
||||||
if [[ $(sysctl net.ipv4.tcp_congestion_control | awk '{print $3}') == "bbr" ]]; then
|
if [[ $(sysctl -n net.ipv4.tcp_congestion_control) == "bbr" ]]; then
|
||||||
echo -e "${green}BBR has been enabled successfully.${plain}"
|
echo -e "${green}BBR has been enabled successfully.${plain}"
|
||||||
else
|
else
|
||||||
echo -e "${red}Failed to enable BBR. Please check your system configuration.${plain}"
|
echo -e "${red}Failed to enable BBR. Please check your system configuration.${plain}"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue