Skip to content

Eptagone/Ngrok.AgentAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ngrok.AgentAPI

NuGet version ngrok Agent version

Simple library to use the ngrok Agent API. Start and stop tunnels programmatically.

How to use

Step 1: Run ngrok via external console or background service

Before you start using ngrok in your NET project, you need to make sure that ngrok is running. If not, run ngrok using the console, a script, or a background service.

ngrok start --none;

Step 2: Start a new instance of the NgrokAgentClient

In your NET project, create a new instance of NgrokAgentClient as follows.

using Ngrok.AgentAPI

api = new NgrokAgentClient();

Step 3: Call any method

Example:

// List all tunnels and do something
var resource = api.ListTunnels();
if(resource.Tunnels != null){
    foreach (var tunnel in list.Tunnels)
    {
        var tunnelName = tunnel.Name;
        // ...
    }
}

Example:

// Start a new HTTP tunnel on port 5000 using http and https schemes
var configuration = new HttpTunnelConfiguration("MyLocalWebsite", "https://localhost:5000")
{
    Schemes = new string[] { "http", "https" },
    HostHeader = "localhost:5000"
};
var myTunnel = api.StartTunnel(configuration);

See also

To see the list with all the methods, see the official webpage of the ngrok agent API documentation.

License

MIT

About

Simple NET library to use the ngrok Agent API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages