X-Git-Url: https://git.distorted.org.uk/~mdw/tripe/blobdiff_plain/f40cd7f1993f1afb3e24986773b14afd7d24555d..5251b9bbd6fc17db7999e1ec3a53ee0b1597aae8:/mon/tripemon.in diff --git a/mon/tripemon.in b/mon/tripemon.in index 6b7076b5..0404e21e 100644 --- a/mon/tripemon.in +++ b/mon/tripemon.in @@ -1066,7 +1066,7 @@ class AddPeerDialog (MyDialog): 5)) me.l_tunnel = table.labelled('Tunnel', combo_box_text(), newlinep = True, width = 3) - me.tuns = conn.tunnels() + me.tuns = ['(Default)'] + conn.tunnels() for t in me.tuns: me.l_tunnel.append_text(t) me.l_tunnel.set_active(0) @@ -1082,6 +1082,9 @@ class AddPeerDialog (MyDialog): tickybox_sensitivity(me.c_keepalive, me.e_keepalive) table.pack(me.e_keepalive, width = 3) + me.c_cork = G.CheckButton('Cork') + table.pack(me.c_cork, newlinep = True, width = 4, xopt = G.FILL) + me.c_mobile = G.CheckButton('Mobile') table.pack(me.c_mobile, newlinep = True, width = 4, xopt = G.FILL) @@ -1111,6 +1114,7 @@ class AddPeerDialog (MyDialog): keepalive = (me.c_keepalive.get_active() and me.e_keepalive.get_text() or None), tunnel = t and me.tuns[t] or None, + cork = me.c_cork.get_active() or None, mobile = me.c_mobile.get_active() or None, key = (me.c_peerkey.get_active() and me.e_peerkey.get_text() or None), @@ -1230,7 +1234,7 @@ def xlate_time(t): return '%04d:%02d:%02d %02d:%02d:%02d (%.1f %s ago)' % \ (YY, MM, DD, hh, mm, ss, ago, unit) def xlate_bytes(b): - """Translate a number of bytes into something a human might want to read.""" + """Translate a raw byte count into something a human might want to read.""" suff = 'B' b = int(b) for s in 'KMG': @@ -1252,21 +1256,40 @@ statsxlate = \ ('ip-bytes-in', xlate_bytes), ('ip-bytes-out', xlate_bytes)] +def format_stat(format, dict): + if callable(format): return format(dict) + else: return format % dict + ## How to lay out the stats dialog. Format is (LABEL, FORMAT): LABEL is ## the label to give the entry box; FORMAT is the format string to write into ## the entry. -statslayout = \ - [('Start time', '%(start-time)s'), - ('Private key', '%(current-key)s'), - ('Diffie-Hellman group', +cryptolayout = \ + [('Diffie-Hellman group', '%(kx-group)s ' '(%(kx-group-order-bits)s-bit order, ' '%(kx-group-elt-bits)s-bit elements)'), - ('Cipher', - '%(cipher)s (%(cipher-keysz)s-bit key, %(cipher-blksz)s-bit block)'), - ('Mac', '%(mac)s (%(mac-keysz)s-bit key, %(mac-tagsz)s-bit tag)'), - ('Hash', '%(hash)s (%(hash-sz)s-bit output)'), - ('Last key-exchange', '%(last-keyexch-time)s'), + ('Bulk crypto transform', + '%(bulk-transform)s (%(bulk-overhead)s byte overhead)'), + ('Data encryption', lambda d: '%s (%s; %s)' % ( + d['cipher'], + '%d-bit key' % (8*int(d['cipher-keysz'])), + d.get('cipher-blksz', '0') == '0' + and 'stream cipher' + or '%d-bit block' % (8*int(d['cipher-blksz'])))), + ('Message authentication', lambda d: '%s (%s; %s)' % ( + d['mac'], + d.get('mac-keysz') is None + and 'one-time MAC' + or '%d-bit key' % (8*int(d['mac-keysz'])), + '%d-bit tag' % (8*int(d['mac-tagsz'])))), + ('Hash', lambda d: '%s (%d-bit output)' % + (d['hash'], 8*int(d['hash-sz'])))] + +statslayout = \ + [('Start time', '%(start-time)s'), + ('Private key', '%(current-key)s')] + \ + cryptolayout + \ + [('Last key-exchange', '%(last-keyexch-time)s'), ('Last packet', '%(last-packet-time)s'), ('Packets in/out', '%(packets-in)s (%(bytes-in)s) / %(packets-out)s (%(bytes-out)s)'), @@ -1355,7 +1378,7 @@ class PeerWindow (TrivialWindow): stat[s] = trans(stat[s]) stat.update(me.peer.__dict__) for label, format in statslayout: - me.e[label].set_text(format % stat) + me.e[label].set_text(format_stat(format, stat)) GL.timeout_add(1000, lambda: me.cr.switch() and False) me.cr.parent.switch() me.cr = None @@ -1405,7 +1428,7 @@ class CryptoInfo (TrivialWindow): (crypto['kx-group'], int(crypto['kx-group-order-bits']), int(crypto['kx-group-elt-bits'])), - len = 32) + len = 42) table.info('Data encryption', '%s (%d-bit key; %s)' % (crypto['cipher'],