X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/tripe/blobdiff_plain/6411163d48434575eaf49463e056e971a2fba16a..1b9a78583fbff3967b91e128dd7f57fcbcdc8db9:/svc/connect.in diff --git a/svc/connect.in b/svc/connect.in index 0ae539f5..0031d36f 100644 --- a/svc/connect.in +++ b/svc/connect.in @@ -92,6 +92,7 @@ def addpeer(peer, addr): tunnel = peer.get('tunnel', None), keepalive = peer.get('keepalive', None), key = peer.get('key', None), + priv = peer.get('priv', None), mobile = peer.get('mobile', 'nil') in booltrue, cork = peer.get('cork', 'nil') in booltrue, *addr) @@ -129,6 +130,16 @@ def cmd_info(name): for i in items: T.svcinfo('%s=%s' % (i, peer.get(i))) +def cmd_userpeer(user): + """ + userpeer USER: Report the peer name for the named user. + """ + try: + peer = CDB.init(opts.cdb)['U' + user] + except KeyError: + raise T.TripeJobError('unknown-user', user) + T.svcinfo(peer) + ## Dictionary mapping challenges to waiting passive-connection coroutines. chalmap = {} @@ -240,7 +251,8 @@ service_info = [('connect', VERSION, { 'passive': (1, None, '[OPTIONS] USER', cmd_passive), 'active': (1, 1, 'PEER', cmd_active), 'info': (1, 1, 'PEER', cmd_info), - 'list': (0, 0, '', cmd_list) + 'list': (0, 0, '', cmd_list), + 'userpeer': (1, 1, 'USER', cmd_userpeer) })] if __name__ == '__main__':