Hi guys, is there any possible to get current-endpoint-address in peer of wireguard, I literally need this address
it seems can’t use the “get” to get this value
does anyone has any means?
print works for both.
But get doesn’t, neither for endpoint-address nor current-endpoint-address.
[xyz@RB5009_KT] /interface/wireguard/peers> print detail
Flags: X - disabled; D - dynamic
0 interface=WGWork public-key=“”
endpoint-address=.sn.mynetname.net endpoint-port= current-endpoint-address=
current-endpoint-port= allowed-address=10.255.250.0/24 persistent-keepalive=25s rx=47.1MiB tx=60.3MiB
last-handshake=44s
[xyz@RB5009_KT] /interface/wireguard/peers> get value-name=current-endpoint-address number=0
[xyz@RB5009_KT] /interface/wireguard/peers> get value-name=endpoint-address number=0
[xyz@RB5009_KT] /interface/wireguard/peers>
Odd …
Best to shoot a mail to support.
Ah wait …
Try this as alternative:
/interface/wireguard/peers> print proplist=current-endpoint-address
(
[xyz@RB5009_KT] /interface/wireguard/peers> get value-name=current-endpoint-address number=0
this command, if do not do any error, do not print anything if you do not use :put…
and at least bust be :put [get 0 current-endpoint-address]
)
Hmmm … nice one !
[xyz@RB5009_KT] > interf wireg peer
[xyz@RB5009_KT] /interface/wireguard/peers> :put [get value-name=current-endpoint-address number=0]
AA.BBB.CCC.DDD
and this one is also effective and standardized
/interface/wireguard/peers/get [find interface=wireguard1] current-endpoint-address;
If the interface name is already known, simply…
/interface wireguard peers get wireguard1 current-endpoint-address
If the name is from a variable, just…
/interface wireguard peers get $iname current-endpoint-address
On all 3 cases on this post, wireguard1 must already exist.
So, for prevent errors, first must be checked if [find where interface=wireguard1] give any result.
:if ([:len [find where interface=wireguard1]] = 1) do={ … }