reresolve-dns: use $EPOCHSECONDS instead of $(date +%s)
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
b906ecb614
commit
1fd9570839
1 changed files with 1 additions and 1 deletions
|
@ -16,7 +16,7 @@ INTERFACE="${BASH_REMATCH[1]}"
|
||||||
process_peer() {
|
process_peer() {
|
||||||
[[ $PEER_SECTION -ne 1 || -z $PUBLIC_KEY || -z $ENDPOINT ]] && return 0
|
[[ $PEER_SECTION -ne 1 || -z $PUBLIC_KEY || -z $ENDPOINT ]] && return 0
|
||||||
[[ $(wg show "$INTERFACE" latest-handshakes) =~ ${PUBLIC_KEY//+/\\+}\ ([0-9]+) ]] || return 0
|
[[ $(wg show "$INTERFACE" latest-handshakes) =~ ${PUBLIC_KEY//+/\\+}\ ([0-9]+) ]] || return 0
|
||||||
(( ($(date +%s) - ${BASH_REMATCH[1]}) > 135 )) || return 0
|
(( ($EPOCHSECONDS - ${BASH_REMATCH[1]}) > 135 )) || return 0
|
||||||
wg set "$INTERFACE" peer "$PUBLIC_KEY" endpoint "$ENDPOINT"
|
wg set "$INTERFACE" peer "$PUBLIC_KEY" endpoint "$ENDPOINT"
|
||||||
reset_peer_section
|
reset_peer_section
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue