mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-09-06 01:30:48 +03:00
Edit client
This commit is contained in:
parent
f84055bc21
commit
f9bb6cfe7d
6 changed files with 150 additions and 12 deletions
14
util/util.go
14
util/util.go
|
@ -173,7 +173,7 @@ func GetIPFromCIDR(cidr string) (string, error) {
|
|||
}
|
||||
|
||||
// GetAllocatedIPs to get all ip addresses allocated to clients and server
|
||||
func GetAllocatedIPs() ([]string, error) {
|
||||
func GetAllocatedIPs(ignoreClientID string) ([]string, error) {
|
||||
allocatedIPs := make([]string, 0)
|
||||
|
||||
// initialize database directory
|
||||
|
@ -211,12 +211,14 @@ func GetAllocatedIPs() ([]string, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
for _, cidr := range client.AllocatedIPs {
|
||||
ip, err := GetIPFromCIDR(cidr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
if client.ID != ignoreClientID {
|
||||
for _, cidr := range client.AllocatedIPs {
|
||||
ip, err := GetIPFromCIDR(cidr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
allocatedIPs = append(allocatedIPs, ip)
|
||||
}
|
||||
allocatedIPs = append(allocatedIPs, ip)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue