sessionStats 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/usr/bin/env python2
  2. # You may redistribute this program and/or modify it under the terms of
  3. # the GNU General Public License as published by the Free Software Foundation,
  4. # either version 3 of the License, or (at your option) any later version.
  5. #
  6. # This program is distributed in the hope that it will be useful,
  7. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. # GNU General Public License for more details.
  10. #
  11. # You should have received a copy of the GNU General Public License
  12. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  13. from cjdnsadmin.cjdnsadmin import connectWithAdminInfo;
  14. from cjdnsadmin.publicToIp6 import PublicToIp6_convert;
  15. cjdns = connectWithAdminInfo();
  16. handles = [];
  17. i = 0;
  18. while True:
  19. resp = cjdns.SessionManager_getHandles(i)
  20. for h in resp['handles']:
  21. handles.append(h);
  22. if not 'more' in resp:
  23. break
  24. i += 1
  25. for h in handles:
  26. r = cjdns.SessionManager_sessionStats(h);
  27. print(r['ip6'] + ' ' + r['publicKey'] +
  28. ' v' + str(r['version']) +
  29. ' dup ' + str(r['duplicates']) +
  30. ' los ' + str(r['lostPackets']) +
  31. ' oor ' + str(r['receivedOutOfRange']) +
  32. ' ' + r['state'].replace('CryptoAuth_', '') + ' ' + str(h));