diff options
author | Hans Nilsson <[email protected]> | 2013-10-29 15:31:14 +0100 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2013-10-29 15:31:14 +0100 |
commit | f87482d310143b300d1f99783dc7125b4bb23c58 (patch) | |
tree | 19e435f63be17b80cbdd722d232a31f378106460 /lib/ssh/src/ssh.erl | |
parent | bd2e7c90557b19ce9005fe03f0ded57efe1bbebc (diff) | |
parent | dcd763ba7c4805361f435cc82d98335c2a59e1d1 (diff) | |
download | otp-f87482d310143b300d1f99783dc7125b4bb23c58.tar.gz otp-f87482d310143b300d1f99783dc7125b4bb23c58.tar.bz2 otp-f87482d310143b300d1f99783dc7125b4bb23c58.zip |
Merge branch 'maint'
Diffstat (limited to 'lib/ssh/src/ssh.erl')
-rw-r--r-- | lib/ssh/src/ssh.erl | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/ssh/src/ssh.erl b/lib/ssh/src/ssh.erl index 7d5478c3f6..80d20abbbd 100644 --- a/lib/ssh/src/ssh.erl +++ b/lib/ssh/src/ssh.erl @@ -28,6 +28,8 @@ -export([start/0, start/1, stop/0, connect/3, connect/4, close/1, connection_info/2, channel_info/3, daemon/1, daemon/2, daemon/3, + peername/1, + sockname/1, stop_listener/1, stop_listener/2, stop_daemon/1, stop_daemon/2, shell/1, shell/2, shell/3]). @@ -245,6 +247,28 @@ shell(Host, Port, Options) -> end. %%-------------------------------------------------------------------- +%% Function: peername(ConnectionRef) -> {ok, {Host,Port}} +%% | {error,Error} +%% +%% Description: Returns the peer address of the connection +%%-------------------------------------------------------------------- +peername(ConnectionRef) -> + [{peer, {_Name,{IP,Port}}}] = + ssh_connection_manager:connection_info(ConnectionRef, [peer]), + {ok, {IP,Port}}. + +%%-------------------------------------------------------------------- +%% Function: sockname(ConnectionRef) -> {ok, {Host,Port}} +%% | {error,Error} +%% +%% Description: Returns the local address of the connection +%%-------------------------------------------------------------------- +sockname(ConnectionRef) -> + [{sockname, Result}] = + ssh_connection_manager:connection_info(ConnectionRef, [sockname]), + Result. + +%%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- fix_idle_time(SshOptions) -> |