mirror of
				https://github.com/flynx/proxmox-utils.git
				synced 2025-10-31 04:00:08 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			20 lines
		
	
	
		
			300 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			300 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/usr/bin/env bash
 | |
| 
 | |
| CLIENT_IPS=${CLIENT_IPS}
 | |
| 
 | |
| BASE_IP=${CLIENT_IPS/.0\/*}
 | |
| IPs=($(cat /etc/wireguard/clients/* 2> /dev/null \
 | |
| 	| grep Address \
 | |
| 	| cut -d'.' -f 4 \
 | |
| 	| cut -d '/' -f 1 \
 | |
| 	| sort))
 | |
| IPs=${IPs[@]}
 | |
| 
 | |
| i=1
 | |
| while [ "$( echo $IPs | fgrep -w $i )" ] ; do
 | |
| 	i=$(( i + 1 ))
 | |
| done
 | |
| 
 | |
| echo $BASE_IP.$i
 | |
| 
 |