X-Git-Url: https://git.distorted.org.uk/~mdw/tripe/blobdiff_plain/91ac51aa6d078ba287972988fc9cca6593bfbe8f..8f3f3ac7bc6903f29c6803ca29c14f9bfe4d2d68:/svc/connect.in diff --git a/svc/connect.in b/svc/connect.in index 5f8940e3..0031d36f 100644 --- a/svc/connect.in +++ b/svc/connect.in @@ -130,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 = {} @@ -241,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__':