harsh-98 / tunzal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tunzal

Tunzal is a tunneling solution to expose local endpoint outside of the private network. User can use subdomains of tunzal.ml as their public endpoint. The request coming to the public endpoint will be reverse proxied to local services running on their system. This service is similar to ngrok or agro from Cloudflare. Here, we enable users to use their desired subdomain for a premium fee. The premium feature is available for a cost on hr, day, month or year basis.

Here we have tried to move from subscription-based model to usage-based model, by allowing the users to get refunded if they like to discontinue the service or they no longer need it. This is enabled by using the lightning network and its unique feature of enabling micropayment. Currently, in the lightning network, if we want to send the payment to the recipient then firstly recipient has to generate the invoice with the amount specified. Apart from cost specified invoices, the lightning network allows one to generate zero amount invoice. Using zero amount invoice, one can send any amount to the recipient. We have used this to implement a refund mechanism in our service. While generating a secret token for our service, users can specify the zero amount invoice. So, when the user raises the request for a refund, the bitcoin will be transferred back to the user via this invoice. The amount for refund is determined by subtracting usage time in minutes from the total amount(in satoshis) paid for service.

Now for an example: if the user purchases plan A for 1 hr with 60 satoshis. If he uses our service for 20 minutes and raises the request within 60 minutes time frame then he is refunded 40 satoshis. Though if he misses this time frame, no refund is provided. This is because, when generating an invoice, expiration time must be specified. As a result, when generating the zero amount invoice(ZCI) if the user-specified 60*60 seconds then that invoice is only valid for one hr. So, here we assume the expiration of ZCI to be equal to the selected PLAN duration.

About

License:MIT License


Languages

Language:JavaScript 96.6%Language:CSS 2.2%Language:HTML 1.2%