subspacecommunity / subspace

A fork of the simple WireGuard VPN server GUI community maintained
MIT License
1.8k stars 131 forks source link

Adding a status page? #68

Open BankaiNoJutsu opened 4 years ago

BankaiNoJutsu commented 4 years ago

Is your feature request related to a problem? Please describe. No problem, just an improvement idea

Describe the solution you'd like Adding a status page, as i did on my fork long ago: https://github.com/BankaiNoJutsu/subspace

Describe alternatives you've considered Rewriting the whole thing, but why reinvent the wheel?

Additional context I find it handy so see the transferred amount of data, handshake etc. I had no docker support tho. Should i work on a pull to implement this here, trying to just add the status page?

jack1902 commented 4 years ago

@BankaiNoJutsu Must admit, like the Dark colours on your fork plus the wireguard logo! If you open a PR to add the status page of each Client (Assuming this is only seeable by an Admin?) Then we can review and get it merged into this fork which has blown up after it landed on the hacker news website https://news.ycombinator.com/item?id=23243248

gavinelder commented 4 years ago

@BankaiNoJutsu again really like your theme.

BankaiNoJutsu commented 4 years ago

@jack1902 @gavinelder allright, I'll work on a pull for this. In two steps if okay. First one to get the theme sorted out, second for the status page (so far it was accessible to all users, but i will see to add it to a per user basis. This was due to the fact i use it on a personal/family level and never thought of implementing it in a different way).

Edit: i had also added basic dyndns (duckdns) and routing selection on creation of profile, qr code/download as well as web based server setting editing. Let me know in what you're interested to implement.

jack1902 commented 4 years ago

@BankaiNoJutsu appreciate the effort!

If possible can we do it in seperate Pull requests:

Happy to assist where possible (I'm an engineer by trade, normally Python but current learning golang very heavily and hoping to open source a very much needed feature for wireguard)

gavinelder commented 4 years ago

Awesome , my front end skills are sketchy at best so any help tidying up the UI would be greatly appreciated.

I intent to extend the admin interface to move the config out of flags, so if you would like to pair on other ideas it would be Amazing.

A toggle dark theme is one of those features that people love.

jack1902 commented 4 years ago

@BankaiNoJutsu Do you want any assistance in pulling this in?

BankaiNoJutsu commented 4 years ago

@jack1902 yes! That would be great! I am out of time these days, so help is appreciated :)

jack1902 commented 4 years ago

Awesome, possible to guide through the changes?

Is the status page a new page and what functions in golang?

How did you do the theme (it's so much nicer)

BankaiNoJutsu commented 4 years ago

It is a new page yes, you can see it under "templates" folder. web, main and handlers.go need also some changes to add the page. You can check my commits, even if messy, it should hopefully be understandable.

It's a new handler, with some functions added (byte conversion etc), hence why there are new dependencies in my fork, for the status page, and for the qr display.

For the theme, i think most is in this commit: https://github.com/BankaiNoJutsu/subspace/commit/6c4204951d0953cc0dc98434a19c5c0a604ec30c

I will see if next week i find some time to start on this, in the meantime you can ask me if you have questions.

Cheers!

jack1902 commented 4 years ago

Will do, once #75 is merged then i will create a branch to start this work (master is currently broken). The status page will be useful for sure

BankaiNoJutsu commented 4 years ago

Hey! Just wanted to update, i am finalizing, a few things left to do, but should be ready within a few hours/days, depends :).

There a quite a lot of changes, so i will build a docker image so you guys can try it before we even consider merging the changes, is that okay?

EDIT: in the end the change includes the theme and the status page, as well as structural changes. Which is why i think it is safer to let you try it out first

BankaiNoJutsu commented 4 years ago

@jack1902 @gavinelder hey, would you guys be able to test my fork? I have issues with docker somehow... I can run the binary locally just fine, but docker won't find the "wg" bin when running the entrypoint.sh...

It should normally work, but i need people to test, and possibly report issues.

Please note that you can run it locally this way: sudo go generate -v -x && sudo go build sudo ./subspace --debug --datadir=/etc --http-insecure=true --letsencrypt=false --http-host localhost

I have all my data in /etc/wireguard with:

Some paths are still hardcoded until we/I can fix that... So for now, it's only working using datadir=/etc... sorry...

Oh and you can still try my dev branch, which is an old master copy. The idea there was to have an admin server settings section (in the top right corner) where you could:

jack1902 commented 4 years ago

easy one to change, literally change back the /etc/wireguard to /data/wireguard which is where the external config paths are mounted INTO the container.

Changes i had to make to your fork to get it to run:

@gavinelder wondering if we should attempt to add a new config option to have theme original (green) / dark as i like the idea of having the option.

Also here is my compose file if you are interested @BankaiNoJutsu

version: "3.3"
services:
  subspace:
   build:
     context: .
     dockerfile: Dockerfile
   container_name: subspace
   volumes:
    - /mnt/docker/subspace_data:/data
   restart: always
   environment:
    - SUBSPACE_HTTP_HOST=localhost
    - SUBSPACE_LETSENCRYPT=false
    - SUBSPACE_HTTP_INSECURE=true
    - SUBSPACE_HTTP_ADDR=":80"
    - SUBSPACE_NAMESERVER=1.1.1.1
    - SUBSPACE_LISTENPORT=51820
    - SUBSPACE_IPV4_POOL=10.99.97.0/24
    - SUBSPACE_IPV6_POOL=fd00::10:97:0/64
    - SUBSPACE_IPV4_GW=10.99.97.1
    - SUBSPACE_IPV6_GW=fd00::10:97:1
    - SUBSPACE_IPV6_NAT_ENABLED=1
   cap_add:
    - NET_ADMIN
   network_mode: "host"
gavinelder commented 4 years ago

@BankaiNoJutsu thanks for your patience I will review your PR tomorrow.