diff --git a/TODO.md b/TODO.md index 3760c97..c2d29c1 100644 --- a/TODO.md +++ b/TODO.md @@ -6,5 +6,3 @@ TODO - Remove the legacy package by folding all of its logic into the current package - Add an RPC test - Implement support for AgentSession.ID() -- Endpoint.ID() should return the endpoint's API resource identifier but right now it just returns a random unique identifier unrelated to the API resource -- Endpoint.Wait() which can be used to wait until an endpoint stops \ No newline at end of file diff --git a/endpoint.go b/endpoint.go index f3d9aa6..83ed0b8 100644 --- a/endpoint.go +++ b/endpoint.go @@ -31,6 +31,9 @@ type Endpoint interface { // Done returns a channel that is closed when the endpoint stops. Done() <-chan struct{} + // Wait blocks until the endpoint stops. + Wait() + // ID returns the unique endpoint identifier assigned by the ngrok cloud service. ID() string @@ -86,6 +89,10 @@ func (e *baseEndpoint) Done() <-chan struct{} { return e.doneChannel } +func (e *baseEndpoint) Wait() { + <-e.doneChannel +} + func (e *baseEndpoint) ID() string { return e.id }