1
0

peerStats 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. import sys
  14. import getopt
  15. import cjdnsadmin.adminTools as at
  16. def main():
  17. human_readable=False
  18. try:
  19. opts, args = getopt.getopt(sys.argv[1:], "h" , ["humanreadable", "help"])
  20. except getopt.GetoptError, e:
  21. print(str(e))
  22. print()
  23. usage()
  24. sys.exit(1)
  25. for o, a in opts:
  26. if o in ("-h", "--humanreadable"): human_readable=True
  27. if o == ("--help"):
  28. usage()
  29. sys.exit(0)
  30. cjdns=at.anonConnect()
  31. at.peerStats(cjdns,verbose=True,human_readable=human_readable);
  32. cjdns.disconnect()
  33. def usage():
  34. print("usage: peerStats [-h]")
  35. print("")
  36. print(" -h, --humanreadable human readable output of transmitted bytes")
  37. print(" --help this list")
  38. print("")
  39. main()