Skip to content

Commit

Permalink
Update dependencies, add icons, tunnel editor, buttons to add, delete…
Browse files Browse the repository at this point in the history
… and zip tunnels.
  • Loading branch information
UnnoTed committed Aug 15, 2021
1 parent c2990d0 commit 89b8eb8
Show file tree
Hide file tree
Showing 29 changed files with 1,206 additions and 4,878 deletions.
Binary file added Icon/add_tunnel.ico
Binary file not shown.
Binary file added Icon/add_tunnel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icon/connected.ico
Binary file not shown.
Binary file added Icon/connected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icon/delete.ico
Binary file not shown.
Binary file added Icon/delete.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icon/not_connected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icon/wg_connected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icon/wireguard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icon/wireguard_off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Icon/zip.ico
Binary file not shown.
Binary file added Icon/zip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 28 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
# wireguird

unfinished, can connect and disconnect... only shows configs from /etc/wireguard/ (1 peer only), requires sudo (wg-quick and /etc/wireguard access), system tray icon goes red when connected, black when disconnected.
##### a linux gtk gui client for [Wireguard](https://www.wireguard.com/)

todo:
________________
Features:

- optional vpn country flag icon in system tray
- log tab
- edit config
- add configs
- delete configs
- show errors
- System tray icon goes red when connected, black when disconnected.
- Looks the same and does almost the same things as the official Wireguard's Windows gui client.
- Lists tunnels from `/etc/wireguard`
- Controls Wireguard ~~*through*~~ `wg-quick`

## preview (video)
## Preview (video)

[![wireguird preview](https://raw.githubusercontent.com/UnnoTed/wireguird/master/preview.jpg)](https://streamable.com/dpthpr)
[![wireguird preview](https://raw.githubusercontent.com/UnnoTed/wireguird/master/preview.png)](https://streamable.com/dpthpr)

## Download

##### Ubuntu

tested on: `18.04 LTS`, `20.04 LTS` and `21.04`

[wireguird_amd64.deb (1.8mb)](https://github.com/UnnoTed/wireguird/releases/download/v0.2.0/wireguird_amd64.deb)

## Compile

dependencies: `wireguard-tools libgtk-3-dev libappindicator3-dev`

```sh
git clone https://github.com/UnnoTed/wireguird
./deps.sh
./package.sh
./install.sh
```
11 changes: 10 additions & 1 deletion deb/DEBIAN/changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
wireguird (0.2) UNRELEASED; urgency=medium

* Add new icons to look the same as the Wireguard client for Windows.
* Add a button to Zip all tunnels into a single .zip file.
* Add a button to delete tunnels.
* Add a tunnel editor.

-- unknown <unknown@unknown> Sat, 14 Aug 2021 18:33:37 +0100

wireguird (0.1) UNRELEASED; urgency=medium

* Initial release. (Closes: #XXXXXX)
* Initial release.

-- unknown <unknown@unknown> Thu, 11 Feb 2021 01:36:25 +0100
2 changes: 1 addition & 1 deletion deb/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: wireguird
Source: wireguird
Version: 0.1
Version: 0.2
Section: utils
Priority: extra
Architecture: amd64
Expand Down
2 changes: 1 addition & 1 deletion deb/usr/share/applications/wireguird.desktop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Desktop Entry]
Encoding=UTF-8
Version=0.1
Version=0.2
Type=Application
Terminal=false
Exec=/usr/local/bin/wireguird
Expand Down
24 changes: 20 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,33 @@ module github.com/UnnoTed/wireguird
go 1.14

require (
github.com/BurntSushi/toml v0.4.1 // indirect
github.com/UnnoTed/fileb0x v1.1.4 // indirect
github.com/UnnoTed/horizontal v0.0.0-20180525202436-56ab29a31d79
github.com/UnnoTed/horizontal v0.0.0-20210214010602-906c695f4c68
github.com/bmatcuk/doublestar v1.3.4 // indirect
github.com/dawidd6/go-appindicator v1.0.0
github.com/dustin/go-humanize v1.0.0
github.com/gotk3/gotk3 v0.4.0
github.com/fatih/color v1.12.0 // indirect
github.com/gotk3/gotk3 v0.6.1
github.com/karrick/godirwalk v1.16.1 // indirect
github.com/labstack/echo v3.3.10+incompatible // indirect
github.com/labstack/gommon v0.3.0 // indirect
github.com/mattn/go-isatty v0.0.13 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/nsf/termbox-go v1.1.1 // indirect
github.com/nwidger/jsoncolor v0.3.0 // indirect
github.com/olekukonko/ts v0.0.0-20171002115256-78ecb04241c0 // indirect
github.com/rs/zerolog v1.18.0
github.com/rs/zerolog v1.23.0
github.com/smartystreets/goconvey v1.6.4 // indirect
github.com/ungerik/go-dry v0.0.0-20180411133923-654ae31114c8
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2
github.com/valyala/fasttemplate v1.2.1 // indirect
github.com/zenazn/goji v0.9.0 // indirect
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e // indirect
golang.org/x/text v0.3.7 // indirect
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20200515170644-ec7f26be9d9e
gopkg.in/ini.v1 v1.56.0
gopkg.in/yaml.v2 v2.4.0 // indirect
)
82 changes: 82 additions & 0 deletions go.sum

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions gui/get/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@ func main() {
list := []string{
"ApplicationWindow",
"ScrolledWindow",
"AboutDialog",
"ColorButton",
"MenuButton",
"HeaderBar",
"MenuItem",
"Notebook",
"TextView",
"Viewport",
"ListBox",
"Spinner",
"Button",
"Switch",
"Window",
"Entry",
"Label",
"Stack",
Expand Down
42 changes: 42 additions & 0 deletions gui/get/gtk.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ func ScrolledWindow(name string) (*gtk.ScrolledWindow, error) {
return scrolledwindow1, nil
}

func AboutDialog(name string) (*gtk.AboutDialog, error) {
obj, err := Builder.GetObject(name)
if err != nil {
return nil, err
}

aboutdialog1, ok := obj.(*gtk.AboutDialog)
if !ok {
return nil, errors.New("cant get *gtk.AboutDialog: " + name)
}

return aboutdialog1, nil
}

func ColorButton(name string) (*gtk.ColorButton, error) {
obj, err := Builder.GetObject(name)
if err != nil {
Expand Down Expand Up @@ -106,6 +120,20 @@ func Notebook(name string) (*gtk.Notebook, error) {
return notebook1, nil
}

func TextView(name string) (*gtk.TextView, error) {
obj, err := Builder.GetObject(name)
if err != nil {
return nil, err
}

textview1, ok := obj.(*gtk.TextView)
if !ok {
return nil, errors.New("cant get *gtk.TextView: " + name)
}

return textview1, nil
}

func Viewport(name string) (*gtk.Viewport, error) {
obj, err := Builder.GetObject(name)
if err != nil {
Expand Down Expand Up @@ -176,6 +204,20 @@ func Switch(name string) (*gtk.Switch, error) {
return switch1, nil
}

func Window(name string) (*gtk.Window, error) {
obj, err := Builder.GetObject(name)
if err != nil {
return nil, err
}

window1, ok := obj.(*gtk.Window)
if !ok {
return nil, errors.New("cant get *gtk.Window: " + name)
}

return window1, nil
}

func Entry(name string) (*gtk.Entry, error) {
obj, err := Builder.GetObject(name)
if err != nil {
Expand Down
56 changes: 46 additions & 10 deletions gui/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@ import (
"golang.zx2c4.com/wireguard/wgctrl"
)

const (
Version = "0.2.0"
Repo = "https://github.com/UnnoTed/wireguird"
TunnelsPath = "/etc/wireguard/"
)

var (
application *gtk.Application
indicator *appindicator.Indicator
builder *gtk.Builder
window *gtk.ApplicationWindow
header *gtk.HeaderBar
wgc *wgctrl.Client
editorWindow *gtk.Window
application *gtk.Application
indicator *appindicator.Indicator
builder *gtk.Builder
window *gtk.ApplicationWindow
header *gtk.HeaderBar
wgc *wgctrl.Client
)

func Create(app *gtk.Application, b *gtk.Builder, w *gtk.ApplicationWindow, ind *appindicator.Indicator) error {
Expand Down Expand Up @@ -47,7 +54,11 @@ func Create(app *gtk.Application, b *gtk.Builder, w *gtk.ApplicationWindow, ind

for _, d := range ds {
header.SetSubtitle("Connected to " + d.Name)
indicator.SetIcon("wireguard")
indicator.SetIcon("wg_connected")
}

if _, err := createEditor("", false); err != nil {
return err
}

t := &Tunnels{}
Expand All @@ -64,13 +75,38 @@ func ShowError(win *gtk.ApplicationWindow, err error, info ...string) {
return
}

if _, err := glib.IdleAdd(func() {
glib.IdleAdd(func() {
wlog("ERROR", err.Error())
dlg := gtk.MessageDialogNew(win, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, "%s", err.Error())
dlg.SetTitle("Error")
dlg.Run()
dlg.Destroy()
}); err != nil {
log.Error().Err(err).Msg("cant run idleadd")
})
}

func createEditor(name string, show bool) (*gtk.Window, error) {
if editorWindow == nil {
var err error
editorWindow, err = get.Window("editor_window")
if err != nil {
log.Error().Err(err).Msg("error getting main_window")
return nil, err
}

// prevents having to re-create the editor window
editorWindow.HideOnDelete()
}

if show {
ne, err := get.Entry("editor_name")
if err != nil {
return nil, err
}
ne.SetText(name)

editorWindow.SetTitle("Edit tunnel - " + name)
editorWindow.ShowAll()
}

return editorWindow, nil
}
Loading

0 comments on commit 89b8eb8

Please sign in to comment.