Traffic Limit in GB

This commit is contained in:
Whispering Wind
2024-07-05 14:21:27 +03:30
committed by GitHub
parent b8039753c2
commit 7759c9fca3

View File

@ -397,7 +397,10 @@ add_user() {
fi fi
done done
read -p "Enter the traffic limit (in bytes): " traffic read -p "Enter the traffic limit (in GB): " traffic_gb
# Convert GB to bytes (1 GB = 1073741824 bytes)
traffic=$((traffic_gb * 1073741824))
read -p "Enter the expiration days: " expiration_days read -p "Enter the expiration days: " expiration_days
password=$(pwgen -s 32 1) password=$(pwgen -s 32 1)
creation_date=$(date +%Y-%m-%d) creation_date=$(date +%Y-%m-%d)
@ -415,6 +418,7 @@ add_user() {
echo -e "\033[0;32mUser $username added successfully.\033[0m" echo -e "\033[0;32mUser $username added successfully.\033[0m"
} }
# Function to remove a user from the configuration # Function to remove a user from the configuration
remove_user() { remove_user() {
if [ -f "/etc/hysteria/users/users.json" ]; then if [ -f "/etc/hysteria/users/users.json" ]; then