Skip to content

Commit c4d18ab

Browse files
authored
Merge pull request #94 from nathanl/docs-for-up-and-down
Add docs for up/1 and down/1
2 parents 9dbd022 + 086429f commit c4d18ab

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/bypass.ex

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ defmodule Bypass do
99

1010
defstruct pid: nil, port: nil
1111

12+
@typedoc """
13+
Represents a Bypass server process
14+
"""
15+
@type t :: %__MODULE__{pid: pid, port: non_neg_integer}
16+
1217
import Bypass.Utils
1318
require Logger
1419

@@ -98,9 +103,19 @@ defmodule Bypass do
98103
end
99104
end
100105

106+
@doc """
107+
Re-opens the TCP socket on the same port.
108+
Blocks until the operation is complete.
109+
"""
110+
@spec up(Bypass.t()) :: :ok | {:error, :already_up}
101111
def up(%Bypass{pid: pid}),
102112
do: Bypass.Instance.call(pid, :up)
103113

114+
@doc """
115+
Closes the TCP socket.
116+
Blocks until the operation is complete.
117+
"""
118+
@spec down(Bypass.t()) :: :ok | {:error, :already_down}
104119
def down(%Bypass{pid: pid}),
105120
do: Bypass.Instance.call(pid, :down)
106121

0 commit comments

Comments
 (0)