diff options
author | Loïc Hoguin <[email protected]> | 2012-11-12 19:25:05 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2012-11-12 19:25:05 +0100 |
commit | eec2e40258becbd7fcafcbf6534890a51851f07d (patch) | |
tree | 3062499872d60045a337540aafee51eceae0a4b8 /src | |
parent | c3133bfbc324fbb9ac26ab689cd41dc362ad7c05 (diff) | |
download | ranch-eec2e40258becbd7fcafcbf6534890a51851f07d.tar.gz ranch-eec2e40258becbd7fcafcbf6534890a51851f07d.tar.bz2 ranch-eec2e40258becbd7fcafcbf6534890a51851f07d.zip |
Allow IP tuples and more when connecting transports
Diffstat (limited to 'src')
-rw-r--r-- | src/ranch_ssl.erl | 5 | ||||
-rw-r--r-- | src/ranch_tcp.erl | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/ranch_ssl.erl b/src/ranch_ssl.erl index 35f9c32..a70f948 100644 --- a/src/ranch_ssl.erl +++ b/src/ranch_ssl.erl @@ -118,9 +118,10 @@ accept(LSocket, Timeout) -> %% @private Experimental. Open a connection to the given host and port number. %% @see ssl:connect/3 %% @todo Probably filter Opts? --spec connect(string(), inet:port_number(), any()) +-spec connect(inet:ip_address() | inet:hostname(), + inet:port_number(), any()) -> {ok, inet:socket()} | {error, atom()}. -connect(Host, Port, Opts) when is_list(Host), is_integer(Port) -> +connect(Host, Port, Opts) when is_integer(Port) -> ssl:connect(Host, Port, Opts ++ [binary, {active, false}, {packet, raw}]). diff --git a/src/ranch_tcp.erl b/src/ranch_tcp.erl index 18322db..3c918ea 100644 --- a/src/ranch_tcp.erl +++ b/src/ranch_tcp.erl @@ -83,9 +83,10 @@ accept(LSocket, Timeout) -> %% @private Experimental. Open a connection to the given host and port number. %% @see gen_tcp:connect/3 %% @todo Probably filter Opts? --spec connect(string(), inet:port_number(), any()) +-spec connect(inet:ip_address() | inet:hostname(), + inet:port_number(), any()) -> {ok, inet:socket()} | {error, atom()}. -connect(Host, Port, Opts) when is_list(Host), is_integer(Port) -> +connect(Host, Port, Opts) when is_integer(Port) -> gen_tcp:connect(Host, Port, Opts ++ [binary, {active, false}, {packet, raw}]). |