add deb package
add basic logs
pull/4/head v0.1.0
UnnoTed 3 years ago
parent bcdf4e0192
commit c2990d0c93
  1. BIN
      Icon/128x128/wireguard.png
  2. BIN
      Icon/128x128/wireguard_off.png
  3. BIN
      Icon/16x16/wireguard.png
  4. BIN
      Icon/16x16/wireguard_off.png
  5. BIN
      Icon/256x256/wireguard.png
  6. BIN
      Icon/256x256/wireguard_off.png
  7. BIN
      Icon/32x32/wireguard.png
  8. BIN
      Icon/32x32/wireguard_off.png
  9. BIN
      Icon/48x48/wireguard.png
  10. BIN
      Icon/48x48/wireguard_off.png
  11. 0
      Icon/dot-gray.png
  12. 0
      Icon/dot-gray.svg
  13. 0
      Icon/dot-green.png
  14. 0
      Icon/dot-green.svg
  15. 0
      Icon/wireguard.svg
  16. BIN
      Icon/wireguard_offz.png
  17. BIN
      Icon/wireguardz.png
  18. 5
      deb/DEBIAN/changelog
  19. 9
      deb/DEBIAN/control
  20. 2
      deb/usr/local/bin/wireguird
  21. 8
      deb/usr/share/applications/wireguird.desktop
  22. 18
      deb/usr/share/polkit-1/actions/wireguird.policy
  23. 1
      deps.sh
  24. 37
      fileb0x.toml
  25. 1
      go.mod
  26. 15
      go.sum
  27. 1
      gui/gui.go
  28. 124
      gui/tunnels.go
  29. BIN
      icon/wireguard.png
  30. BIN
      icon/wireguard_off.png
  31. 6
      main.go
  32. 14
      package.sh
  33. 389
      wireguird.glade

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Before

Width:  |  Height:  |  Size: 784 B

After

Width:  |  Height:  |  Size: 784 B

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Before

Width:  |  Height:  |  Size: 866 B

After

Width:  |  Height:  |  Size: 866 B

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

@ -0,0 +1,5 @@
wireguird (0.1) UNRELEASED; urgency=medium
* Initial release. (Closes: #XXXXXX)
-- unknown <unknown@unknown> Thu, 11 Feb 2021 01:36:25 +0100

@ -0,0 +1,9 @@
Package: wireguird
Source: wireguird
Version: 0.1
Section: utils
Priority: extra
Architecture: amd64
Depends: wireguard-tools, resolvconf, libgtk-3-dev, libappindicator3-dev (>= 1.0.0)
Maintainer: UnnoTed
Description: GTK GUI for Wireguard

@ -0,0 +1,2 @@
#!/bin/sh
pkexec /opt/wireguird/wireguird

@ -0,0 +1,8 @@
[Desktop Entry]
Encoding=UTF-8
Version=0.1
Type=Application
Terminal=false
Exec=/usr/local/bin/wireguird
Name=Wireguird
Icon=/opt/wireguird/Icon/128x128/wireguard.png

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<action id="org.freedesktop.policykit.pkexec.wireguird">
<description>Wireguard GUI</description>
<message>Authentication is required to run wireguird</message>
<!-- <icon_name>accessories-text-editor</icon_name> -->
<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>auth_admin</allow_inactive>
<allow_active>auth_admin</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/opt/wireguird/wireguird</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>

@ -0,0 +1 @@
sudo apt install wireguard-tools libgtk-3-dev libappindicator3-dev

@ -115,43 +115,6 @@ debug = false
# type: array of objects
[[custom]]
# type: array of strings
files = ["./flags/*.png"]
# base is the path that will be removed from all files' path
# type: string
base = "./flags/"
# prefix is the path that will be added to all files' path
# type: string
prefix = ""
# build tags for this set of files
# it will only work if spread mode is enabled
tags = ""
# end: custom
# type: array of objects
[[custom]]
# type: array of strings
files = ["./icon/*"]
# base is the path that will be removed from all files' path
# type: string
base = "./"
# prefix is the path that will be added to all files' path
# type: string
prefix = ""
# build tags for this set of files
# it will only work if spread mode is enabled
tags = ""
# end: custom
# type: array of objects
[[custom]]
# type: array of strings
files = ["*.glade"]

@ -11,6 +11,7 @@ require (
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/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
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20200515170644-ec7f26be9d9e

@ -19,11 +19,18 @@ github.com/gizak/termui/v3 v3.1.0 h1:ZZmVDgwHl7gR7elfKf1xc4IudXZ5qqfDh4wExk4Iajc
github.com/gizak/termui/v3 v3.1.0/go.mod h1:bXQEBkJpzxUAKf0+xq9MSWAvWZlE7c+aidmyFlkYTrY=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gotk3/gotk3 v0.4.0 h1:TIuhyQitGeRTxOQIV3AJlYtEWWJpC74JHwAIsxlH8MU=
github.com/gotk3/gotk3 v0.4.0/go.mod h1:Eew3QBwAOBTrfFFDmsDE5wZWbcagBL1NUslj1GhRveo=
github.com/gotk3/gotk3 v0.5.1 h1:zIZM2K4gmkGz1idEFVUPTQfAK/pnWoLKrlIjLOc4kzo=
github.com/jsimonetti/rtnetlink v0.0.0-20190606172950-9527aa82566a/go.mod h1:Oz+70psSo5OFh8DBl0Zv2ACw7Esh6pPUphlvZG9x7uw=
github.com/jsimonetti/rtnetlink v0.0.0-20200117123717-f846d4f6c1f4 h1:nwOc1YaOrYJ37sEBrtWZrdqzK22hiJs3GpDmP3sR2Yw=
github.com/jsimonetti/rtnetlink v0.0.0-20200117123717-f846d4f6c1f4/go.mod h1:WGuG/smIU4J/54PblvSbh+xvCZmpJnFgr3ds6Z55XMQ=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/karrick/godirwalk v1.7.8 h1:VfG72pyIxgtC7+3X9CMHI0AOl4LwyRAg98WAgsvffi8=
github.com/karrick/godirwalk v1.7.8/go.mod h1:2c9FRhkDxdIbgkOnCEvnSWs71Bhugbl46shStcFDJ34=
github.com/labstack/echo v3.2.1+incompatible h1:J2M7YArHx4gi8p/3fDw8tX19SXhBCoRpviyAZSN3I88=
@ -46,6 +53,7 @@ github.com/mdlayher/netlink v0.0.0-20190409211403-11939a169225/go.mod h1:eQB3mZE
github.com/mdlayher/netlink v1.0.0/go.mod h1:KxeJAFOFLG6AjpyDkQ/iIhxygIUKD+vcwqcnu43w/+M=
github.com/mdlayher/netlink v1.1.0 h1:mpdLgm+brq10nI9zM1BpX1kpDbh3NLl3RSnVq6ZSkfg=
github.com/mdlayher/netlink v1.1.0/go.mod h1:H4WCitaheIsdF9yOYu8CFmCgQthAPIWZmcKp9uZHgmY=
github.com/mikioh/ipaddr v0.0.0-20190404000644-d465c8ab6721 h1:RlZweED6sbSArvlE924+mUcZuXKLBHA35U7LN621Bws=
github.com/mikioh/ipaddr v0.0.0-20190404000644-d465c8ab6721/go.mod h1:Ickgr2WtCLZ2MDGd4Gr0geeCH5HybhRJbonOgQpvSxc=
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4=
@ -63,6 +71,10 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/rs/zerolog v1.18.0 h1:CbAm3kP2Tptby1i9sYy2MGRg0uxIN9cyDb59Ys7W8z8=
github.com/rs/zerolog v1.18.0/go.mod h1:9nvC1axdVrAHcu/s9taAVfBuIdTZLVQmKQyvrUjF5+I=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/ungerik/go-dry v0.0.0-20180411133923-654ae31114c8 h1:p6JzR5AMj5LyCEovRh5MOxmyuuwOEtfcVDwKqsBn41I=
github.com/ungerik/go-dry v0.0.0-20180411133923-654ae31114c8/go.mod h1:+LeLocciSarKa1pxOY7gmBQ7dSk5nB1w1f3nvvLw0j0=
@ -104,12 +116,13 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190828213141-aed303cbaa74/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.zx2c4.com/wireguard v0.0.20200121 h1:vcswa5Q6f+sylDfjqyrVNNrjsFUUbPsgAQTBCAg/Qf8=
golang.zx2c4.com/wireguard v0.0.20200121/go.mod h1:P2HsVp8SKwZEufsnezXZA4GRX/T49/HlU7DGuelXsU4=
golang.zx2c4.com/wireguard v0.0.20200320 h1:1vE6zVeO7fix9cJX1Z9ZQ+ikPIIx7vIyU0o0tLDD88g=
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20200515170644-ec7f26be9d9e h1:fqDhK9OlzaaiFjnyaAfR9Q1RPKCK7OCTLlHGP9f74Nk=
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20200515170644-ec7f26be9d9e/go.mod h1:UdS9frhv65KTfwxME1xE8+rHYoFpbm36gOud1GhBe9c=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

@ -65,6 +65,7 @@ func ShowError(win *gtk.ApplicationWindow, err error, info ...string) {
}
if _, err := 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()

@ -94,14 +94,14 @@ func (t *Tunnels) Create() error {
var img *gtk.Image
if activeName == name {
green, err := gtk.ImageNewFromFile("./icon/dot-green.png")
green, err := gtk.ImageNewFromFile("/opt/wireguird/Icon/dot-green.png")
if err != nil {
return err
}
img = green
} else {
gray, err := gtk.ImageNewFromFile("./icon/dot-gray.png")
gray, err := gtk.ImageNewFromFile("/opt/wireguird/Icon/dot-gray.png")
if err != nil {
return err
}
@ -109,7 +109,7 @@ func (t *Tunnels) Create() error {
}
t.icons[name] = img
// img, err := gtk.ImageNewFromFile("./icon/dot-gray.png")
// img, err := gtk.ImageNewFromFile("/opt/wireguird/Icon/dot-gray.png")
// if err != nil {
// return err
// }
@ -249,7 +249,7 @@ func (t *Tunnels) Create() error {
activeName = t.ActiveDeviceName()
for _, d := range list {
gray, err := gtk.ImageNewFromFile("./icon/dot-gray.png")
gray, err := gtk.ImageNewFromFile("/opt/wireguird/Icon/dot-gray.png")
if err != nil {
return err
}
@ -266,6 +266,11 @@ func (t *Tunnels) Create() error {
}
row := tl.GetSelectedRow()
// row not found for config
if row == nil {
return nil
}
name, err := row.GetName()
if err != nil {
return err
@ -274,7 +279,10 @@ func (t *Tunnels) Create() error {
// dont connect to the new one
if activeName != "" && activeName == name {
t.UpdateRow(row)
header.SetSubtitle("Not connected!")
glib.IdleAdd(func() {
header.SetSubtitle("Not connected!")
})
return nil
}
@ -286,7 +294,7 @@ func (t *Tunnels) Create() error {
header.SetSubtitle("Connected to " + name)
})
green, err := gtk.ImageNewFromFile("./icon/dot-green.png")
green, err := gtk.ImageNewFromFile("/opt/wireguird/Icon/dot-green.png")
if err != nil {
return err
}
@ -296,6 +304,11 @@ func (t *Tunnels) Create() error {
t.UpdateRow(row)
indicator.SetIcon("wireguard")
})
if err := wlog("INFO", "Connected to "+name); err != nil {
return err
}
return nil
}()
@ -322,6 +335,11 @@ func (t *Tunnels) Create() error {
}
row := tl.GetSelectedRow()
if row == nil {
t.UnknownLabels()
continue
}
name, err := row.GetName()
if err != nil {
log.Error().Err(err).Msg("row get name err")
@ -343,9 +361,10 @@ func (t *Tunnels) Create() error {
for _, p := range d.Peers {
hs := humanize.Time(p.LastHandshakeTime)
t.Peer.LatestHandshake.SetText(hs)
t.Peer.Transfer.SetText(humanize.Bytes(uint64(p.ReceiveBytes)) + " received, " + humanize.Bytes(uint64(p.TransmitBytes)) + " sent")
glib.IdleAdd(func() {
t.Peer.LatestHandshake.SetText(hs)
t.Peer.Transfer.SetText(humanize.Bytes(uint64(p.ReceiveBytes)) + " received, " + humanize.Bytes(uint64(p.TransmitBytes)) + " sent")
})
}
}
}()
@ -376,15 +395,17 @@ func (t *Tunnels) UpdateRow(row *gtk.ListBoxRow) {
peersec := cfg.Section("Peer")
insec := cfg.Section("Interface")
t.Interface.Addresses.SetText(insec.Key("Address").String())
t.Interface.Status.SetText("Inactive")
t.Interface.DNS.SetText(insec.Key("DNS").String())
glib.IdleAdd(func() {
t.Interface.Addresses.SetText(insec.Key("Address").String())
t.Interface.Status.SetText("Inactive")
t.Interface.DNS.SetText(insec.Key("DNS").String())
t.ButtonChangeState.SetLabel("Activate")
t.ButtonChangeState.SetLabel("Activate")
t.Peer.AllowedIPs.SetText(peersec.Key("AllowedIPs").String())
t.Peer.PublicKey.SetText(peersec.Key("PublicKey").String())
t.Peer.Endpoint.SetText(peersec.Key("Endpoint").String())
t.Peer.AllowedIPs.SetText(peersec.Key("AllowedIPs").String())
t.Peer.PublicKey.SetText(peersec.Key("PublicKey").String())
t.Peer.Endpoint.SetText(peersec.Key("Endpoint").String())
})
for _, d := range ds {
if d.Name != id {
@ -397,16 +418,20 @@ func (t *Tunnels) UpdateRow(row *gtk.ListBoxRow) {
// boxPeers.Remove(item.(*gtk.Widget))
// })
t.Interface.Status.SetText("Active")
t.ButtonChangeState.SetLabel("Deactivate")
t.Interface.PublicKey.SetText(d.PublicKey.String())
t.Interface.ListenPort.SetText(strconv.Itoa(d.ListenPort))
glib.IdleAdd(func() {
t.Interface.Status.SetText("Active")
t.ButtonChangeState.SetLabel("Deactivate")
t.Interface.PublicKey.SetText(d.PublicKey.String())
t.Interface.ListenPort.SetText(strconv.Itoa(d.ListenPort))
})
for _, p := range d.Peers {
hs := humanize.Time(p.LastHandshakeTime)
t.Peer.LatestHandshake.SetText(hs)
t.Peer.Transfer.SetText(humanize.Bytes(uint64(p.ReceiveBytes)) + " received, " + humanize.Bytes(uint64(p.TransmitBytes)) + " sent")
glib.IdleAdd(func() {
t.Peer.LatestHandshake.SetText(hs)
t.Peer.Transfer.SetText(humanize.Bytes(uint64(p.ReceiveBytes)) + " received, " + humanize.Bytes(uint64(p.TransmitBytes)) + " sent")
})
}
break
@ -422,23 +447,25 @@ func (t *Tunnels) UpdateRow(row *gtk.ListBoxRow) {
}
func (t *Tunnels) UnknownLabels() {
t.ButtonChangeState.SetLabel("unknown")
glib.IdleAdd(func() {
t.ButtonChangeState.SetLabel("unknown")
t.Interface.Addresses.SetText("unknown")
t.Interface.Status.SetText("unknown")
t.Interface.DNS.SetText("unknown")
t.Interface.Addresses.SetText("unknown")
t.Interface.Status.SetText("unknown")
t.Interface.DNS.SetText("unknown")
t.Peer.AllowedIPs.SetText("unknown")
t.Peer.PublicKey.SetText("unknown")
t.Peer.Endpoint.SetText("unknown")
t.Peer.AllowedIPs.SetText("unknown")
t.Peer.PublicKey.SetText("unknown")
t.Peer.Endpoint.SetText("unknown")
t.Interface.Status.SetText("unknown")
t.ButtonChangeState.SetLabel("unknown")
t.Interface.PublicKey.SetText("unknown")
t.Interface.ListenPort.SetText("unknown")
t.Peer.LatestHandshake.SetText("unknown")
t.Interface.Status.SetText("unknown")
t.ButtonChangeState.SetLabel("unknown")
t.Interface.PublicKey.SetText("unknown")
t.Interface.ListenPort.SetText("unknown")
t.Peer.LatestHandshake.SetText("unknown")
t.Peer.Transfer.SetText("unknown")
t.Peer.Transfer.SetText("unknown")
})
}
func (t *Tunnels) ActiveDeviceName() string {
@ -450,3 +477,30 @@ func (t *Tunnels) ActiveDeviceName() string {
return ""
}
func wlog(t string, text string) error {
wlogs, err := get.ListBox("wireguard_logs")
if err != nil {
return err
}
l, err := gtk.LabelNew("")
if err != nil {
return err
}
if t == "ERROR" {
t = `<span color="#FF0000">` + t + "</span>"
}
l.SetMarkup(`<span color="#008080">[` + time.Now().Format("02/Jan/06 15:04:05 MST") + `]</span>[` + t + `]: ` + text)
l.SetHExpand(true)
l.SetHAlign(gtk.ALIGN_START)
glib.IdleAdd(func() {
l.Show()
wlogs.Add(l)
})
return nil
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

@ -4,7 +4,6 @@ package main
import (
"os"
"runtime/debug"
"github.com/UnnoTed/horizontal"
"github.com/UnnoTed/wireguird/gui"
@ -21,7 +20,6 @@ var win *gtk.ApplicationWindow
func main() {
log.Logger = log.Output(horizontal.ConsoleWriter{Out: os.Stderr})
log.Info().Uint("major", gtk.GetMajorVersion()).Uint("minor", gtk.GetMinorVersion()).Uint("micro", gtk.GetMicroVersion()).Msg("GTK Version")
debug.SetGCPercent(100)
const appID = "com.wireguard.desktop"
application, err := gtk.ApplicationNew(appID, glib.APPLICATION_FLAGS_NONE)
@ -56,9 +54,9 @@ func createTray(application *gtk.Application) (*appindicator.Indicator, error) {
}
indicator := appindicator.New(application.GetApplicationID(), "wireguard_off", appindicator.CategoryApplicationStatus)
indicator.SetIconThemePath("./icon")
indicator.SetIconThemePath("/opt/wireguird/Icon/32x32")
indicator.SetTitle("Wireguird")
indicator.SetLabel("Wireguird", "")
// indicator.SetLabel("Wireguird", "")
indicator.SetStatus(appindicator.StatusActive)
indicator.SetMenu(menu)

@ -0,0 +1,14 @@
echo "wireguird: cleaning..."
rm -r ./build/wireguird_amd64.deb
rm -r ./deb/opt/wireguird/
mkdir ./deb/opt/wireguird
echo "wireguird: building go binary..."
go build -ldflags "-s -w" -trimpath -o ./deb/opt/wireguird/wireguird
echo "wireguird: copying icons..."
cp -r ./Icon/ ./deb/opt/wireguird/
echo "wireguird: building debian package..."
dpkg-deb --root-owner-group --build ./deb ./build/wireguird_amd64.deb
echo "wireguird: done"

@ -1,236 +1,326 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.36.0 -->
<!-- Generated with glade 3.38.1 -->
<interface>
<requires lib="gtk+" version="3.22"/>
<object class="GtkApplicationWindow" id="main_window">
<property name="width_request">650</property>
<property name="height_request">470</property>
<property name="can_focus">False</property>
<property name="window_position">center</property>
<property name="show_menubar">False</property>
<property name="width-request">650</property>
<property name="height-request">470</property>
<property name="can-focus">False</property>
<property name="window-position">center</property>
<property name="show-menubar">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkStack" id="main_stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_start">8</property>
<property name="margin_end">8</property>
<property name="margin_top">8</property>
<property name="margin_bottom">8</property>
<property name="can-focus">False</property>
<property name="margin-start">8</property>
<property name="margin-end">8</property>
<property name="margin-top">8</property>
<property name="margin-bottom">8</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="transition_type">slide-left-right</property>
<property name="transition-type">slide-left-right</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="spacing">8</property>
<child>
<object class="GtkScrolledWindow">
<property name="width_request">200</property>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<property name="can-focus">False</property>
<property name="hexpand">False</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkViewport">
<property name="width_request">200</property>
<object class="GtkScrolledWindow">
<property name="width-request">200</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscrollbar-policy">never</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkListBox" id="tunnel_list">
<property name="width_request">200</property>
<object class="GtkViewport">
<property name="width-request">200</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<child>
<object class="GtkListBox" id="tunnel_list">
<property name="width-request">200</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-top">8</property>
<property name="spacing">8</property>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Add tunnel</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">R</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Z</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can-focus">True</property>
<property name="hexpand">True</property>
<property name="hscrollbar_policy">never</property>
<property name="vexpand">True</property>
<property name="hscrollbar-policy">never</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<property name="spacing">4</property>
<child>
<object class="GtkFrame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">out</property>
<property name="can-focus">False</property>
<property name="label-xalign">0</property>
<property name="shadow-type">out</property>
<child>
<object class="GtkAlignment">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="top_padding">8</property>
<property name="bottom_padding">8</property>
<property name="left_padding">8</property>
<property name="right_padding">8</property>
<property name="top-padding">8</property>
<property name="bottom-padding">8</property>
<property name="left-padding">8</property>
<property name="right-padding">8</property>
<child>
<!-- n-columns=3 n-rows=6 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="column_spacing">8</property>
<property name="can-focus">False</property>
<property name="column-spacing">8</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Status:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Public key:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Listen port:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Addresses:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">DNS servers:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="left-attach">0</property>
<property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_interface_status">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_interface_public_key">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_interface_listen_port">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_interface_addresses">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_interface_dns_servers">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
<property name="left-attach">1</property>
<property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button_change_state">
<property name="label" translatable="yes">Activate</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="halign">start</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
<property name="left-attach">1</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
@ -238,7 +328,7 @@
<child type="label">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Interface:</property>
</object>
</child>
@ -252,151 +342,167 @@
<child>
<object class="GtkBox" id="box_peers">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkFrame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">out</property>
<property name="can-focus">False</property>
<property name="label-xalign">0</property>
<property name="shadow-type">out</property>
<child>
<object class="GtkAlignment">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="top_padding">8</property>
<property name="bottom_padding">8</property>
<property name="left_padding">8</property>
<property name="right_padding">8</property>
<property name="top-padding">8</property>
<property name="bottom-padding">8</property>
<property name="left-padding">8</property>
<property name="right-padding">8</property>
<child>
<!-- n-columns=3 n-rows=5 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="column_spacing">8</property>
<property name="row_homogeneous">True</property>
<property name="can-focus">False</property>
<property name="column-spacing">8</property>
<property name="row-homogeneous">True</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Public key:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Allowed IPs:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Endpoint:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Latest handshake:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Transfer:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="left-attach">0</property>
<property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_peer_public_key">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_peer_allowed_ips">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_peer_endpoint">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_peer_latest_handshake">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_peer_transfer">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
<property name="left-attach">1</property>
<property name="top-attach">4</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
@ -404,7 +510,7 @@
<child type="label">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Peer</property>
</object>
</child>
@ -425,12 +531,12 @@
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="valign">start</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
</object>
<packing>
@ -443,8 +549,8 @@
<object class="GtkButton">
<property name="label" translatable="yes">Edit</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="halign">start</property>
<property name="valign">start</property>
</object>
@ -479,23 +585,32 @@
</packing>
</child>
<child>
<object class="GtkBox">
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child>
<placeholder/>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscroll-policy">natural</property>
<property name="vscroll-policy">natural</property>
<child>
<object class="GtkListBox" id="wireguard_logs">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="name">log</property>
<property name="title" translatable="yes">Log</property>
<property name="name">logs</property>
<property name="title" translatable="yes">Logs</property>
<property name="position">1</property>
</packing>
</child>
@ -512,14 +627,14 @@
<child type="titlebar">
<object class="GtkHeaderBar" id="main_header">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="title" translatable="yes">Wireguird</property>
<property name="subtitle" translatable="yes">Not connected</property>
<property name="show_close_button">True</property>
<property name="show-close-button">True</property>
<child>
<object class="GtkStackSwitcher">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="stack">main_stack</property>
</object>
</child>

Loading…
Cancel
Save