Docs
Example

Examples

Run an http server

btunnel http --port 8000 --key <API_KEY>

Output

  Name: -> John Doe
  Email: -> john.doe@example.com
  TimeOut: -> Never
  Web Monitoring: -> http://localhost:7140

    http   https://abcd.btunnel.co.in -> http://localhost:8000 Fri Feb  9 14:57:02 2024                                             
                                                                                                                                    
    http   2024/02/09 - 20:27:11 | 200 |    2.027519ms |   49.37.161.239 | GET      "/movies"                                       
    http   2024/02/09 - 20:27:11 | 200 |    1.625393ms |   49.37.161.239 | GET      "/latest"                                       
    http   2024/02/09 - 20:27:13 | 200 |    1.237355ms |   49.37.161.239 | GET      "/playerinfo?q=63cfcca5dbe96360f40b2f95"        
    http   2024/02/09 - 20:27:14 | 200 |   61.965661ms |   49.37.161.239 | GET      "/subs?id=63cfcca5dbe96360f40b2f95&episode=0"   
    http   2024/02/09 - 20:27:15 | 206 |  7.155068815s |   49.37.161.239 | GET      "/video?id=652b95e1c7cfaf093da9ad57&episode=0"  
                                                                                                                                    
                                                                                                                                    
  Press q or Esc to exit 

Refer also

  • Http - Serve localhost http server

Run a file server

btunnel file --dir /home/username/ --key <API_KEY>

Output

  Name: -> John Doe                                                                                          
  Email: -> john.doe@example.com                                                                                    
  TimeOut: -> Never                                                                                              
  Web Monitoring: -> http://localhost:7140

    file   https://a9b0885b-7dfb-4195-9bd0-06bd370fa1fc.btunnel.co.in -> /home/username/ Fri Feb  9 15:09:49 2024    

    file   2024/02/09 - 20:39:53 | 200 |     243.566µs |   49.37.161.239 | GET      "/"                          
    file   2024/02/09 - 20:39:53 | 404 |      22.141µs |   49.37.161.239 | GET      "/favicon.ico"               
    file   2024/02/09 - 20:39:56 | 200 |     105.788µs |   49.37.161.239 | GET      "/Documents/"                
    file   2024/02/09 - 20:39:59 | 200 |     129.131µs |   49.37.161.239 | GET      "/Documents/workspace/"      
    file   2024/02/09 - 20:40:05 | 200 |     132.999µs |   49.37.161.239 | GET      "/Documents/workspace/Try/"  


  Press q or Esc to exit 

Refer also

  • File - Serve local directory

Using basic auth

btunnel http --key <API_KEY> --port 8000 --auth uname:password

This will serve a localhost server from port 8000 with a basic auth capability with username uname and password as password. This means, whenever someone tries to access the url https://abcd.btunnel.co.in, they have to authenticate themselves with the above mentioned username and password for the first time.

A screenshot of the authentication is shown below (in Ubuntu 22.04, Firefox browser).

Exposing ssh server

btunnel tcp --key <API_KEY> --port 22

Output

  Name: -> John Doe                                                                     
  Email: -> john.doe@example.com                                                               

    tcp   http://tcp.btunnel.in:[::]:39665 -> http://localhost:22 Fri Feb  9 15:11:09 2024  



  Press q or Esc to exit     

This will make port 22 of your local computer accessible through http://tcp.btunnel.in and port 39665.

To connect to your computer through ssh globally run the following from anywhere -

ssh tcp.btunnel.in -p 39665

You will be prompted to enter username and password and then you will get connected. NOTE: You need to have a ssh server running in port 22 in your local machine in order for this to work. In Windows, you have to enable ssh server separately.

Refer also

  • TCP - Expose TCP port

Registering and using fixed subdomain

btunnel domain --key <API_KEY> --add pqrs
subdomain successfully added

This will register a subdomain pqrs under user username. This is a PRo feature and you can register upto 10 subdomains under your username.

To expose localhost which is running under port 8000, run the following command -

http --port 8000 --key <API_KEY> --subdomain pqrs

This will also work with file server.

Now you can also register a fixed domain such as a https://pqrs.btunnel.co.in under a CNAME record of your own DNS. This gives you the freedom to serve your app under your own domain name and hide btunnel address altogether.

Refer also

  • Domain - Register/deregister subdomain