key-networks / ztncui

ZeroTier network controller UI
GNU General Public License v3.0
1.51k stars 227 forks source link

Multiple peer latency lines on some members #91

Closed guideloom closed 1 year ago

guideloom commented 2 years ago

For some of the members, there are multiple peer lines.. like LOTS of them. Can the duplicate lines be removed?

image

image

guideloom commented 2 years ago

I think this is an issue with zerotier itself. I've opened the following there: https://github.com/zerotier/ZeroTierOne/issues/1654

guideloom commented 2 years ago

zerotier have confirmed this is a bug. As a result they are going to change the json output of "zerotier-cli listpeers -j" to resolve this issue.

I don't know if that change is going to affect this project, but in the interests of a "heads up".. you may want to view the issue listed above and followup once the code changes are pushed out.

zbljz98 commented 2 years ago

I edit the src/views/network_detail.pug file and starting from 136 rows. I delete the first 'if' sentence and add another line span() #{peer.paths[0].address}

then, In my server, I just got one IP address.

guideloom commented 2 years ago

Can you post a patch file for this? See here on how to create one: https://www.thegeekstuff.com/2014/12/patch-command-examples/

zbljz98 commented 2 years ago
--- edited file
+++ original file
@@ -133,10 +133,15 @@
               else
                 span(style='color: red;') OFFLINE
             td
-              span() #{peer.paths[0].address}
-              if (peer.latency != -1)
-                br
-                | (#{peer.latency} ms)
+              if (peer)
+                each path in peer.paths
+                  - const [ip, port] = path.address.split('/');
+                  = ip
+                  span(style='color: gray;') /#{port}
+                  = ' '
+                if (peer.latency != -1)
+                  br
+                  | (#{peer.latency} ms)
         else
           .alert.alert-info
             strong There are no members on this network - invite users to join #{network.nwid}
zbljz98 commented 2 years ago

Can you post a patch file for this? See here on how to create one: https://www.thegeekstuff.com/2014/12/patch-command-examples/

sorry. I find a bug when one peer's status is offline, the website will not work. so, I put a correct code file.

--- tmp/src/views/network_detail.pug    2022-05-13 08:16:00.317863121 +0800
+++ ztncui/src/views/network_detail.pug 2022-05-15 09:36:26.342241570 +0800
@@ -133,12 +133,8 @@
               else
                 span(style='color: red;') OFFLINE
             td
-              if (peer)
-                each path in peer.paths
-                  - const [ip, port] = path.address.split('/');
-                  = ip
-                  span(style='color: gray;') /#{port}
-                  = ' '
+              if ( peer )
+                span() #{peer.paths[0].address}
                 if (peer.latency != -1)
                   br
                   | (#{peer.latency} ms)
showyoulove1990 commented 1 year ago

这个到底有什么办法可以去除掉重复的啊?看着太难受了,虽然不影响使用

MANKUD commented 1 year ago

@guideloom Try installing this version manually on the server as I have no issue with it and I also tried on a fresh VM and found no such issues that you have mentioned above.

image

MANKUD commented 1 year ago

@guideloom Try installing this version manually on the server as I have no issue with it and I also tried on a fresh VM and found no such issues that you have mentioned above.

image

Also when I tried the latest version of zerotier I had the same issue that you mentioned above.

torkcm commented 1 year ago

This is also happening on my server as well with zerotier v1.10.1.

I reverted back to v1.6.5 as mentioned in the thread and so far I'm not seeing duplicates. I will report back as it does take a bit for the dupes to show.

guideloom commented 1 year ago

This is 95% a problem with zerotier listpeers in json format returning many duplicate entries as per https://github.com/zerotier/ZeroTierOne/issues/1654; waiting on the zerotier folks to resolve this.

In the meantime, perhaps the ztncui folks can filter the output of that information grab to remove duplicates before displaying them in the web interface?

torkcm commented 1 year ago

Going back to zerotier v1.6.5 does fix the issue. Once zerotier fixes the bug in the newer versions I will try it out, but for now this seems like a temporary workaround.

TkYu commented 1 year ago

My temp solution: add if (path.preferred == true) after each path in peer.paths in views/network_detail.pug file

Update: There are multiple preferred items in current version(1.10.2), we can add a break if we don't need it.

Final code looks like this: image

If you are using ztncui 0.8.6 x86_64 version and don't want repack executable file, just replace /opt/key-networks/ztncui/ztncui with ztncui.tar.gz (don't forget extract, chown to ztncui user and gives it execute permission)

pjv commented 1 year ago

@TkYu can you show the code you are using in views/network)detail.pug?

pjv commented 1 year ago

see: https://github.com/zerotier/ZeroTierOne/issues/1654#issuecomment-1431590985

pjv commented 1 year ago

Fixed for me by updating to zerotier one 1.10.3

key-networks commented 1 year ago

https://twitter.com/key_networks/status/1629718250375487490?s=20

squromiv commented 1 year ago

Fixed for me by updating to zerotier one 1.10.3

key-networks closed this as completed

Still have the issue. 1

2

key-networks commented 1 year ago

v0.8.12 of #ztncui is available for testing. The DEB package is here: https://key-networks.s3.us-west-1.amazonaws.com/deb/ztncui/1/x86_64/ztncui_0.8.12_amd64.deb

The RPM can be installed with: sudo dnf --enablerepo=ztncui-testing upgrade ztncui

This includes the fix from @TkYu .

Please let me know if this resolves the issue.

key-networks commented 1 year ago

Please try this one after upgrading to ZT 1.10.4:

For DEB: https://key-networks.s3.us-west-1.amazonaws.com/deb/ztncui/1/x86_64/ztncui_0.8.13_amd64.deb

For RPM: sudo dnf --enablerepo=ztncui-testing upgrade ztncui

noodlenoggan commented 1 year ago

Confirmed multiple peer latency entries fixed on ZT 1.10.4 with ZTNCUI 0.8.13

key-networks commented 1 year ago

Ah, that's great - thanks for confirming that @noodlenoggan !

TcDhlPro commented 1 year ago

@key-networks I tried to modify the code in the file by myself, and compile, install and run, the test result is perfect image image

key-networks commented 1 year ago

That's great, @TcDhlPro !