Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Rikpat committed Jun 11, 2024
1 parent 9e27dda commit 9eb1052
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 12 deletions.
42 changes: 31 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ Possible use-cases include running in a startup script for wireguard service, or

Because PureVPN doesn't expose their API or have any API keys for customers, I had to reverse engineer the whole manual process and use a headless browser to get the file.

>>> Disclaimer:
>>>
>>> It's first goal was to be a fully fledged CLI tool for doing anything related to PureVPN's WireGuard integration, and as a learning project for Go CLI program for me. I've since moved on and don't have as much time so I've just released the *full* command that does the whole thing. I may someday finish other goals. They include:
>>>
>>> - Login command - logs user in using username + password ✅
>>> - Update command - creates or updates wireguard configuration file ✅
>>> - Config command - select subscription or server using interactive console gui - including filtering servers by supported protocols
>>> - Config file - persisiting configuration for subsequent uses ✅
>>> - Storing user cookies to prevent having to log in every time and persisting username/password in config file - partially done, the cookies should have a long expiration date but sometimes fail randomly
>>> - Env variables for config - useful for docker container and full command - see docker section ✅
>>> - Docker container ✅
> Disclaimer:
>
> It's first goal was to be a fully fledged CLI tool for doing anything related to PureVPN's WireGuard integration, and as a learning project for Go CLI program for me. I've since moved on and don't have as much time so I've just released the *full* command that does the whole thing. I may someday finish other goals. They include:
>
> - Login command - logs user in using username + password ✅
> - Update command - creates or updates wireguard configuration file ✅
> - Config command - select subscription or server using interactive console gui - including filtering servers by supported protocols
> - Config file - persisiting configuration for subsequent uses ✅
> - Storing user cookies to prevent having to log in every time and persisting username/password in config file - partially done, the cookies should have a long expiration date but sometimes fail randomly
> - Env variables for config - useful for docker container and full command - see docker section ✅
> - Docker container ✅
## Docker

Expand All @@ -39,3 +39,23 @@ Env variables:
| PUREVPN_WIREGUARD_FILE | Output file to generate | | wg0.conf (/out/wg0.conf in docker) | wireguardFile |


## Running locally

Create config.yml file or environment variables with values as described in table in docker section. At minimum you have to specify *username*, *password*, *server.country* and *server.city*. Then run `purevpnwg full`.

Example yaml file:

```yaml
username: email@example.com
password: <password>
server: # Set to a server you want to connect to
country: US
city: 2762
subscription:
username: purevpn********* # If you have multiple subscriptions in your account
wireguardFile: wg0-p2p.conf # If you want to have a different file location
```
> You can get server country and city id in multiple ways, for example in configuration response in your browser (taken from manual configuration page):
>
> ![server id](docs/images/serverID.png)
1 change: 0 additions & 1 deletion cmd/full.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func (r *FullCmd) Run(ctx *Context) error {

if ctx.Config.Debug {
fmt.Println("Successfully got subscription password")
fmt.Printf("ctx.Config: %v\n", ctx.Config)
}

server, err := purevpn.GetWireguardServer(page, ctx.Config, token[0].Value)
Expand Down
Binary file added docs/images/serverID.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions pkg/purevpn/browser.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ func GetWireguardServer(page *rod.Page, config *util.Config, token string) (stri
params.Add("sClientPublicKey", publicKey)
params.Add("iCityId", config.Server.City)

if config.Debug {
fmt.Printf("Requesting wireguard server with params: %v\n", params)
}

page.MustNavigate(_BASE_URL).MustWaitNavigation()
res, err := page.Eval(`
async (body, authorization, privateKey) => {
Expand Down

0 comments on commit 9eb1052

Please sign in to comment.