S
S
stsin2019-11-12 15:13:20
JavaScript
stsin, 2019-11-12 15:13:20

How to write your own vpn extension for Chrome?

Good time everyone! There is a lot of free time + graduation project on any topic!
As a graduation project, I chose a project related to vpn, and in particular, I need to implement an extension for 2-3 browsers that will block ads (there is a list of hosts).
How to approach the implementation of this project?
Do you need to raise your server (let's say node) to vds, and run the left vpn program there and pass requests through it, or is there an easier way? Is it possible to do this with JS alone?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
akyl-kb, 2019-11-12
@stsin

You don't need a VPN to block ads.
Create extension, specify permissions

// Пример
// Перехват запроса, и блокирование если есть совпадения с url
chrome.webRequest.onBeforeRequest.addListener(
        function(details) { return {cancel: true}; },
        {urls: ["*://www.domain.com/*"]},
        ["blocking"]);

Documentation
https://developer.chrome.com/extensions/webRequest

R
Ronald McDonald, 2019-11-12
@Zoominger

No way.
The browser cannot create a VPN connection.

C
CityCat4, 2019-11-12
@CityCat4

Beg your pardon, captain?
VPN and ad blocking are closely related. In addition, all so-called "browser VPNs" are actually just a proxy where the browser comes in to hide the final IP from the site, and the destination IP from the provider. It has nothing to do with real VPNs.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question